Skip to content
SSRF Write-up Advanced

Offlinea: A Bartender, a Headless Browser, and Five Locks

A public PHP front-end forwarded the raw query string to an internal Flask app, so a duplicated url parameter was validated as a harmless public site by PHP (which reads the last value) while Flask fetched the first value, an internal loopback address. This SSRF let the attacker render internal pages to PDF, and a Python str.format call over stored URLs leaked the Flask SECRET_KEY, allowing a forged JWT to read the secrets table.

medium.com

Published on medium.com

The flag lives in a SQLite row that only the internal Flask endpoint /bartender will hand out, and only if you present a JWT signed with a random secret. You can't reach /bartender (it's bound to 127.0.0.1) and you can't forge the JWT (the key is os.urandom).

Saria Mubeen, 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

Likely the front-end validated one occurrence of a duplicated query parameter while the back-end acted on a different occurrence, and separately the back-end called str.format on attacker-controlled text.

Impact

An attacker could reach internal-only endpoints and leak the signing key, then forge tokens to read the secrets table containing the flag; the text notes outbound egress was blocked, limiting the SSRF to internal services.

What the attacker needed

Reachable public PHP front-end; internal Flask app on loopback; no outbound egress needed

The fix

The front-end and back-end should agree on a single parsed parameter value and the back-end should never call str.format on untrusted text.

How it was found

  1. Send a request with two url parameters, the first pointing at the internal loopback service and the second at a harmless public site.
  2. Confirm the internal page is rendered into the returned PDF.
  3. Plant a format-string payload in the first url parameter so it is stored in the history.
  4. Request the internal logs page again so the stored payload is formatted and the config is printed.
  5. Extract the SECRET_KEY from the rendered PDF.
  6. Forge a JWT with the leaked key and request the internal secrets endpoint to read the flag.

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.

The website had a public front door and a private back room that only the front door could talk to. The front door checked one copy of a web address while the back room used a different copy, so the attacker slipped a private address past the check. Once inside, a careless text-formatting step printed out a secret signing key, which let the attacker pretend to be a trusted user.

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.