/

CVE-2026-102826

Severity:

HIGH RISK

(8.1)

Command Injection (CWE-78) in simple-git Git Clone

CVE-2026-102826

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A command injection vulnerability in simple-git allows attacker-influenced Git clone arguments to cause Git to load an unintended configuration file. If the application can read an attacker-controlled file, that configuration may cause Git to execute commands with the privileges of the Node.js process.

Affected context

The vulnerability may occur in simple-git applications that:

  • Use the Git clone operation with custom arguments influenced by an attacker
  • Permit Git configuration include directives to be introduced through those arguments or related files
  • Run the clone operation with access to an attacker-controlled, readable configuration file
  • Execute Git with meaningful operating-system or application privileges

The issue involves incomplete filtering of both direct and conditional configuration include options.

Exploit preconditions

  • Attack surface: An application endpoint, job, or workflow that invokes git.clone()
  • Required access: Ability to influence the clone operation's custom arguments and provide or affect a file readable by the Node.js process
  • Trigger point: Git configuration processing during the clone operation
  • Why exploitation is possible: An insufficiently restricted include directive can cause Git to load attacker-controlled settings, including executable options that Git invokes during the operation

Why this happens

The underlying bug is incomplete validation of Git configuration-related arguments. The defensive plugin rejects some unsafe operations but does not fully classify both direct include.path and conditional includeIf.<condition>.path forms.

As a result, attacker-influenced input can cross the boundary from command configuration into executable Git behavior. When a loaded configuration specifies an option such as an SSH command, Git may invoke that command during cloning, mapping the issue to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Potential impact

  • An attacker may execute operating-system commands with Node.js process privileges
  • The application runtime could be compromised
  • Repository credentials, tokens, or local files could be exposed
  • Git operations or retrieved source code could be manipulated
  • A compromised process could be used for lateral movement or further system damage

General mitigation guidance

Mitigation generally focuses on preventing attacker-controlled Git options and reducing the privileges available to Git subprocesses.

Common defensive patterns include:

  • Use a secure-by-default Git argument policy that rejects all configuration include variants, including conditional forms
  • Treat clone options and repository metadata as untrusted input, and permit only narrowly defined arguments
  • Avoid passing arbitrary custom arguments from request or job data into Git subprocesses
  • Restrict the files and directories readable by the Node.js process and Git child processes
  • Run Git operations with a dedicated low-privilege identity, isolated filesystem access, and limited network permissions
  • Apply repository, SSH, and credential policies that prevent unexpected command execution
  • Validate arguments before process creation and maintain defense-in-depth controls around subprocess execution

How teams detect issues like this

Detection approaches may include:

  • Static analysis rules for attacker-controlled values reaching git.clone() custom arguments or child-process execution
  • Code review checks for allowlists that omit direct or conditional Git configuration include forms
  • Runtime monitoring for unexpected Git configuration files, SSH command settings, or child processes spawned during cloning
  • Policy enforcement that restricts Git subprocess arguments, readable configuration paths, and available credentials
  • Automated security review tools that trace untrusted data into Git and operating-system command execution paths

Sources

SourceLink
github.comgithub.com/steveukx/git-js/commit/98864c678444d9336357c844efa4fd5a7984c0d7
github.comgithub.com/steveukx/git-js/pull/1193
github.comgithub.com/steveukx/git-js/releases/tag/simple-git@4.0.0
github.comgithub.com/steveukx/git-js/security/advisories/GHSA-g4wm-2vf7-vfgr

Frequently asked

questions

It can be reachable through a remote application feature when that feature passes attacker-influenced custom arguments to a Git clone operation. A local or internal attacker may also be relevant if they can influence those arguments and place a readable configuration file.

The attacker must be able to affect clone arguments and cause the Node.js process to read an attacker-controlled file. The resulting command execution occurs with the privileges and access available to that process.

Use a restrictive allowlist for Git arguments, reject every configuration-include form, and avoid forwarding arbitrary custom arguments to Git. Run the operation with minimal privileges and isolated filesystem and credential access.

Treat Git options and repository-related files as untrusted input, test validation against direct and conditional include syntax, monitor subprocess behavior, and enforce secure argument policies through code review and automated analysis.

Find out what's already
exploitable in your codebase.