Git Credential Disclosure Vulnerability (CVE-2020-5260) Threat Alert

Git Credential Disclosure Vulnerability (CVE-2020-5260) Threat Alert

May 1, 2020 | Adeline Zhang

Vulnerability Description

On April 15, Git issued a security bulletin announcing a vulnerability that could reveal Git user credentials (CVE-2020-5260). Git uses a credential helper to store and retrieve credentials. But when a URL contains an encoded newline (%0a), it may inject unexpected values into the protocol stream of the credential helper.  This vulnerability is triggered when the affected version of Git is used to execute a git clone command on a malicious URL. Users should take preventive measures as soon as possible.

Reference link:

https://github.com/git/git/security/advisories/GHSA-qm7j-c969-7j4q

Scope of Impact

Affected Versions

  • Git 2.17.x <= 2.17.3
  • Git 2.18.x <= 2.18.2
  • Git 2.19.x <= 2.19.3
  • Git 2.20.x <= 2.20.2
  • Git 2.21.x <= 2.21.1
  • Git 2.22.x <= 2.22.2
  • Git 2.23.x <= 2.23.1
  • Git 2.24.x <= 2.24.1
  • Git 2.25.x <= 2.25.2
  • Git 2.26.x <= 2.26.0

Unaffected Versions

  • Git 2.17.4
  • Git 2.18.3
  • Git 2.19.4
  • Git 2.20.3
  • Git 2.21.2
  • Git 2.22.3
  • Git 2.23.2
  • Git 2.24.2
  • Git 2.25.3
  • Git 2.26.1

Vulnerability Detection

Version Check

Related users can check whether their applications are vulnerable by checking the current version.

To check the current Git version, run the following command:

git --version

If it is one of the affected versions, the application is vulnerable.

Mitigation

Official Fix

Currently, this vulnerability has been fixed in the latest Git version. Affected users are advised to upgrade as soon as possible from the following link: https://github.com/git/git/releases.

Users are advised to install updates by executing the following commands (Here, V2.23.2 is taken as an example):

wget https://github.com/git/git/archive/v2.23.2.tar.gz

tar zxvf v2.23.2.tar.gz

cd git-2.23.2

make configure

./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv

make all doc

make install install-doc install-html

echo "export PATH=$PATH:/usr/local/git/bin:/usr/local/git/libexec/git-core" >> /etc/bashrc

Other Protection Measures

If related users cannot perform upgrade temporarily, they can take the following protection measures:

Method 1: Disable credential helper by running the following commands.

git config --unset credential.helper

git config --global --unset credential.helper

git config --system --unset credential.helper

 Method 2: Be vigilant about malicious URLs.

  1. Examine the host name and user name portion of URLs fed to git clone for the presence of encoded newlines (%0a) or evidence of credential-protocol injections (e.g., host=github.com).
  2. Avoid using submodules with untrusted repositories (do not use clone –recurse-submodules; use git submodule update only after examining the URLs found in .gitmodules).
  3. Avoid tools which may run git clone.

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.

NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA).

A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.