← back
CVE-2024-50349

Git does not sanitize URLs when asking for credentials interactively

CVSS 2.1 LOWEPSS 0.6%CWE-116CWE-147CWE-150
In short

Git displays unsanitized URLs when prompting for credentials interactively, allowing attackers to use ANSI escape sequences to deceive users into entering passwords for fake hosting sites. This can trick users into revealing credentials to untrusted systems.

Technical detail

When Git requests credentials via terminal prompt without a credential helper, decoded URL-encoded characters and ANSI escape sequences are printed verbatim, enabling attackers to craft malicious URLs that manipulate terminal output to impersonate trusted hosting sites. The attack requires user interaction with untrusted repository URLs and relies on terminal interpretation of escape sequences to succeed.

Summary generated and translated by AI from the official description.
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.2, 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.
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:A/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N
Affected products
git · git

Want to know if your infrastructure is exposed to this?

Talk to TrueHacking →