My secret to API privesc: Tapping compromised web servers
During a red team engagement, the author compromised a frontend Nginx server and used its mirroring feature to silently copy API traffic to an external listener. This captured credentials and headers for an internal token exchange service, allowing the red team to mint administrative tokens and gain access to every host on the cluster.
The spring rain was beating down with a weird cadence, like drummers were marching us into the weekend. Hey, it’s the Pacific Northwest.
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 Nginx mirror module was enabled without restricting outbound connections, and sensitive internal API traffic (including credentials) was routed through the frontend server.
Impact
The red team could forge administrative tokens and gain administrative access to every host on the cluster.
What the attacker needed
Foothold on Nginx server; external listener server; ability to modify Nginx config
How it was found
- Gain a foothold on a frontend Nginx server that routes API traffic.
- Set up an external listener to receive mirrored requests.
- Configure Nginx mirror directive to copy requests to the listener, with timeouts and headers.
- Deploy the configuration to production servers and let it run over the weekend.
- Collect gigabytes of mirrored traffic, including credentials and headers for an internal token exchange service.
- Use the captured credentials to mint administrative tokens and access all hosts on the cluster.
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 attacker had already broken into a web server that sits in front of the company's APIs. They turned on a built-in feature that copies incoming requests to another server they control, without slowing down the real service. Later, they found that the copied traffic included secret passwords and special headers that let them create admin tokens for the whole system.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.