Sending Files over HTTP/S
π Catching Files Over HTTP/S β Secure File Transfers with Nginx
When it comes to file exfiltration, web-based transfers (HTTP/S) are king π. Why?
β Most firewalls allow HTTP/S
β HTTPS encrypts content π
β Easy to use tools like
curl
,wget
, orPython
However, misconfigured file transfers (like plaintext uploads or public directory listings) can set off alarms π¨. So, letβs do this the right way β secure, stealthy, and functional!
π§± Step-by-Step: Secure Uploads with Nginx
Letβs configure a simple and secure upload endpoint using Nginx and the HTTP PUT method.
π 1. Create Upload Directory
This is where uploaded files will be saved.
π¨βπ§ 2. Set Proper Permissions
π www-data
is the default user Nginx runs under.
π 3. Create Nginx Config File
Paste in:
π‘ Weβre using port
9001
to avoid port conflicts.
π 4. Enable the Site
π 5. Start (or Restart) Nginx
π οΈ 6. Troubleshoot Port Conflicts (Optional)
If you get an error like:
Do this:
Then remove the default config:
β Done! Port conflict resolved.
π€ 7. Upload a File Using curl
curl
Letβs upload /etc/passwd
and save it as users.txt
:
β Success check:
π« 8. Disable Directory Listings (Good News!)
Nginx, by default, doesnβt allow directory listings. So when you browse to:
Youβll see a 403 Forbidden
or blank β and thatβs exactly what we want! π
π§ͺ Why Not Apache?
Apache makes it easier to accidentally execute uploaded scripts, especially if:
PHP is enabled (π₯
.php
shell = auto executed)Directory listing is enabled
With Nginx:
Itβs minimal by default β
You explicitly configure what you need π οΈ
Safer for stealthy operations or CTF uploads π―
Last updated