VulnWatch by ve1ve2
high 7.8 EPSS 0.37%

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

Source:
GitHub Security Advisories
Published:
Fetched:
Updated:
Affects:
@augment-vir/node

https://github.com/advisories/GHSA-xvcc-vqjv-phqh ↗

ghsanpmCWE-78

augment-virShell allows Command Injection in `grep()` via Unsanitized `searchPattern` ## 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 only replaces `"` with `\"` and removes newlines. It is applied to `excludePatterns`, `excludeDirs`, and `includeFiles` (`grep.ts:297-308`) but **not** to `searchPatterns`. Even if it were applied, double-quote escaping does not prevent `$()` or backtick substitution inside bash double-quote contexts. **Data flow (source → sink):** | Step | Location | Description | |------|----------|-------------| | 1 | `packages/node/src/index.ts:3` | `export * from './augments/fs/grep.js'` — exposes `grep()` as a public npm API | | 2 | `packages/node/src/augments/fs/grep.ts:223-226` | `grep()` accepts caller-controlled `grepSearchPattern` and `grepSearchLocation` | | 3 | `packages/node/src/augments/fs/grep.ts:228` | `searchPatterns` derived from `grepSearchPattern.patterns \|\| [grepSearchPattern.pattern]` | | 4 | `packages/node/src/augments/fs/grep.ts:269-314` | `fullCommand` built as a plain shell string | | 5 | `packages/node/src/augments/fs/grep.ts:310` | **Sink:** `searchPattern` inserted as `` `-e "${searchPattern}"` `` — no escaping applied | | 6 | `packages/node/src/augments/fs/grep.ts:320` | `fullCommand` passed to `runShellCommand` | | 7 | `packages/node/src/augments/terminal/shell.ts:221-224` | Forwarded to `streamShellCommand` | | 8 | `packages/node/src/augments/terminal/shell.ts:98-99` | `spawn(command, { shell: 'bash' })` executes the constructed command string | **Suggested remediation:** ```diff --- a/packages/node/src/augments/fs/grep.ts +++ b/packages/node/src/au Affected packages: npm:@augment-vir/node Patched: @augment-vir/node 31.73.5

Linked vulnerabilities (2)

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

augment-virShell allows Command Injection in `grep()` via Unsanitized `searchPattern`

CWE: CWE-78Aliases: CVE-2026-63496
CVE-2026-63496 high 7.8 EPSS 0.37% (p31) NVDCVE.orgGHSA
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

augment-virShell allows Command Injection in `grep()` via Unsanitized `searchPattern`

CWE: CWE-78Aliases: GHSA-xvcc-vqjv-phqh