Zeno – TryHackMe

From Restaurant Management System RCE to Root via PwnKit
Difficulty: <Easy / Medium> | Skills: Port & service enumeration, web directory fuzzing, public exploit research, unrestricted file upload → RCE, reverse shell upgrading, Linux privilege escalation (CVE-2021-4034 / PwnKit)
Overview
This box is a clean, methodical walk down a very common path: find a forgotten web app, match it to a public exploit, turn code execution into an interactive shell, and finish with a kernel/polkit-level local privilege escalation. The web root serves a Restaurant Management System (RMS) install that’s vulnerable to a documented unrestricted file upload, which hands over remote code execution. From there, LinPEAS flags the box as vulnerable to PwnKit (CVE-2021-4034), and a quick compile-and-run drops me straight to root.
Nothing here is exotic – it’s a great example of why enumeration and “search the version string” discipline pay off. Here’s the full methodology, start to finish.
1. Enumeration
As always, I started with nmap. First a full TCP sweep plus the top UDP ports so nothing gets missed:


Two TCP ports came back open: 22 (SSH) and 12340 – a non-standard high port that’s almost always the interesting one.
With the open ports known, I ran a targeted service-version and default-script scan against just those two:

Port 22 is standard OpenSSH –
not my first target without creds. Port 12340 is an HTTP server, so that’s where the attention goes.
Tip: A high, odd port number like
12340is a strong hint that someone stood up a web app by hand. Those are frequently unpatched, default-configured, and exactly the kind of thing that matches a public exploit.
2. Web Enumeration
Browsing to http://<TARGET_IP>:12340/ directly didn’t show anything useful – no obvious app, nothing interesting in the source. So I fuzzed for directories and files:

That turned up a directory at /rms.
Navigating to http://<TARGET_IP>:12340/rms loads the front end for a hotel Restaurant Management System – menus, reservations, the usual. Clicking around, there’s not much of value exposed on the surface: no obvious creds, no sensitive data lying in the open.

But “RMS / Restaurant Management System” is a very specific, identifiable application – and a named off-the-shelf app is a lead in itself. Time to see if it has a known CVE.
3. Finding the Exploit
A quick search for rms exploit / Restaurant Management System exploit points straight at an Exploit-DB entry:
Restaurant Management System 1.0 – Remote Code Execution (RCE) https://www.exploit-db.com/exploits/47520

The underlying bug is an unrestricted file upload: the application accepts a file through one of its upload endpoints without properly validating type/extension, so a PHP payload can be uploaded and then requested directly – giving arbitrary command execution as the web server user.
4. Exploitation – Web Shell to Reverse Shell
Running the exploit against the target uploads the PHP payload and gives me a basic command-execution web shell.
From the web shell I confirmed execution with id / whoami, then immediately upgraded to a proper interactive reverse shell. Listener on my box:

That lands me on the box as the web service user – foothold complete.
5. Privilege Escalation – LinPEAS → PwnKit (CVE-2021-4034)
With a stable shell, I pulled over LinPEAS to enumerate escalation paths. Serve it from the attacker and grab it on the target.
LinPEAS flagged the box as vulnerable to PwnKit – CVE-2021-4034, the local privilege escalation in polkit‘s pkexec. It’s a near-guaranteed root on vulnerable systems and is everywhere, because pkexec ships SUID-root by default on most distros.

I moved a PwnKit PoC onto the box, after compiling it locally, and ran it:

Full compromise – from an exposed web app on a weird port to root.
Key Takeaways & Remediation
A short box, but every link in the chain maps to a real-world misconfiguration worth calling out:
- Don’t expose management apps on odd ports and assume obscurity = security. Port
12340wasn’t hidden – it was the first thingnmap -p-found. Anything reachable will be fuzzed and fingerprinted. - Named off-the-shelf software is a liability if it’s unpatched. The moment the app identified as “Restaurant Management System 1.0,” it was one search away from a public RCE. Keep third-party web apps updated and remove abandoned installs.
- Unrestricted file upload is still one of the most reliable footholds. Validate upload type and extension server-side, store uploads outside the web root, and never execute user-supplied files.
- Patch PwnKit. CVE-2021-4034 has been public since January 2022 and exploitation is trivial and reliable. Update
polkit, or as a stopgap strip the SUID bit frompkexec(chmod 0755 /usr/bin/pkexec) if you can’t patch immediately. - Run host enumeration early. LinPEAS found the escalation path in one pass – defenders can run the same tooling to find these issues before an attacker does.
Thanks for reading – drop a comment if you took a different route to root on this one, I’d love to hear it.
This writeup is published for educational purposes only. Only ever test systems you own or have explicit permission to assess.
0 Comments