GitHub OAuth Bypass: The $25K HEAD Request
*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.*


AI-generated illustration
Teddy Katz found GitHub’s router treated HEAD like GET while its code treated it like POST, approving OAuth apps without a click. $25K
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.
You visit a web page, and a third-party app quietly gains access to your private GitHub repositories. No consent screen, no “Authorize” click. That was the GitHub OAuth bypass Teddy Katz reported in June 2019, caused by one rarely used HTTP method. GitHub patched it in about three hours and paid $25,000, at the time the largest bounty in its program.
Disclaimer: * Educational and defensive use only. This was fixed on github.com in June 2019 and in GitHub Enterprise Server 2.17.3 and related releases. No proof-of-concept is reproduced here.*
Vulnerability Overview
- Type: OAuth authorization bypass caused by HTTP method confusion, which also sidestepped CSRF protection
- CWE (analytical mapping): CWE-650 (Trusting HTTP Permission Methods on the Server Side), CWE-352 (Cross-Site Request Forgery)
- Severity: GitHub’s Enterprise Server 2.17.3 release notes list an “OAuth app authorization bypass” as CRITICAL. No CVE or CVSS score is cited in the sources
- Bounty: $25,000 via GitHub’s HackerOne program
How the GitHub OAuth Bypass Worked (high level)
Katz spent part of summer 2019 reading the Rails code of a GitHub Enterprise trial. He looked at the OAuth authorize URL, which does two jobs: a GET shows the consent page, and a POST from the “Authorize” button, carrying a CSRF token, grants the app access.
The router accepted both methods for that path. Inside, the code asked one question: “is this a GET?” If yes, show the page. Otherwise, grant access.
The catch is HEAD, the method meant for “GET, but headers only.” Rails routes HEAD requests to GET handlers, so the router let them through. But the code’s check still saw a request that was not a GET, so it took the grant branch. And because HEAD is supposed to be side-effect free, CSRF protection did not ask for a token.
The result: a malicious site could make a signed-in visitor’s browser approve an attacker’s OAuth app, which could then read or modify that user’s private data.
Business Impact
OAuth consent is the main barrier between a GitHub account and every third-party app. Bypassing it with one page visit would expose private source code, secrets in repositories and write access to projects that sit in other companies’ supply chains.
The response is the model part. GitHub confirmed the report eight minutes after submission, patched production about three hours later, then shipped Enterprise Server fixes and paid the bounty a week later.
Fixing GitHub OAuth Bypass-Style Method Confusion (my own analysis)
1. Branch on the safe case, not the unsafe one. Grant only on an explicit POST; never fall through to a state change from an “else”.
2. Treat HEAD as read-only everywhere. Framework conveniences that map HEAD to GET must never reach write paths.
3. Separate routes for reads and writes. One URL doing both jobs invites exactly this ambiguity.
# Pseudocode: state changes only on an explicit, CSRF-checked POST
def oauth_authorize(request, user):
method = request.method.upper()
if method in ("GET", "HEAD"):
return render_consent_page(request, user) # read-only, always safe
if method == "POST":
if not csrf_token_valid(request, user):
return forbidden("csrf")
if request.form.get("decision") != "approve":
return deny_and_redirect(request)
return grant_and_redirect(request, user)
return method_not_allowed() # unknown methods never grant
# Test: HEAD, OPTIONS, or POST without a valid token -> no grant is ever written
Key Takeaways
- “If not GET, then write” is a bug waiting for a third method.
- CSRF defenses that exempt safe methods assume your code honors those semantics; verify that it does.
- Fast triage and same-day payout turn a critical bug into a trust story.
Credit & Sources
Discovered and reported by Teddy Katz. Primary source: Bypassing GitHub’s OAuth flow, 5 November 2019. Corroboration: GitHub Enterprise Server 2.17.3 release notes (26 June 2019). Facts come from those sources; analysis and code are original.
Next breakdown: how expired startup domains turn “Sign in with Google” into account takeover. Follow @masimshahzad for daily bug bounty breakdowns.
First published by Adam Hale on Medium.
Sources
Share
Reactions
Comments
Your name and comment appear on this article for other readers.
Corrections and tips:[email protected]

