Skip to content
Misconfiguration Write-up Intermediate

Title My Love Life Failed But Host Header Injection Didnt How Ai Helped Me Pwn Server

The API trusted the Host and X-Forwarded-Host headers, redirecting to an attacker-controlled domain and leaking internal API keys and admin credentials. An attacker could obtain sensitive secrets by sending crafted headers.

iski Follow

Published on infosecwriteups.com

Here’s the wild story of how I turned a boring endpoint into a full-blown server credential leak — thanks to a humble Host Header Injection and a sprinkle of AI magic.

Iski, on infosecwriteups.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 server used the Host header to build redirects and fetch secrets without validating it.

Impact

The server leaked internal API keys, JWT secrets, admin credentials, and SMTP/Slack tokens, potentially leading to full compromise.

What the attacker needed

Ability to send custom headers; no authentication required

The fix

The server should validate the Host header against an allowlist and not use it to construct redirects or fetch secrets.

How it was found

  1. Send a request to the token endpoint with a modified Host header pointing to an attacker-controlled domain.
  2. Observe a 302 redirect to that domain.
  3. Add an X-Forwarded-Host header with the attacker domain and capture the response in a collaborator.
  4. Receive internal API keys and admin tokens in the response.
  5. Request the userinfo endpoint with the malicious Host header to dump sensitive data.

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 uses the Host header to know which site the browser wants. If it blindly trusts this header, an attacker can make it redirect to a malicious site or leak secrets. Here, the server sent back internal keys and passwords when the header was changed.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by iski

View all

186 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.