Skip to content
RCE Write-up Advanced

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.

Roshan Rajbanshi Follow

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…

Roshan Rajbanshi, on medium.com

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

  1. Discover a local file inclusion in index.php via the page parameter.
  2. Identify a front-end proxy and backend Apache split by comparing Server headers.
  3. Exploit CVE-2023-25690 by injecting CRLF into the URL path to smuggle a second request to the backend.
  4. Use the smuggled request to reach gen.php and inject a command via the length parameter to get a shell.
  5. From the container, scan the internal network and find a Flask service on port 5000.
  6. 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.

More by Roshan Rajbanshi

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.