Lessons Learnt summary
| Lab | blue |
|---|---|
| Main goal | Get hands into Metasploit, and exploit EternalBlue on Windows 7 machine |
| Pitfalls to avoid |
|
| CTF files | 💾 The files of this lab's writeup are available here |
The lab details
Reconnaissance
With -sC you will have the default scripts run, not the vuln ones.
The EternalBlue script is a vuln one, so you will need to run it either specifically, or using broader --script vuln
-sC)EternalBlue exploit using Metasploit
msfconsole and load the proper module for MS17-010
RHOSTS option, which btw can be defined at run with run rhosts=10.x.x.x
LHOST was incorrect: Metasploit used the WLAN IP (192.x.x.x) instead of the VPN IP (10.x.x.x). Once properly set, the reverse shell popped inWhen running a Metasploit exploit in the TryHackMe labs, don't forget to check the local host IP, as it may be the LAN one instead of the TryHackMe VPN one. I think I lost quite some time because of that…
Leverage from shell to meterpreter
sessions command)
LHOST valueThe post exploit may be slow. Be patient. I wasn't. That's why the terminal is a mess here!
You may setg LHOST 10.x.x.x so you don't have to define this option on every module: it will be globally set (hence the "g")
ps command now works and so does getpid, so we can see we already are in a process which is SYSTEM
Use migrate PID otherwise, or give a shot at other commands from help
Get passwords
hashdump now works, since the session is not stuck. I was running to try cracking it with hashcat, but, that laptop has no proper hardware for this…I've run hashcat on another machine, but I then don't have the screenshots
Note that here, I was heading to generic (weak) passwords. I wouldn't have found the actual one from this. It is recommanded to use the rockyou.txt passwords from the seclists package
In the hashdump result, first hash is LM (empty here) and second is NTLM (our target password). We don't need to crack the first one using hashcat, just the second one, so that's faster.
Flags
If you're not "root" (SYSTEM), then such search might not return results, as you may not have access to the folder where the flag is.
Also, this would fail if flag was named user.txt or root.txt