Home/Research/Post

GHSA-xvcc-vqjv-phqh: augment-virShell allows Command Injection in `grep()` via Unsanitized `searchPattern`

  • Severity: HIGH
  • CVE: CVE-2026-63496
  • Ecosystems: npm
  • Packages: @augment-vir/node

## Shell Command Injection in `grep()` via Unsanitized `searchPattern`

### Summary

The `grep()` function exported by `@augment-vir/node` inserts caller-controlled search patterns directly into a double-quoted shell command string without sanitization (`grep.ts:310`). When the constructed command is passed to `spawn()` with `shell: ‘bash’` (`shell.ts:98-99`), bash evaluates `$()` command substitution expressions embedded in the pattern, resulting in arbitrary OS command execution as the Node.js process user. Any downstream application that passes untrusted input to `grep()`’s `pattern` or `patterns` field is vulnerable to unauthenticated local (and potentially remote) code execution. CVSS Base Score: **7.8 (High)**.

### Details

**Root cause:** `packages/node/src/augments/fs/grep.ts:310` maps each search pattern into the shell fragment `-e “${searchPattern}”` with no sanitization:

“`ts
// grep.ts:310
…searchPatterns.map((searchPattern) => `-e “${searchPattern}”`),
“`

The resulting full command string is forwarded to `runShellCommand` (`grep.ts:320`), which calls `streamShellCommand` (`shell.ts:221-224`), which ultimately calls:

“`ts
// shell.ts:98-99
const childProcess = spawn(command, {
shell, // defaults to ‘bash’ (shell.ts:92)
“`

Because `shell` is `’bash’`, bash interprets `$()` within the double-quoted pattern as a command substitution and executes it before `grep` ever runs.

**Incomplete sanitization:** An `escape()` helper exists at `grep.ts:178-180` but…

Source: GitHub Security Advisories · 2026-11-18