Anyone can Access Deleted and Private Repository Data on GitHub
GitHub's repository network design allows commit data from deleted forks, deleted repositories, and private forks to remain accessible via any fork in the network if the commit hash is known. An attacker could retrieve sensitive data such as API keys or private code by guessing short commit hashes or obtaining them from public sources.
You can access data from deleted forks, deleted repositories and even private repositories on GitHub. And it is available forever.
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 GitHub's repository network architecture stores all commits from all forks in a shared object store, and deletion only removes references rather than the underlying commit data, which remains accessible by direct commit hash.
Impact
Any code committed to a public repository may be accessible forever as long as at least one fork exists, and private fork commits made before open-sourcing may be exposed; however, commits made to a private fork after the upstream becomes public are not viewable.
What the attacker needed
At least one fork exists; commit hash known or guessable
The fix
GitHub should be fixed by changing the repository network design so that deleted or private commit data is not accessible via forks, but the text states GitHub considers this intentional and documented.
How it was found
- Fork a public repository.
- Commit code containing sensitive data to your fork.
- Delete your fork.
- Access the deleted commit via the original repository using the commit hash.
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 you fork a repository on GitHub, you make a copy that shares history with the original. The report shows that even after you delete your fork or the original repository, the commits you made can still be reached through any remaining fork if someone knows the commit's identifier. This means secrets like API keys that were committed and then deleted may still be exposed.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.