GitHub Cache Poisoning: The $7,500 Header That Broke Repos
A malformed request header could make GitHub's cache serve a broken repository page to logged-out visitors.
Published on masimshahzad.medium.com
One request with a bad header, and a public repository stops loading for everyone who is not signed in. That was a GitHub cache poisoning bug Iustin Ladunca (Youstin) reported, earning $7,500, his highest cache poisoning bounty.
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.
Context
GitHub serves public repository pages to two very different audiences: signed-in users, whose authentication cookie put them in their own cache copy, and anonymous visitors, who all share one copy. That shared copy is what a CDN or edge cache is for, and it is also what makes a cache-poisoned denial of service (CP-DoS) possible. If an attacker can make the cache store a broken response under the key that anonymous visitors use, every logged-out reader of that repository gets the broken page until the entry expires.
This case study covers a GitHub cache poisoning bug reported by Iustin Ladunca (Youstin), which earned $7,500, his highest cache poisoning bounty. It was one of more than 70 cache poisoning reports he made across bug bounty programs. The researcher states the issues are fixed, and the header values and reproduction steps are intentionally omitted from the public write-up.

The vulnerability class is a cache-poisoned denial of service via an unkeyed request header. The analytical mapping given is CWE-349 (Acceptance of Extraneous Untrusted Data With Trusted Data) and CWE-20 (Improper Input Validation). No CVE was assigned.
Setup
The researcher built a scanner that tried many request headers against bug bounty targets to spot unkeyed inputs: headers that change the response but are not part of the cache key. The tooling is described only at that level; no versions, endpoints or configuration are given.
Finding it
GitHub repository pages kept getting flagged by the scanner. An invalid value in the Content-Type request header produced a different, broken response, and the cache stored that response under the normal key. In other words, Content-Type was an unkeyed input on a repository page request.
At first the bug would not reproduce in a browser. The reason is the cache key: GitHub included the authentication cookie in its cache key, so each signed-in user effectively had their own copy of the page. A researcher testing while logged in would never see the poisoned entry that anonymous visitors were served. Logged-out visitors, however, all shared one copy. Poison that copy and the repository is down for every anonymous reader until the entry expires.
Exploitation
The public write-up does not include the exact header value or the reproduction steps; the researcher withheld them deliberately. The sequence, as described, is:
Step 1: Identify the unkeyed header
Send a request for a public repository page with an invalid value in the Content-Type request header. A positive result is a response that differs from the normal page, showing that the origin reacts to a header the cache does not key on.
Step 2: Confirm the cache stores it
Repeat the request and check whether the broken response is served from cache under the normal key, that is, whether a subsequent request without the malformed header still receives the broken page. The report states that the cache stored the broken response under the normal key.
Step 3: Test as an anonymous visitor
Because the authentication cookie is part of the cache key, the poisoned entry is only visible to logged-out users. Testing while signed in will not reproduce it; the poisoned copy is the one shared by all anonymous visitors.
Step 4: Observe the effect
Once the anonymous copy is poisoned, the repository page is broken for every logged-out reader until the cache entry expires. Anonymous traffic is a large share of GitHub: people reading documentation, pulling READMEs, or following links from search and package registries.
Root cause
An invalid value in the Content-Type request header produced a broken response, but the cache key did not include that header. Any input that changes the response but is left out of the key is an unkeyed input, and a classic poisoning lever. GitHub included the authentication cookie in its cache key, so each signed-in user effectively had their own copy, but anonymous visitors all shared one copy. That is why the bug looked harmless during signed-in testing while breaking the page for every anonymous visitor.
Impact
An attacker could take a public repository offline for anonymous visitors until the cache entry expires. That affects open source projects and companies that rely on GitHub as their public face, and anyone arriving from search engines or package registries. The report describes the effect as a denial of service for logged-out readers; it does not describe data exposure or any effect on signed-in users.
Across the research, Ladunca said roughly 80% of his findings were CP-DoS through unkeyed headers, and coverage put his total rewards at around $40,000 for the 70-plus bugs.
Fix
The researcher states the issues are fixed. The recommendations given are:
- Never share errors. Disabling caching for error status codes would stop a large share of CP-DoS.
- Drop what you do not key. If a header can change the response, key on it or strip it at the edge.
- Treat the cache key as a security boundary. Review it like an access rule.
The write-up includes this illustrative pseudocode for an edge cache that only stores what it can safely share:
# Pseudocode: an edge cache that only stores what it can safely shareKEY_FIELDS = ("host", "path", "query", "accept-encoding")ORIGIN_NEEDS = {"accept", "accept-encoding", "cookie", "user-agent"}def handle(request): if request.method in ("GET", "HEAD"): request = request.keep_headers(ORIGIN_NEEDS) # Content-Type on a GET never reaches origin key = cache_key(request, KEY_FIELDS, per_user=request.has_session()) cached = cache.get(key) if cached: return cached resp = origin.fetch(request) if shareable(request, resp): cache.put(key, resp, ttl=resp.max_age) return respdef shareable(request, resp): if request.method not in ("GET", "HEAD") or resp.status >= 400: return False # errors are served once, never stored if {"no-store", "private"} & resp.cache_directives: return False return set(resp.vary) <= set(KEY_FIELDS) # never cache on unkeyed variation# Test: anonymous GET with a garbage header, then a clean GET -> clean GET gets the real page
Variants to test
- A positive result is a response that differs from the normal page and is then served to a clean request.
- A positive result is an error page or broken render that the cache stores.
- A positive result is an error page served to subsequent clean requests.
- A positive result is a poisoned entry visible only to anonymous visitors, which is the condition that made this bug easy to miss.
- A positive result is any input that changes the response without changing the key.
What happened, in plain words
Imagine a busy coffee shop with one big pot of coffee that everyone gets served from. The barista makes one pot, and every customer who orders "the usual" gets a cup from that same pot. If someone slips something bad into the pot, every customer after them gets a bad cup, even though none of them did anything wrong.
A website cache works the same way. Big sites like GitHub get enormous numbers of visitors, so instead of building every page from scratch for every single person, they keep a saved copy and hand that copy out. That saved copy is called a cache. It makes the site fast and cheap to run.
The problem in this report is that someone found a way to make GitHub save a broken copy of a public repository page, and then hand that broken copy to every visitor who was not signed in. The researcher who found it, Iustin Ladunca (also known as Youstin), reported it to GitHub and was paid $7,500, his highest cache poisoning bounty. It was one of more than 70 cache poisoning reports he made across bug bounty programs. The researcher states the issues are fixed, and the exact header values and reproduction steps were deliberately left out of the public write-up.

This is a case study of a public disclosure, written for learning. It is not the author's own discovery.
The basics you need first
Before the details make sense, here are the few ideas the whole story rests on.
A request and a response. When you type an address into your browser and press Enter, your browser sends a message to a server asking for a page. That message is a request. The server sends back the page, which is the response. Every request and response carries small labelled pieces of information alongside the actual content, called headers. A header is just a name and a value, like Content-Type: text/html, which tells the other side what kind of content this is.
GET. A GET request is the ordinary kind: "please give me this page." It is what your browser sends when you open a link. The other common method is POST, used when you submit a form, but this story is about GET.
A cache. A cache is a saved copy kept so it can be reused. A shared cache sits between visitors and the real server (often called the origin, because it is where the content really comes from). When the first visitor asks for a page, the cache fetches it from the origin and keeps a copy. The next visitor asking for the same thing gets the saved copy straight away. This is what a CDN (content delivery network) does: a network of caches spread around the world so pages load quickly wherever you are.
The cache key. How does the cache know two requests want "the same thing"? It builds a short fingerprint from parts of the request, usually the host (which site), the path (which page), the query string (the ?something=value part of a URL) and a few chosen headers. That fingerprint is the cache key. If two requests produce the same key, the second one gets the stored copy. If they produce different keys, each gets its own copy.
Unkeyed input. Here is the heart of the bug. Suppose a header changes what the server sends back, but that header is not part of the cache key. The cache cannot tell the two responses apart, so it stores whichever one it saw first and serves it to everyone with the same key. An input that changes the response but is not in the key is called an unkeyed input, and it is the classic lever for cache poisoning.
Cache poisoning. Poisoning means putting something bad into the cache on purpose. You send a request crafted so the response is broken or malicious, the cache stores it, and then ordinary visitors get the bad copy. Nobody has to click anything; the damage is done by the cache itself.
Denial of service (DoS). A denial of service means making something unavailable to the people who need it. A cache-poisoned denial of service, shortened to CP-DoS, is a DoS achieved by poisoning a cache. The site is not hacked in the sense of data being stolen; it simply stops working for its visitors.
Cookies and sessions. When you sign in to a website, the site gives your browser a small piece of data called a cookie. Your browser sends it back with every request so the site knows who you are. That is how you stay signed in as you move from page to page. A signed-in visitor is sometimes called an authenticated visitor; someone who is not signed in is anonymous.
CWE and CVE. CWE is a catalogue of common weakness types, a way of labelling what kind of mistake a bug is. CVE is a catalogue of specific publicly tracked vulnerabilities, each with an ID number. This report maps the bug to two CWE entries and notes that no CVE was assigned.
The vulnerability at a glance
- Type: cache-poisoned denial of service (CP-DoS) via an unkeyed request header
- CWE (analytical mapping): CWE-349 (Acceptance of Extraneous Untrusted Data With Trusted Data) and CWE-20 (Improper Input Validation)
- CVE: none
- Bounty: $7,500 from GitHub
In plain words: the server paid attention to a header that the cache ignored when deciding what counted as "the same page", and that gap let a broken page be stored and shared.
How the GitHub cache poisoning worked
GitHub serves public repository pages to two very different audiences. Signed-in users had their own cache copy, because the authentication cookie was part of the cache key. Anonymous visitors all share one copy, because there is nothing to personalise. That shared copy is exactly what a cache is for, and it is also what makes this kind of attack possible. If an attacker can make the cache store a broken response under the key that anonymous visitors use, every logged-out reader of that repository gets the broken page until the stored entry expires.
Setting up the search
The researcher built a scanner: a program that automatically sends many requests and looks at the replies. It tried many different request headers against bug bounty targets, looking for unkeyed inputs, meaning headers that change the response but are not part of the cache key. The write-up describes the tooling only at that level; it gives no versions, endpoints or configuration.
In coffee-shop terms: the barista changes the recipe depending on something the person filling the pot does not check.
Finding it
GitHub repository pages kept getting flagged by the scanner. An invalid value in the Content-Type request header produced a different, broken response, and the cache stored that response under the normal key. In other words, Content-Type was an unkeyed input on a repository page request.
Content-Type normally describes what kind of content is being sent, for example whether a body is HTML or JSON. Sending an invalid value in it is like writing nonsense on a form field that is supposed to say "text" or "picture". Here, the origin reacted to it and produced a broken page, while the cache did not include the header in its key, so it could not tell the broken page from the good one.
Why it did not show up at first
At first the bug would not reproduce in a browser. The reason is the cache key. GitHub included the authentication cookie in its cache key, so each signed-in user effectively had their own copy of the page. A researcher testing while logged in would never see the poisoned entry that anonymous visitors were being served. Logged-out visitors, however, all shared one copy. Poison that copy and the repository is down for every anonymous reader until the entry expires.
This is the single most important lesson in the case: the bug looked harmless during signed-in testing while breaking the page for every anonymous visitor.
Exploitation, step by step
The public write-up does not include the exact header value or the reproduction steps; the researcher withheld them deliberately. What follows is the sequence as described.
Step 1: Identify the unkeyed header
Send a request for a public repository page with an invalid value in the Content-Type request header. A positive result is a response that differs from the normal page, showing that the origin reacts to a header the cache does not key on.
Why this step: you first need to find an input the server cares about. If changing a header changes the page, that header is a candidate. If the page comes back identical, move on.
Step 2: Confirm the cache stores it
Repeat the request and check whether the broken response is served from cache under the normal key. In practice that means asking: does a later request without the malformed header still receive the broken page? The report states that the cache stored the broken response under the normal key.
Why this step: a server reacting oddly to one request is not a cache bug. The bug only exists if the bad response is saved and then handed to someone who never sent the bad header.
Step 3: Test as an anonymous visitor
Because the authentication cookie is part of the cache key, the poisoned entry is only visible to logged-out users. Testing while signed in will not reproduce it; the poisoned copy is the one shared by all anonymous visitors.
Why this step: this is where most testers would give up. If you are signed in, your requests carry your cookie, your cookie is part of the key, and you get your own private copy. You have to sign out, or use a fresh browser profile with no cookie, to see what a stranger sees.
Step 4: Observe the effect
Once the anonymous copy is poisoned, the repository page is broken for every logged-out reader until the cache entry expires. Anonymous traffic is a large share of GitHub: people reading documentation, pulling READMEs, or following links from search engines and package registries.
Why this matters: the people affected are not a niche. They are everyone who clicks a GitHub link from a search result or a package page and is not signed in.
Root cause
An invalid value in the Content-Type request header produced a broken response, but the cache key did not include that header. Any input that changes the response but is left out of the key is an unkeyed input, and a classic poisoning lever. GitHub included the authentication cookie in its cache key, so each signed-in user effectively had their own copy, but anonymous visitors all shared one copy. That is why the bug looked harmless during signed-in testing while breaking the page for every anonymous visitor.
Put simply: the cache and the origin disagreed about what made two requests "the same". The origin said "this one is different, here is a broken page". The cache said "same key, I will keep the first copy I got".
Impact
An attacker could take a public repository offline for anonymous visitors until the cache entry expires. That affects open source projects and companies that rely on GitHub as their public face, and anyone arriving from search engines or package registries. The report describes the effect as a denial of service for logged-out readers; it does not describe data exposure or any effect on signed-in users.
Across the research, Ladunca said roughly 80% of his findings were CP-DoS through unkeyed headers, and coverage put his total rewards at around $40,000 for the 70-plus bugs.
The fix
The researcher states the issues are fixed. The recommendations given are:
- Never share errors. Disabling caching for error status codes would stop a large share of CP-DoS. An error page is rarely useful to the next visitor, so there is no reason to store it.
- Drop what you do not key. If a header can change the response, either include it in the cache key or strip it at the edge before the origin ever sees it.
- Treat the cache key as a security boundary. Review it like an access rule, because it decides who shares a copy with whom.
The write-up includes this illustrative pseudocode for an edge cache that only stores what it can safely share:
# Pseudocode: an edge cache that only stores what it can safely shareKEY_FIELDS = ("host", "path", "query", "accept-encoding")ORIGIN_NEEDS = {"accept", "accept-encoding", "cookie", "user-agent"}def handle(request): if request.method in ("GET", "HEAD"): request = request.keep_headers(ORIGIN_NEEDS) # Content-Type on a GET never reaches origin key = cache_key(request, KEY_FIELDS, per_user=request.has_session()) cached = cache.get(key) if cached: return cached resp = origin.fetch(request) if shareable(request, resp): cache.put(key, resp, ttl=resp.max_age) return respdef shareable(request, resp): if request.method not in ("GET", "HEAD") or resp.status >= 400: return False # errors are served once, never stored if {"no-store", "private"} & resp.cache_directives: return False return set(resp.vary) <= set(KEY_FIELDS) # never cache on unkeyed variation# Test: anonymous GET with a garbage header, then a clean GET -> clean GET gets the real page
Line by line, in plain words:
KEY_FIELDS = ("host", "path", "query", "accept-encoding")lists the parts of a request that make up the cache key. Two requests that match on all of these are considered the same page.ORIGIN_NEEDS = {"accept", "accept-encoding", "cookie", "user-agent"}lists the headers the real server is allowed to see. Everything else is dropped before the request goes any further.def handle(request):starts the function that deals with each incoming request.if request.method in ("GET", "HEAD"):checks whether this is a page request. HEAD is like GET but asks only for the headers, not the body.request = request.keep_headers(ORIGIN_NEEDS)throws away every header not on the allowed list. The comment notes thatContent-Typeon a GET never reaches the origin, which is exactly the header that caused this bug.key = cache_key(request, KEY_FIELDS, per_user=request.has_session())builds the fingerprint from the key fields, and gives signed-in users their own separate key so they never share a copy with strangers.cached = cache.get(key)looks for an existing saved copy.if cached: return cachedhands back the saved copy if there is one.resp = origin.fetch(request)otherwise asks the real server for the page.if shareable(request, resp): cache.put(key, resp, ttl=resp.max_age)stores the response only if it is safe to share, and only for as long as the response says it may be kept.return respsends the response to the visitor.def shareable(request, resp):starts the function that decides whether a response may be stored.if request.method not in ("GET", "HEAD") or resp.status >= 400: return Falserefuses to store anything that is not a page request, and refuses to store any error response. The comment says errors are served once, never stored.if {"no-store", "private"} & resp.cache_directives: return Falserespects the server's own instructions not to store the response or to keep it private.return set(resp.vary) <= set(KEY_FIELDS)allows storing only when everything the response says it varies on is already part of the key. The comment calls this never caching on unkeyed variation.- The final comment describes a test: send an anonymous GET with a garbage header, then a clean GET, and check that the clean GET gets the real page.
The key ideas in it: strip headers the origin does not need on GET and HEAD, key per user when a session exists, never store error responses, respect no-store and private, and refuse to cache when the response varies on anything outside the key fields.
Variants to test
If you ever test a site of your own, or take part in a bug bounty program with permission, these are the variations worth trying. Each one follows the same logic: find an input the server reacts to that the cache ignores.
- A positive result is a response that differs from the normal page and is then served to a clean request.
- A positive result is an error page or broken render that the cache stores.
- A positive result is an error page served to subsequent clean requests.
- A positive result is a poisoned entry visible only to anonymous visitors, which is the condition that made this bug easy to miss.
- A positive result is any input that changes the response without changing the key.
Key takeaways
- Every input that can change a response belongs in the cache key or should be stripped before the origin sees it.
- Bugs that skip logged-in users can look harmless in testing while breaking things for every anonymous visitor.
- Cacheable error pages turn small parser quirks into outages.
Credit and sources
Reported by Iustin Ladunca (Youstin). Primary source: Cache Poisoning at Scale, 23 December 2021. Corroboration: Dark Reading, 6 January 2022. Facts come from those sources; the analysis and code are original.
Glossary
- Anonymous visitor: someone using a site without being signed in, so the site has no cookie identifying them.
- Authenticated visitor: someone who is signed in, identified by a cookie or session.
- Bug bounty program: a scheme where a company pays researchers for reporting security bugs responsibly.
- Cache: a saved copy of a response kept so it can be reused instead of rebuilt.
- Cache key: the fingerprint a cache builds from parts of a request to decide which stored copy to serve.
- Cache poisoning: tricking a cache into storing a bad response and serving it to other people.
- CDN (content delivery network): a network of caches placed around the world to serve content quickly.
- Cookie: a small piece of data a site stores in your browser and your browser sends back with each request, used to keep you signed in.
- CP-DoS (cache-poisoned denial of service): making a site unavailable by poisoning its cache.
- CVE: a public catalogue of specific tracked vulnerabilities, each with an ID number.
- CWE: a catalogue of common weakness types, used to label what kind of mistake a bug is.
- Denial of service (DoS): making a service unavailable to the people who need it.
- Edge: the outer layer of a network, close to visitors, where caches usually sit.
- GET: the ordinary request a browser sends to fetch a page.
- HEAD: like GET, but asks only for the response headers, not the body.
- Header: a small labelled piece of information sent alongside a request or response, such as
Content-Type. - Origin: the real server that holds the content, behind any caches.
- Pseudocode: code written to explain an idea rather than to run as-is.
- Query string: the
?something=valuepart of a URL. - Request: the message a browser sends to a server asking for something.
- Response: the message a server sends back.
- Scanner: a program that automatically sends many requests and inspects the replies.
- Session: the state of being signed in across multiple requests, usually tracked by a cookie.
- Status code: a number in a response saying how it went, such as 200 for success or 404 for not found; 4xx and 5xx are error ranges.
- TTL (time to live): how long a stored copy may be kept before it must be fetched again.
- Unkeyed input: something in a request that changes the response but is not part of the cache key.
no-storeandprivate: response instructions telling caches not to store the response, or to keep it for one user only.Vary: a response header listing which request headers the response depends on.