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, or Python

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

sudo mkdir -p /var/www/uploads/SecretUploadDirectory

This is where uploaded files will be saved.


πŸ‘¨β€πŸ”§ 2. Set Proper Permissions

sudo chown -R www-data:www-data /var/www/uploads/SecretUploadDirectory

πŸ“Œ 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

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