CVE-2024-53858

6.5 MEDIUM

📋 TL;DR

The GitHub CLI (gh) versions before 2.63.0 leak authentication tokens when cloning repositories containing git submodules from non-GitHub hosts. This occurs because the CLI incorrectly provides GitHub tokens to external git hosts during submodule operations. All users of GitHub CLI who clone repositories with external submodules are affected.

💻 Affected Systems

Products:
  • GitHub CLI (gh)
Versions: All versions before 2.63.0
Operating Systems: All platforms where GitHub CLI is installed
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects users who clone repositories containing git submodules from non-GitHub hosts (not github.com or ghe.com).

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers hosting malicious git repositories with submodules could steal GitHub authentication tokens, potentially gaining unauthorized access to private repositories, performing actions on behalf of the user, or accessing enterprise resources.

🟠

Likely Case

Accidental token exposure when cloning legitimate repositories containing submodules from external git hosts (like GitLab, Bitbucket, or self-hosted git servers), potentially allowing those hosts to capture GitHub tokens.

🟢

If Mitigated

Limited impact if tokens have minimal permissions, are regularly rotated, or if users don't clone repositories with external submodules.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: LOW

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires the victim to clone a malicious repository with submodules pointing to attacker-controlled git hosts. The vulnerability is in the credential helper logic, not requiring complex exploitation techniques.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.63.0

Vendor Advisory: https://github.com/cli/cli/security/advisories/GHSA-jwcm-9g39-pmcw

Restart Required: No

Instructions:

1. Update GitHub CLI using your package manager: 'brew upgrade gh' (macOS), 'sudo apt update && sudo apt upgrade gh' (Debian/Ubuntu), 'winget upgrade GitHub.cli' (Windows). 2. Alternatively, download from https://github.com/cli/cli/releases/tag/v2.63.0. 3. Verify with 'gh --version'.

🔧 Temporary Workarounds

Disable credential helper for non-GitHub hosts

all

Configure git to not use gh as credential helper for external hosts

git config --global credential.https://github.com.helper ""
git config --global credential.https://ghe.com.helper ""

Avoid cloning repositories with external submodules

all

Manually check repositories before cloning or use '--recurse-submodules=no' flag

gh repo clone <repo> -- --recurse-submodules=no

🧯 If You Can't Patch

  • Revoke all GitHub tokens used with the CLI and generate new ones with minimal necessary permissions.
  • Review GitHub security logs for suspicious activity and monitor for unauthorized access.

🔍 How to Verify

Check if Vulnerable:

Run 'gh --version' and check if version is less than 2.63.0. Also check if you've cloned repositories with submodules from non-GitHub hosts.

Check Version:

gh --version

Verify Fix Applied:

Confirm 'gh --version' shows 2.63.0 or higher. Test cloning a repository with external submodules while monitoring network traffic for token leaks.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected git credential requests to non-GitHub hosts in git logs
  • Suspicious activity in GitHub security logs from unexpected IPs/locations

Network Indicators:

  • Git protocol traffic to non-GitHub hosts containing authentication headers
  • Unexpected outbound connections during repository cloning operations

SIEM Query:

source="git.log" AND "credential helper" AND NOT (host="github.com" OR host="ghe.com")

🔗 References

📤 Share & Export