The Curious Case of GitHub Commit Spoofing: A Lighthearted Exploration
Git commits on GitHub can be made to appear as if authored by another user by setting the local Git user.name and user.email to that person's details. An attacker could use this to impersonate a maintainer and potentially get malicious changes merged.
Published on infosecwriteups.com
Picture this: you’re sipping your coffee, casually committing your latest code changes to GitHub, when suddenly you realize your commit is credited to Linus Torvalds. Sounds like a coder’s dream, right?
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
Git commit author metadata is not authenticated by GitHub, so it can be set arbitrarily by the committer.
Impact
An attacker could impersonate a trusted maintainer to introduce harmful code or mislead contributors, though GitHub states this does not grant unauthorised access or privileges.
What the attacker needed
Git CLI installed; Access to a repository to push to; Knowledge of target user's name and email
The fix
GitHub should encourage or enforce commit signature verification and vigilant mode to make impersonation detectable.
How it was found
- Install Git CLI and clone the target repository.
- Find a target commit and copy its hash.
- View the commit metadata to get the username and email.
- Configure Git with the target user's name and email.
- Make changes, commit, and push to the target branch.
- Check GitHub to see the commit displayed as the target user.
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 make a Git commit, your name and email are stored in the commit details. GitHub displays these details as the author, without checking if you really are that person. So anyone can pretend to be someone else by changing their Git settings.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.