Skip to content

Independent cybersecurity briefing

Latest

RSS
Breaches, bounties, zero-days, and AI.

Bug Bounty Write Ups

GitHub Cache Poisoning: The $7,500 Header That Broke Repos

*AI-assisted: drafted with AI help from public sources, then reviewed and edited. This is an analytical case study of a public disclosure, not my own discovery.*

Adam Hale, ZeroDay Times editorBy Adam Hale3 min read

Still life for “GitHub Cache Poisoning: The $7,500 Header That Broke Repos”: a magnifier and a sealed envelope, walnut desk, GitHub mark, signal CASE. [ BUG BOUNTY ] badge.

AI-generated illustration

One malformed header could make GitHub’s cache serve a broken page to every logged-out visitor of a repository. It paid $7,500

AI-assisted: drafted with AI help from public sources, then reviewed and edited. This is an analytical case study of a public disclosure, not my own discovery.

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. It was one of more than 70 cache poisoning reports he made across bug bounty programs.

Disclaimer: * Educational and defensive use only. The researcher states these issues are fixed. Header values and reproduction steps are intentionally omitted.*

Vulnerability Overview

  • 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), CWE-20 (Improper Input Validation)
  • CVE: None
  • Bounty: $7,500 from GitHub

How the GitHub Cache Poisoning Worked (high level)

A shared cache decides who gets the same stored copy using a cache key, usually built from host, path and a few chosen inputs. Anything that changes the response but is left out of the key is an “unkeyed input”, and a classic poisoning lever.

Ladunca built a scanner that tried many headers against bug bounty targets to spot unkeyed ones. GitHub repository pages kept getting flagged: an invalid value in the Content-Type request header produced a different, broken response, and the cache stored it under the normal key.

At first it would not reproduce in a browser. GitHub included the authentication cookie in its cache key, so each signed-in user effectively had their own copy. Logged-out visitors, however, all shared one copy. Poison that copy and the repository is down for every anonymous reader until the entry expires.

Business Impact

Anonymous traffic is a lot of GitHub: people reading documentation, pulling READMEs, or following links from search and package registries. Taking a repository offline for them hits open source projects and companies that rely on GitHub as their public face.

Across the research, Ladunca said roughly 80% of his findings were CP-DoS through unkeyed headers. Coverage put his total rewards at around $40,000 for the 70-plus bugs.

Fixing GitHub-Style Cache Poisoning (my own analysis)

1. Never share errors. Ladunca’s own recommendation: disabling caching for error status codes would stop a large share of CP-DoS.

2. Drop what you don’t key. If a header can change the response, key on it or strip it at the edge.

3. Treat the cache key as a security boundary. Review it like an access rule.

# Pseudocode: an edge cache that only stores what it can safely share
KEY_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 resp
def 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

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 & 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; analysis and code are original.

Next breakdown: another real bug bounty case. Follow @masimshahzad for daily bug bounty breakdowns.

First published by Adam Hale on Medium.

Sources

Share

Corrections and tips:[email protected]