Rogue collaborators and ambiguous branch names in GitHub
GitHub Enterprise Server compared branch names incorrectly, so a diff could show the wrong changes and hide malicious commits. An attacker with write access who guessed a future branch name could smuggle commits past reviewers.
Originally disclosed on HackerOne
- Triaged in 14 days
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 11 months
Summary by the program
An incorrect comparison vulnerability was identified in GitHub Enterprise Server that allowed commit smuggling by displaying an incorrect diff. To do so, an attacker would need write access to the repository and be able to correctly guess the target branch before it’s created by the code maintainer. This vulnerability affected all versions of GitHub Enterprise Server prior to 3.9 and was fixed in versions 3.4.18, 3.5.15, 3.6.11, 3.7.8, and 3.8.1. This vulnerability was reported via the GitHub Bug Bounty program.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the branch-name comparison was not exact, so a branch could be matched to a different, similarly named branch and the diff was computed against the wrong target.
Impact
An attacker with write access could hide malicious commits from reviewers, but only if they correctly guessed the target branch name before the maintainer created it.
What the attacker needed
Write access to the repository; guess target branch name before creation
The fix
It was fixed in versions 3.4.18, 3.5.15, 3.6.11, 3.7.8 and 3.8.1.
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 report has not been written yet. The Original tab links to the source.
When you look at a pull request, the server compares two versions of the code and shows what changed. Here it matched branch names in a sloppy way, so it could compare against the wrong branch and show a harmless diff while the real code contained hidden changes. An attacker who can push code and guess the name of a branch that will be created later could sneak those changes in.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.