Skip to content
Cache bugs Write-up Intermediate

CPDoS via Content Negotiation Mechanism

The application varies its response format based on the Accept header, but the cache does not include that header in its cache key. An attacker can request a page with a JSON Accept header, causing the JSON response to be cached and served to normal visitors, breaking the page.

medium.com

Published on medium.com

For those who don’t know me, I do a lot of research on cache poisoning, and I’ve developed the HExHTTP script, among other things.

c0dejump, 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

Impact

Visitors may receive a JSON response instead of the expected HTML page, causing broken rendering, frontend crashes, or blank pages; if the cache has a long time-to-live, every user could be affected.

What the attacker needed

Cache does not vary on Accept header; attacker can send requests to the target

The fix

The cache key should include relevant headers such as Accept, and responses should include a Vary: Accept header; alternatively, avoid serving multiple formats from the same endpoint.

How it was found

  1. Send a request to a page with an Accept header set to application/json.
  2. Observe that the server returns a JSON response and that this response is cached.
  3. Send a normal request to the same page with an Accept header for HTML.
  4. Observe that the cache serves the previously cached JSON response instead of HTML.

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.

Websites often send different versions of a page depending on what the browser says it can accept. A cache is a storage layer that keeps a copy of a page to serve it faster to everyone. Here, the cache stored the wrong version and showed it to people who expected a normal web page, so the page appeared broken.

What is Cache bugs?

A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.

Similar reports

View all

Same bug class and techniques, clearest first.

Web cache poisoning and deception

The lesson behind this report.

A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.