GitHub security bug bounty hunting
An S3 bucket was misconfigured to allow public listing and download, exposing internal infrastructure graphs. A CDN provider's domain validation flaw allowed claiming any subdomain of github.io and githubusercontent.com, enabling man-in-the-middle attacks.
medium.com
Published on medium.com
Last month, I went hunting for security bugs in GitHub, a popular platform for sharing and collaborating on code. After spending many hours mapping out GitHub’s infrastructure, and testing for weaknesses without any significant results or leads, I shifted my focus to the service providers.
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
Root cause
The S3 bucket had an overly permissive access control list, and the CDN provider's domain validation failed to check if a parent domain was already in use when the parent was on the Public Suffix List.
Impact
An attacker could download internal infrastructure graphs from the S3 bucket, and could transparently man-in-the-middle any existing subdomain of github.io and githubusercontent.com, serving malicious content.
What the attacker needed
Publicly known bucket naming patterns; Ability to query DNS; Account with the CDN provider
The fix
The S3 bucket configuration was updated, and the CDN provider removed the GitHub domain names from their version of the Public Suffix List.
How it was found
- Compile a list of GitHub's S3 buckets from public sources.
- Enumerate bucket names using a word list and suffix list, checking DNS responses.
- Run a script to test which buckets allow anonymous or authenticated access.
- Identify a bucket that allows listing and downloading objects.
- For the domain takeover, assign a subdomain like foo.github.io to an account with the CDN provider.
- Point the subdomain to any backend and use GitHub's TLS certificate to intercept traffic.
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.
Two separate issues were found. First, a cloud storage bucket was left open, so anyone could browse and download files that should have been private. Second, a flaw in a domain-checking system let an attacker take control of existing GitHub subdomains, which could be used to intercept traffic.
What is Subdomain takeover?
A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.