Levram Writeup - Proving Grounds
Created October 7, 2026 • Last updated October 7, 2026 • 2 min read
Levram runs Gerapy v0.9.7 on port 8000 with the default admin credentials. That version is vulnerable to CVE-2021-32849, an authenticated remote code execution that gives a shell as the app user. The python3.10 binary carries the cap_setuid capability, which lets it set UID 0 for root.
Reconnaissance
Nmap
Scan the target for open services.
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 8000/tcp open http Gerapy
Explain command
| -p- | Scan all 65535 TCP ports. |
| -sCV | Run the default scripts and probe service versions. |
Port 8000 runs Gerapy, a Scrapy-based crawler management platform. The login accepts admin:admin, and the footer shows version v0.9.7, which is vulnerable to CVE-2021-32849.
Exploitation
Gerapy authenticated RCE (CVE-2021-32849)
A public exploit abuses the project build feature to run commands. Confirm execution with id, then pass a base64 reverse shell as the command.
Explain command
| -u | Gerapy URL. |
| -U / -P | Gerapy credentials. |
| -r / -p | Attacker IP and port for the callback. |
| -c | Command to run on the target. |
Rerun with a base64-encoded reverse shell as the command and catch it on a listener. The shell lands as the app user. Enumerate file capabilities.
Privilege Escalation
python cap_setuid
Search the filesystem for binaries with capabilities.
/usr/bin/python3.10 cap_setuid=ep /usr/bin/ping cap_net_raw=ep /usr/bin/mtr-packet cap_net_raw=ep
Explain command
| -r | Search recursively. |
/usr/bin/python3.10 has cap_setuid=ep, so it can set its UID to 0. Use it to drop into a root shell.
app@ubuntu:~/gerapy$ /usr/bin/python3.10 -c 'import os; os.setuid(0); os.system("/bin/bash")'
root@ubuntu:~/gerapy# id
uid=0(root) gid=1000(app) groups=1000(app)
The cap_setuid capability lets python become root, giving a root shell. The /etc/systemd/system/app.service unit file also leaks the root password in a comment as an alternative path.
Related
References
-
Gerapy authenticated remote code execution through the project build feature.
-
GTFOBins: python capabilitiesTOOL: GTFOBins: python capabilities, gtfobins.github.io/gtfobins/python/#capabilities (opens in new tab)
A python binary with cap_setuid can set UID 0 for a root shell.