CVE-2024-50349
NoneCVSS
—
EPSS
0.7%
Published
Jan 14, 2025
CISA due date
—
Cloudanix analysis
Git can be tricked into showing the wrong server name when asking for a password, so users might accidentally send their login details to an attacker instead of the real site.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Moderate
- Impact
- Data Exposure
- Component
- Application
- Class
- Credential Exposure
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Git prints URL-decoded hostnames containing ANSI escape sequences verbatim during terminal credential prompts, enabling visual spoofing of the target host in the prompt text.
Why it matters to the business
Attackers can obtain developer credentials for trusted repositories by tricking users during clone operations from untrusted sources, leading to source code theft, supply chain compromise, or unauthorized repository access; high ecosystem prevalence increases exposure across many development environments.
How an attack unfolds
An attacker crafts a malicious URL embedding ANSI escape sequences that decode to mimic a trusted host, then lures a victim into cloning from it (especially recursive clones); Git decodes and prints the hostname in the credential prompt, causing the user to enter credentials for the attacker's controlled site instead.
How to fix it
Upgrade Git to one of the fixed releases v2.48.1, v2.47.1, v2.46.3, v2.45.3, v2.44.3, v2.43.6, v2.42.4, v2.41.3, or v2.40.4. Users unable to upgrade must avoid cloning from untrusted URLs, especially recursive clones.
How to confirm the fix worked
Verify installed Git version is at or above a fixed release; test by attempting a clone with a crafted URL containing ANSI sequences and confirm the prompt no longer displays decoded escape sequences verbatim.
Typical attack path
- Craft URL with ANSI escapes that visually spoof a trusted Git host after decoding
- Distribute the malicious URL via phishing, malicious README, or dependency links
- Victim performs git clone or submodule update from the URL
- Git prompts for credentials and displays the spoofed hostname
- Victim supplies credentials believing they are for the trusted host
- Credentials are sent to attacker-controlled server
How to detect it
Search terminal histories, shell logs, and Git credential helper logs for clones involving URLs with percent-encoded sequences or unusual hostnames; monitor for credential prompts displaying unexpected or obfuscated host information.
What your security team should do
- Immediately upgrade all Git installations to a patched version listed in remediation guidance
- Block or monitor for clones from untrusted or newly observed remote URLs in CI/CD and developer workflows
- Educate developers on verifying repository URLs before cloning, especially recursive operations
- Review recent clone activity logs for suspicious or unexpected remote hosts
The record
Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. When Git asks for credentials via a terminal prompt (i.e. without using any credential helper), it prints out the host name for which the user is expected to provide a username and/or a password. At this stage, any URL-encoded parts have been decoded already, and are printed verbatim. This allows attackers to craft URLs that contain ANSI escape sequences that the terminal interpret to confuse users e.g. into providing passwords for trusted Git hosting sites when in fact they are then sent to untrusted sites that are under the attacker's control. This issue has been patch via commits `7725b81` and `c903985` which are included in release versions v2.48.1, v2.47.1, v2.46.3, v2.45.3, v2.44.3, v2.43.6, v2.42.4, v2.41.3, and v2.40.4. Users are advised to upgrade. Users unable to upgrade should avoid cloning from untrusted URLs, especially recursive clones.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| AlmaLinux:10 | git | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-all | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-core | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-core-doc | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-credential-libsecret | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-daemon | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-email | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-gui | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-instaweb | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-subtree | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | git-svn | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | gitk | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | gitweb | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | perl-Git | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:10 | perl-Git-SVN | 0 | 2.47.3-1.el10_0 |
| AlmaLinux:8 | git | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-all | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-core | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-core-doc | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-credential-libsecret | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-daemon | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-email | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-gui | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-instaweb | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-subtree | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | git-svn | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | gitk | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | gitweb | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | perl-Git | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:8 | perl-Git-SVN | 0 | 2.43.7-1.el8_10 |
| AlmaLinux:9 | git | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-all | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-core | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-core-doc | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-credential-libsecret | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-daemon | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-email | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-gui | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-instaweb | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-subtree | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | git-svn | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | gitk | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | gitweb | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | perl-Git | 0 | 2.47.3-1.el9_6 |
| AlmaLinux:9 | perl-Git-SVN | 0 | 2.47.3-1.el9_6 |
| Alpine:v3.18 | git | 0 | 2.40.4-r0 |
| Alpine:v3.19 | git | 0 | 2.43.6-r0 |
| Alpine:v3.20 | git | 0 | 2.45.3-r0 |
| Alpine:v3.21 | git | 0 | 2.47.2-r0 |
| Alpine:v3.22 | git | 0 | 2.48.1-r0 |
| Bitnami | git | 0 | 2.40.4 |
| Chainguard | git | 0 | 2.48.1-r0 |
| Chainguard | git-completion | 0 | 2.48.1-r0 |
| Chainguard | git-daemon | 0 | 2.48.1-r0 |
| Chainguard | git-doc | 0 | 2.48.1-r0 |
| Chainguard | git-email | 0 | 2.48.1-r0 |
| Chainguard | git-iamguarded-compat | 0 | 2.48.1-r0 |
| Chainguard | git-p4 | 0 | 2.48.1-r0 |
| Debian:11 | git | 0 | No fix |
| Debian:11 | git | 0 | 1:2.30.2-1+deb11u4 |
| Debian:12 | git | 0 | No fix |
| Debian:12 | git | 0 | 1:2.39.5-0+deb12u2 |
| Debian:13 | git | 0 | No fix |
| Mageia:9 | git | 0 | 2.41.3-1.mga9 |
| SUSE:Enterprise Storage 7.1 | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP5-ESPOS | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP5-LTSS | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise Micro 5.5 | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP6 | git | 0 | 2.43.0-150600.3.9.1 |
| SUSE:Linux Enterprise Module for Development Tools 15 SP6 | git | 0 | 2.43.0-150600.3.9.1 |
| SUSE:Linux Enterprise Server 12 SP5-LTSS | git | 0 | 2.26.2-27.78.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise Server 15 SP5-LTSS | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise Server LTSS Extended Security 12 SP5 | git | 0 | 2.26.2-27.78.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP5 | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Manager Proxy 4.3 | git | 0 | 2.35.3-150300.10.48.1 |
| SUSE:Manager Server 4.3 | git | 0 | 2.35.3-150300.10.48.1 |
| Ubuntu:20.04:LTS | git | 0 | No fix |
| Ubuntu:20.04:LTS | git | 0 | 1:2.25.1-1ubuntu3.14 |
| Ubuntu:22.04:LTS | git | 0 | 1:2.34.1-1ubuntu1.12 |
| Ubuntu:24.04:LTS | git | 0 | 1:2.43.0-1ubuntu7.2 |
| Ubuntu:24.10 | git | 0 | 1:2.45.2-1ubuntu1.1 |
| Ubuntu:25.04 | git | 0 | 1:2.47.1-1ubuntu1 |
| Ubuntu:Pro:16.04:LTS | git | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | git | 0 | 1:2.7.4-0ubuntu1.10+esm13 |
| Ubuntu:Pro:18.04:LTS | git | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | git | 0 | 1:2.17.1-1ubuntu0.18+esm6 |
| Wolfi | git | 0 | 2.48.1-r0 |
| Wolfi | git-completion | 0 | 2.48.1-r0 |
| Wolfi | git-daemon | 0 | 2.48.1-r0 |
| Wolfi | git-doc | 0 | 2.48.1-r0 |
| Wolfi | git-email | 0 | 2.48.1-r0 |
| Wolfi | git-iamguarded-compat | 0 | 2.48.1-r0 |
| Wolfi | git-p4 | 0 | 2.48.1-r0 |
| openSUSE:Leap 15.6 | git | 0 | 2.43.0-150600.3.9.1 |
| openSUSE:Tumbleweed | git | 0 | 2.48.1-1.1 |
Related vulnerabilities
- CVE-2025-48384 Git is a fast, scalable, distributed revision control system with an unusually rich… Also affects git
- CVE-2024-52005 Git is a source code management tool. Also affects git
- CVE-2024-52006 Git is a fast, scalable, distributed revision control system with an unusually rich… Also affects git
- CVE-2017-1000117 A malicious third-party can give a crafted "ssh://..." URL to an unsuspecting victim, and… Also affects git
- CVE-2022-25648 The package git before 1.11.0 are vulnerable to Command Injection via git argument… Also affects git
- CVE-2014-9390 Git before 1.8.5.6, 1.9.x before 1.9.5, 2.0.x before 2.0.5, 2.1.x before 2.1.4, and 2.2.x… Also affects git
- CVE-2017-15298 Git through 2.14.2 mishandles layers of tree objects, which allows remote attackers to… Also affects git
- CVE-2017-14867 Git before 2.10.5, 2.11.x before 2.11.4, 2.12.x before 2.12.5, 2.13.x before 2.13.6, and… Also affects git