Skip to content

Independent cybersecurity briefing

Latest

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

Bug Bounty Write Ups

Five Low Bugs, One GitHub Private Repo Takeover

A 2014 disclosure shows why OAuth redirect checks, token storage and scope approval must be designed together

Adam Hale, ZeroDay Times editorBy Adam Hale2 min read

Still life for “Five Low Bugs, One GitHub Private Repo Takeover”: a magnifier and a sealed envelope, walnut desk, GitHub mark, signal CASE. [ BUG BOUNTY ] badge.

AI-generated illustration

AI disclosure: This article was drafted with AI assistance as an analytical case study of a public disclosure. It is not my own discovery.

Individually minor OAuth weaknesses can add up to a serious exposure. Egor Homakov reported that five low-severity issues in GitHub’s OAuth handling, combined, could have exposed users’ private repositories. GitHub fixed them and paid $4,000, per the researcher.

Disclaimer: * Educational and defensive use only. Fixed in 2014. This article intentionally omits reproduction details.*

Vulnerability Overview

  • Type: Combined OAuth weaknesses leading to excessive token exposure
  • CWE (analytical mapping, not from the source): CWE-601, CWE-863, CWE-522
  • CVE: Not stated in the disclosure
  • Severity/CVSS: Researcher called it high severity; no CVSS reported. Bounty: $4,000 (source-reported)

Root Cause Categories (high level)

The disclosure covered weaknesses in four areas: — Redirect URI validation that was looser than an exact match — Authorization codes not strictly bound to the redirect they were issued for — A provider token stored where the browser could read it — A trusted first-party client receiving broad scopes without explicit consent

None was critical alone. The risk came from how they compounded.

Impact

The researcher reported that the combination could have granted read/write access to private repositories. Private code often holds secrets and build configuration, so write access extends to supply-chain risk.

Remediation & Defense-in-Depth (my own analysis)

1. Exact registered redirect matching. Compare the full URI against registered values. No prefix, path or wildcard matching, and no normalization that changes meaning.

2. Bind each code to client and redirect. Store both when issuing; require both to match at exchange (RFC 6749 §4.1.3).

# Pseudocode: provider-side issue and exchange
def authorize(client, redirect_uri, scopes, user):
    if redirect_uri not in client.registered_redirects:  # exact
        raise InvalidRedirect()
    granted = scopes & client.allowed_scopes              # explicit
    if granted - user.consented_scopes(client):
        return show_consent(client, granted)
    return issue_code(client.id, redirect_uri, granted, ttl_short=True)
def exchange(code, client_id, redirect_uri, verifier):
    c = codes.consume(code)                    # single use
    if (c is None or c.client_id != client_id
            or c.redirect_uri != redirect_uri
            or not pkce_ok(c.challenge, verifier)):
        raise InvalidGrant()
    return mint_token(c)

3. Keep tokens server-side. The browser should hold only an opaque session ID, never a provider token, even encoded.

4. Explicit scopes, even for first-party clients. Pre-approval should cover only registered scopes; anything broader needs consent.

5. Understand PKCE’s limits. PKCE reduces the value of an intercepted code, but it doesn’t fix loose redirect matching, leaked tokens or excessive scopes.

6. Separate origins and limit referrers. Host user content away from callback origins, set Referrer-Policy: no-referrer on callbacks, and strip codes from URLs after use.

Key Takeaways

  • Triage low findings for how they combine, not just one by one.
  • Exact redirect matching and code binding reduce interception risk. Server-side tokens and explicit scopes are still required.
  • First-party trust should never mean silent privilege.

Credit & Sources

Research by Egor Homakov (@homakov): How I hacked Github again (February 2014). Facts come from that post; analysis, code and fixes are original suggestions.

First published by Adam Hale on Medium.

Sources

Share

Corrections and tips:[email protected]