Contrabando — HTTP Request Smuggling (CVE-2023–25690) + SSTI Escape + Bash GLOB Bypass to Root
The report describes a chain of vulnerabilities in a TryHackMe box: a local file inclusion in a PHP script, a CRLF injection in Apache's mod_rewrite leading to HTTP request smuggling (CVE-2023-25690), command injection in a password generator, SSRF and SSTI in a Flask service, a Bash glob comparison bypass, and unsafe Python 2 input() leading to root. An attacker could read files, execute commands, pivot to the host, and escalate to root.
Published on medium.com
Contrabando is a containerized web-exploitation box that chains five distinct bugs across three trust boundaries. It starts with a textbook LFI in a PHP readfile() sink, but the real key is a CRLF injection in Apache's modrewrite/modproxy layer that allows smuggling a second, fully independent HTTP request straight to…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Multiple root causes: unsanitised user input in file reads, command execution, template rendering, and shell comparisons, plus missing patches for known vulnerabilities.
Impact
An attacker could read arbitrary files, execute commands as www-data, pivot to the host, execute code as hansolo, and escalate to root.
What the attacker needed
Network access to the target; ability to host files (for SSTI payload); a listener for reverse shells
The fix
The report recommends upgrading Apache, avoiding unsafe functions like exec() and render_template_string(), quoting Bash comparisons, and migrating from Python 2.
How it was found
- Discover a local file inclusion in index.php via the page parameter.
- Identify a front-end proxy and backend Apache split by comparing Server headers.
- Exploit CVE-2023-25690 by injecting CRLF into the URL path to smuggle a second request to the backend.
- Use the smuggled request to reach gen.php and inject a command via the length parameter to get a shell.
- From the container, scan the internal network and find a Flask service on port 5000.
- Exploit SSRF to read the Flask app source, then use SSTI to execute code and get a shell as hansolo.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This report walks through a series of mistakes in a practice environment. A web server lets attackers read files and run commands, then a chain of other flaws allows moving to the main machine and becoming the administrator. Each step exploits a different programming or configuration error.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.