The $100,000 GitHub Bug That Started With a Git Push -
GitHub's internal git push pipeline allowed user-supplied push options to be embedded into the X-stat header without escaping semicolons, enabling injection of security-critical fields. An attacker could disable sandboxing, redirect hook directories, and execute arbitrary commands, achieving remote code execution on GitHub Enterprise Server and potentially cross-tenant access on GitHub.com.
Published on medium.com
GitHub recently paid $100,000 bug bounty for discovering a critical vulnerability in GitHub’s internal Git infrastructure. The reason lies in a concept that quietly protects almost every modern web service — Trust Boundaries.
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
User-controlled push options were embedded into the semicolon-delimited X-stat header without escaping semicolons, and downstream services trusted all fields in that header.
Impact
An attacker could execute arbitrary commands on GitHub Enterprise Server and potentially access repositories of other users and organizations on GitHub.com, though the text notes that on GitHub.com the exploit required enabling operator mode and the researchers only demonstrated access to test nodes.
What the attacker needed
A GitHub account; ability to push to a repository; knowledge of internal X-stat fields
The fix
GitHub fixed the vulnerability by properly escaping semicolons in push options and validating internal headers.
How it was found
- Send a git push with a push option containing a semicolon and a fake X-stat field.
- The front proxy babeld inserts the push option into the X-stat header without escaping.
- Downstream services parse the header and treat the injected field as legitimate.
- Inject rails_env to a non-production value to escape the sandbox.
- Inject custom_hook_dir to point to an attacker-controlled directory.
- Inject repo_pre_receive_hooks to execute an arbitrary program via path traversal.
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 push code to GitHub, your request passes through several internal services. One service adds a header with information like your username and permissions, and later services trust that header completely. The bug was that user-supplied push options were inserted into this header without cleaning up semicolons, so an attacker could add fake fields to trick later services into running commands.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.