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
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: 2/7/2026, 10:06:03 AM
Views: 43
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-2080: Command Injection in UTT HiPER 810
HighCVE-2026-2079: Improper Authorization in yeqifu warehouse
MediumCVE-2026-1675: CWE-1188 Initialization of a Resource with an Insecure Default in brstefanovic Advanced Country Blocker
MediumCVE-2026-1643: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in ariagle MP-Ukagaka
MediumCVE-2026-1634: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in alexdtn Subitem AL Slider
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.