A Ravens site page reflects the X-Forwarded-Host header into a script src, and the cache key is the path only, not the header. One request carrying a malicious header poisons the stored copy that every later visitor receives.
A page with a field for X-Forwarded-Host, a button to send the poisoning request, and a button to make the victim visit with no header. The cache stores one copy keyed by path.
You poisoned the cache and the victim received your script.
Why the solution worked
The cache stored a response built from a header not included in the key, poisoning it for everyone. The fix is not reflecting untrusted headers, or including them in the cache key, or not caching responses that depend on them.
The root cause
An unkeyed input is reflected in the response. The root is a mismatch between what affects the response and what keys the cache.
How the code is fixed
Do not reflect untrusted headers into cached responses, and include everything that affects the response in the cache key.
Vulnerable code
const host = req.headers['x-forwarded-host'] || req.hostname; // unkeyed, reflected
res.send(`<script src="https://${host}/app.js"></script>`);
Safe code
// Build from a fixed host, and never reflect an unkeyed header into a cached response.
res.send(`<script src="https://${config.assetHost}/app.js"></script>`);
Impact in the real world
Cache poisoning injects a malicious script or content for all visitors of a page and has hit major sites.
How defenders detect it
Defenders audit what enters the cache key, stop reflecting untrusted headers, and alert on unkeyed header variance.
Your workspace now has a Server logs tab: your own attack, as the defender saw it, with the alerting lines marked.
Solved with the walkthrough. Put it aside and solve again to earn the feather.