Skip to content
SSRF Write-up Advanced

SSRF via Content-Type in Apache — Auditor | FahemSec

The /sync_audit endpoint reflected the charset parameter into the Content-Type response header without validation, allowing CRLF header injection. By injecting a Location header and a Content-Type header that Apache treated as a proxy handler, the attacker forced the server to request an internal Flask app and retrieve the flag.

medium.com

Published on medium.com

The application consists of a Go-based web server under /app/src, an Apache configuration file, and an internal Flask application intended to be accessible only from the internal network.

Abdelrahman Radwan, 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

The application failed to sanitise the charset parameter before inserting it into a response header, enabling CRLF injection; Apache then treated the injected Content-Type as a handler for a path with no handler, forwarding the request via mod_proxy.

Impact

An attacker could force the server to make requests to internal services, retrieving sensitive data such as the flag from an internal-only Flask application.

What the attacker needed

A free account; victim not required

How it was found

  1. Create an account and log in to access /sync_audit.
  2. Send a request to /sync_audit with a charset value containing encoded CRLF to inject a Location header pointing to a path without a handler.
  3. In the same injected headers, add a Content-Type header whose value is a proxy URL to the internal service.
  4. Apache processes the Location internally, finds no handler for the path, uses the Content-Type as a handler, and mod_proxy fetches the internal URL.

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.

A web server can be tricked into making requests on behalf of the attacker if it trusts user input in response headers. Here, a parameter was placed into a header without cleaning, letting the attacker add extra headers. One of those headers made Apache act as a proxy and fetch an internal-only page.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.