Listen to this Post

GitHub is a critical platform for open-source collaboration, but itâs also a prime target for threat actors conducting reconnaissance. A tool like “GitHub Commits Email Finder” (https://lnkd.in/gWxSXpSx) demonstrates how easily attackers can extract commit metadata, including contributor emails and associated IPs, and cross-reference them with databases like Have I Been Pwned (HIBP).
You Should Know: How to Protect Your GitHub Repo from Email Leaks
- Remove or Obfuscate Personal Emails in Git History
If your personal email is exposed in commits, rewrite Git history to replace it:git filter-branch --env-filter ' OLD_EMAIL="[email protected]" CORRECT_EMAIL="[email protected]" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]; then export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]; then export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --tag-name-filter cat -- --branches --tags
Warning: Force-pushing (
git push --force) will alter commit hashesâcoordinate with collaborators.
2. Use GitHubâs Private Email Feature
Enable “Keep my email addresses private” in GitHub Settings:
1. Go to Settings â Emails.
- Check “Block command line pushes that expose my email”.
3. Verify Exposed Emails with HIBP
Check if your email is compromised using HIBPâs API:
curl -s "https://haveibeenpwned.com/api/v3/breachedaccount/$EMAIL" -H "hibp-api-key: YOUR_API_KEY"
4. Monitor GitHub for Leaked Secrets
Scan repositories for accidentally committed API keys/tokens:
Install Gitleaks (secret scanner) git clone https://github.com/gitleaks/gitleaks.git cd gitleaks make build Scan repo ./gitleaks detect --source=/path/to/repo --report=leaks.json
5. Restrict GitHub Actions Permissions
Prevent workflows from accessing sensitive data:
permissions: contents: read actions: none
What Undercode Say
GitHubâs transparency enables collaboration but also exposes developers to OSINT-driven attacks. Threat actors leverage commit histories, leaked emails, and misconfigured workflows for phishing, credential stuffing, and targeted breaches.
Key Mitigations:
- Use GitHubâs anonymous email forwarding.
- Regularly audit Git history with
git log --pretty="%ae" | sort -u. - Implement pre-commit hooks to block sensitive data.
- Monitor GitHub Audit Logs for suspicious access.
Prediction
As GitHub reconnaissance tools evolve, expect:
- More automated scraping of commit metadata.
- Increased supply-chain attacks via contributor impersonation.
- Tighter GitHub API restrictions to curb abuse.
Expected Output:
A secure GitHub repo with anonymized emails, no leaked secrets, and restricted action permissions.
Relevant URLs:
References:
Reported By: Mthomasson Unfortunately – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass â


