Detect git-diff npm OS Command Injection via gitDiff Input Strings (CVE-2026-110634) in Google Chronicle
Detects exploitation of CVE-2026-110634, an OS command injection vulnerability (CWE-78) in the npm 'git-diff' package before version 2.0.7. The vulnerable gitDiff API in js/gitDiffReal/generateDiff/index.js passes caller-supplied strings into a shell-executed git command without sanitization, allowing attackers who control the diff input strings to inject arbitrary OS commands (e.g., via shell metacharacters such as ;, |, &&, `$()`, backticks). CVSS 9.8, public PoC. This detection surfaces node processes that spawn git with shell metacharacters, anomalous child processes (sh, bash, cmd, curl, wget, nc) parented by node/git invocations, and installations of the vulnerable package version.
MITRE ATT&CK
- Tactic
- Initial Access Execution
YARA-L Detection Query
// df00tech DF00-389d06272c · https://df00tech.com/detections/CVE-2026-110634 · licence: https://df00tech.com/detections/licence
rule git_diff_command_injection_cve_2026_110634 {
meta:
author = "Argus"
description = "Detects OS command injection via npm git-diff gitDiff input strings (CVE-2026-110634)"
severity = "CRITICAL"
events:
$e.metadata.event_type = "PROCESS_LAUNCH"
$e.principal.process.parent_process.file.full_path = /node|npm/ nocase
(
$e.target.process.file.full_path = /(\\|\/)(sh|bash|dash|cmd\.exe|powershell\.exe|curl|wget|nc|ncat)$/ nocase or
$e.target.process.command_line = /[;|`]|&&|\$\(/
)
condition:
$e
} Chronicle YARA-L 2.0 rule matching node/npm-parented process launches with suspicious children or shell metacharacters tied to gitDiff injection.
Data Sources
Required Tables
False Positives & Tuning
- CI/CD systems invoking git from node with chained operators
- Developer tooling piping git diff output
- Monorepo scripts shelling out to git
Other platforms for CVE-2026-110634
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.
- Test 1 Install vulnerable git-diff package version
Expected signal: npm process installing [email protected]; package.json version field shows 2.0.6
- Test 2 Simulate gitDiff command injection via crafted input string
Expected signal: node process spawns /bin/sh executing 'git diff file.txt; touch /tmp/gitdiff_pwned'; touch child process creates /tmp/gitdiff_pwned
- Test 3 Simulate command injection with network egress payload
Expected signal: node process spawns /bin/sh then curl attempting outbound connection to 127.0.0.1:9
References (6)
- https://nvd.nist.gov/vuln/detail/CVE-2026-110634
- https://github.com/advisories/GHSA-6wfj-92cw-88vg
- https://github.com/danday74/git-diff/pull/16
- https://github.com/danday74/git-diff/commit/bfd727b6cf1daa671c3528d1d681f55b70e8fb19
- https://github.com/danday74/git-diff/blob/a85a649badc4c6bba991e87e82382b7d3cdd6634/js/gitDiffReal/generateDiff/index.js#L26-L30
- https://www.vulncheck.com/advisories/git-diff-before-2.0.7-os-command-injection-via-gitdiff-input-strings
Response Playbook
Triage
- Confirm whether the affected host runs an application depending on the npm 'git-diff' package; run 'npm ls git-diff' in project roots and check package-lock.json / node_modules/git-diff/package.json for a version < 2.0.7.
- Extract the full command line and parent/child process tree from the alert and identify the shell metacharacters (;, |, &&, $(), backticks) injected into the git invocation.
- Determine the source of the diff input strings, trace which application endpoint or user-controlled field fed the gitDiff API (file paths, branch/commit strings) and whether the input was attacker-reachable.
- Check whether the spawned child process performed network egress, file writes, or credential access following the injected command.
Containment
- Isolate or network-quarantine the affected host if a non-git child process (shell, curl, wget, nc) was successfully spawned by the node/git chain.
- Kill the offending node process tree and block outbound connections initiated by injected commands pending investigation.
- Take the vulnerable application offline or disable the code path invoking the gitDiff API until the package is upgraded to git-diff >= 2.0.7.
Evidence Collection
- Capture the full process-creation events (command line, parent, user, hashes) for the node process and all descendants, plus EDR process tree export.
- Collect the application logs and request logs showing the input strings passed to the gitDiff API, and preserve node_modules/git-diff/js/gitDiffReal/generateDiff/index.js for version confirmation.
- Snapshot the host filesystem and memory if a secondary payload (reverse shell, dropped binary) is suspected, and preserve network flow records for egress from injected commands.
Escalation Criteria
- !Escalate to incident response if an injected command successfully spawned a shell, established outbound C2, or accessed credentials/secrets.
- !Escalate to the application owner and change management if the vulnerable git-diff version is confirmed in a production, internet-facing service.
- !Escalate if evidence of lateral movement, persistence, or data exfiltration follows the initial injection.
Investigation Guide
Forensic Artifacts
- >
Process-creation telemetry showing node/npm as parent of shell/git with shell metacharacters - >
node_modules/git-diff/package.json version string and generateDiff/index.js source - >
Application request/input logs containing the crafted diff strings - >
Outbound network connection records from injected child processes
Tuning Guidance
Baseline legitimate CI/CD and developer tooling that invokes git from node with shell operators, and exclude known build-agent hosts and service accounts. Tighten by requiring a non-git child process (shell, curl, wget, nc) spawned from the node/git chain to reduce noise from benign piped diff commands. Prioritize alerts where the git-diff package version is confirmed < 2.0.7 and the input source is externally reachable.
Hunting Queries
Hunts for node-parented git invocations carrying shell metacharacters indicative of gitDiff input-string injection.
// df00tech DF00-389d06272c · https://df00tech.com/detections/CVE-2026-110634 · licence: https://df00tech.com/detections/licence
DeviceProcessEvents | where InitiatingProcessFileName in~ ("node","node.exe") | where ProcessCommandLine has "git" and ProcessCommandLine has_any (";","|","$(","`","&&") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessCommandLine ``` df00tech DF00-389d06272c · https://df00tech.com/detections/CVE-2026-110634 · licence: https://df00tech.com/detections/licence ```
index=edr parent_process_name IN ("node","node.exe") process="*git*" | regex process="[;|`]|&&|\$\(" | table _time host user process parent_process Atomic Red Team Tests
Installs git-diff < 2.0.7 to establish a vulnerable baseline for detection testing.
Command
mkdir -p /tmp/gitdiff-test && cd /tmp/gitdiff-test && npm init -y >/dev/null 2>&1 && npm install [email protected] >/dev/null 2>&1 && cat node_modules/git-diff/package.json | grep '"version"' Cleanup
rm -rf /tmp/gitdiff-test Expected Telemetry
npm process installing [email protected]; package.json version field shows 2.0.6
Expected Detection
Software inventory/vulnerability scan flags git-diff < 2.0.7; no process-injection alert expected at this stage.
Invokes a node wrapper that passes an attacker-controlled string containing shell metacharacters into a shell-executed git diff command, mimicking the vulnerable gitDiff code path.
Command
cd /tmp/gitdiff-test && node -e "const {execSync}=require('child_process'); const userInput='file.txt; touch /tmp/gitdiff_pwned'; execSync('git diff '+userInput, {shell:'/bin/sh'});" ; ls -l /tmp/gitdiff_pwned Cleanup
rm -f /tmp/gitdiff_pwned Expected Telemetry
node process spawns /bin/sh executing 'git diff file.txt; touch /tmp/gitdiff_pwned'; touch child process creates /tmp/gitdiff_pwned
Expected Detection
Detection fires on node-parented shell/touch process with shell metacharacters in the command line.
Simulates a higher-severity injection where the crafted string triggers an outbound download, modeling a real attack chain.
Command
cd /tmp/gitdiff-test && node -e "const {execSync}=require('child_process'); const userInput='HEAD~1 && curl -s http://127.0.0.1:9/beacon || true'; execSync('git diff '+userInput, {shell:'/bin/sh'});" Cleanup
echo 'no artifact to remove' Expected Telemetry
node process spawns /bin/sh then curl attempting outbound connection to 127.0.0.1:9
Expected Detection
Detection fires on node-parented curl process chained via && from a git command line.