How a GitHub Quirk Helped Me Earn $40K+ in Bug Bounties
GitHub keeps redirecting links that use a renamed user's old username, but only while that old username is unclaimed. If an attacker registers the abandoned username and recreates the referenced repository, links in READMEs, install commands and CI pipelines point at attacker-controlled content.
medium.com
Published on medium.com
GitHub automatically redirects renamed usernames — until someone claims the old one. I built a scanner to find and hijack those links.
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
Likely the redirect from an old username to a new one is dropped as soon as the old username is registered by anyone, so stale links silently resolve to the new owner's content.
Impact
Links in documentation, install commands and CI pipelines could resolve to attacker-controlled repositories, opening the door to malicious code injection, credential harvesting and supply chain compromise.
What the attacker needed
Old username is unclaimed; victim links still use the old username; attacker registers the username
How it was found
- Collect GitHub links from cloned repositories.
- Reduce each link to just the username part of the URL.
- Check whether that profile returns a 404.
- If it does, register the username.
- Recreate the repositories that were referenced under that name.
- Add a README stating the repo was taken over for responsible disclosure.
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.
When someone renames their GitHub account, GitHub keeps old links working by quietly forwarding them to the new name. That forwarding only works while nobody else takes the old name. If the old name is free and someone registers it, the forwarding stops and the old links now lead to whatever that person puts there.
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.