CVE-2022-31012: CWE-426: Untrusted Search Path in git-for-windows git
Git for Windows is a fork of Git that contains Windows-specific patches. This vulnerability in versions prior to 2.37.1 lets Git for Windows' installer execute a binary into `C:\mingw64\bin\git.exe` by mistake. This only happens upon a fresh install, not when upgrading Git for Windows. A patch is included in version 2.37.1. Two workarounds are available. Create the `C:\mingw64` folder and remove read/write access from this folder, or disallow arbitrary authenticated users to create folders in `C:\`.
AI Analysis
Technical Summary
CVE-2022-31012 is a vulnerability identified in Git for Windows, a Windows-specific fork of the widely used Git version control system. The issue is classified under CWE-426, which pertains to untrusted search path vulnerabilities. Specifically, in versions of Git for Windows prior to 2.37.1, the installer erroneously executes a binary located at `C:\mingw64\bin\git.exe` during a fresh installation process. This behavior arises because the installer does not securely validate the search path for executables, allowing an attacker to place a malicious binary in the `C:\mingw64\bin` directory. When the installer runs, it may inadvertently execute this malicious binary instead of the legitimate Git executable. Notably, this vulnerability only manifests during fresh installations and does not affect upgrade procedures. The root cause is the untrusted search path that the installer uses to locate executables, which can be exploited if an attacker has the ability to create or modify files in the `C:\mingw64` directory or its parent `C:\` directory. The vendor addressed this vulnerability in version 2.37.1 by patching the installer to prevent execution of untrusted binaries. Two practical workarounds exist: first, creating the `C:\mingw64` folder and removing read/write permissions for unauthorized users to prevent malicious binary placement; second, restricting folder creation rights in the root `C:\` directory to trusted users only. There are no known exploits in the wild reported to date, and the vulnerability requires local access with the ability to write to specific directories on the system. This vulnerability does not require user interaction beyond running the installer and is limited in scope to fresh installations of affected Git for Windows versions prior to 2.37.1.
Potential Impact
For European organizations, the impact of this vulnerability is primarily on the integrity and availability of systems where Git for Windows is freshly installed. An attacker with local access or the ability to influence the file system on a target machine could execute arbitrary code with the privileges of the installer process, potentially leading to system compromise, unauthorized code execution, or persistence mechanisms. This could undermine the integrity of software development environments, continuous integration/continuous deployment (CI/CD) pipelines, and other workflows relying on Git for Windows. However, since the vulnerability only affects fresh installations and not upgrades, the window of exposure is limited. Confidentiality impact is moderate since arbitrary code execution could lead to data exfiltration if exploited. Availability could also be affected if malicious code disrupts Git operations or the host system. The lack of known exploits reduces immediate risk, but organizations deploying Git for Windows in development or production environments should remain vigilant. The vulnerability is less likely to be exploited remotely, limiting its impact to insider threats or attackers with some level of system access. Overall, the threat poses a medium risk to European organizations, especially those with active software development teams using Git for Windows and where endpoint security controls are insufficient to prevent unauthorized file system modifications.
Mitigation Recommendations
European organizations should prioritize upgrading Git for Windows installations to version 2.37.1 or later, where the vulnerability is patched. For environments where immediate upgrade is not feasible, implement the following mitigations: 1) Pre-create the `C:\mingw64` directory on target systems and restrict its permissions to prevent unauthorized users from writing or modifying files within it. This can be enforced via Group Policy Objects (GPO) in Active Directory environments or endpoint management solutions. 2) Restrict the ability of non-administrative users to create folders or files directly in the root `C:\` directory, limiting the attack surface for placing malicious binaries. 3) Employ endpoint detection and response (EDR) tools to monitor for suspicious file creation or execution events in the `C:\mingw64\bin` path. 4) Educate IT and development teams to avoid installing Git for Windows from untrusted sources and to verify installer integrity. 5) Integrate installation processes into automated, controlled deployment pipelines that enforce security policies and prevent unauthorized file system changes. 6) Regularly audit installed software versions and patch levels across endpoints to ensure compliance with security standards. These targeted mitigations go beyond generic advice by focusing on filesystem permissions and installation process controls specific to this vulnerability.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Poland, Italy, Spain
CVE-2022-31012: CWE-426: Untrusted Search Path in git-for-windows git
Description
Git for Windows is a fork of Git that contains Windows-specific patches. This vulnerability in versions prior to 2.37.1 lets Git for Windows' installer execute a binary into `C:\mingw64\bin\git.exe` by mistake. This only happens upon a fresh install, not when upgrading Git for Windows. A patch is included in version 2.37.1. Two workarounds are available. Create the `C:\mingw64` folder and remove read/write access from this folder, or disallow arbitrary authenticated users to create folders in `C:\`.
AI-Powered Analysis
Technical Analysis
CVE-2022-31012 is a vulnerability identified in Git for Windows, a Windows-specific fork of the widely used Git version control system. The issue is classified under CWE-426, which pertains to untrusted search path vulnerabilities. Specifically, in versions of Git for Windows prior to 2.37.1, the installer erroneously executes a binary located at `C:\mingw64\bin\git.exe` during a fresh installation process. This behavior arises because the installer does not securely validate the search path for executables, allowing an attacker to place a malicious binary in the `C:\mingw64\bin` directory. When the installer runs, it may inadvertently execute this malicious binary instead of the legitimate Git executable. Notably, this vulnerability only manifests during fresh installations and does not affect upgrade procedures. The root cause is the untrusted search path that the installer uses to locate executables, which can be exploited if an attacker has the ability to create or modify files in the `C:\mingw64` directory or its parent `C:\` directory. The vendor addressed this vulnerability in version 2.37.1 by patching the installer to prevent execution of untrusted binaries. Two practical workarounds exist: first, creating the `C:\mingw64` folder and removing read/write permissions for unauthorized users to prevent malicious binary placement; second, restricting folder creation rights in the root `C:\` directory to trusted users only. There are no known exploits in the wild reported to date, and the vulnerability requires local access with the ability to write to specific directories on the system. This vulnerability does not require user interaction beyond running the installer and is limited in scope to fresh installations of affected Git for Windows versions prior to 2.37.1.
Potential Impact
For European organizations, the impact of this vulnerability is primarily on the integrity and availability of systems where Git for Windows is freshly installed. An attacker with local access or the ability to influence the file system on a target machine could execute arbitrary code with the privileges of the installer process, potentially leading to system compromise, unauthorized code execution, or persistence mechanisms. This could undermine the integrity of software development environments, continuous integration/continuous deployment (CI/CD) pipelines, and other workflows relying on Git for Windows. However, since the vulnerability only affects fresh installations and not upgrades, the window of exposure is limited. Confidentiality impact is moderate since arbitrary code execution could lead to data exfiltration if exploited. Availability could also be affected if malicious code disrupts Git operations or the host system. The lack of known exploits reduces immediate risk, but organizations deploying Git for Windows in development or production environments should remain vigilant. The vulnerability is less likely to be exploited remotely, limiting its impact to insider threats or attackers with some level of system access. Overall, the threat poses a medium risk to European organizations, especially those with active software development teams using Git for Windows and where endpoint security controls are insufficient to prevent unauthorized file system modifications.
Mitigation Recommendations
European organizations should prioritize upgrading Git for Windows installations to version 2.37.1 or later, where the vulnerability is patched. For environments where immediate upgrade is not feasible, implement the following mitigations: 1) Pre-create the `C:\mingw64` directory on target systems and restrict its permissions to prevent unauthorized users from writing or modifying files within it. This can be enforced via Group Policy Objects (GPO) in Active Directory environments or endpoint management solutions. 2) Restrict the ability of non-administrative users to create folders or files directly in the root `C:\` directory, limiting the attack surface for placing malicious binaries. 3) Employ endpoint detection and response (EDR) tools to monitor for suspicious file creation or execution events in the `C:\mingw64\bin` path. 4) Educate IT and development teams to avoid installing Git for Windows from untrusted sources and to verify installer integrity. 5) Integrate installation processes into automated, controlled deployment pipelines that enforce security policies and prevent unauthorized file system changes. 6) Regularly audit installed software versions and patch levels across endpoints to ensure compliance with security standards. These targeted mitigations go beyond generic advice by focusing on filesystem permissions and installation process controls specific to this vulnerability.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-05-18T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9844c4522896dcbf356f
Added to database: 5/21/2025, 9:09:24 AM
Last enriched: 6/23/2025, 4:07:19 AM
Last updated: 7/31/2025, 12:08:01 PM
Views: 11
Related Threats
CVE-2025-9091: Hard-coded Credentials in Tenda AC20
LowCVE-2025-9090: Command Injection in Tenda AC20
MediumCVE-2025-9092: CWE-400 Uncontrolled Resource Consumption in Legion of the Bouncy Castle Inc. Bouncy Castle for Java - BC-FJA 2.1.0
LowCVE-2025-9089: Stack-based Buffer Overflow in Tenda AC20
HighCVE-2025-9088: Stack-based Buffer Overflow in Tenda AC20
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.