augment-virのgrep()に、シェルコマンドを注入される脆弱性
Summary
augment-virの31.73.5より前のバージョンでは、@augment-vir/nodeのgrep()に渡す検索パターンが無害化されず、細工された入力でOSコマンドを実行される可能性があります。影響は実行中のNode.jsプロセスの権限に及び、未認証で悪用されるおそれがあります。修正版の31.73.5に更新してください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
augment-virの31.73.5より前のバージョンでは、@augment-vir/nodeのgrep()に渡す検索パターンが無害化されず、細工された入力でOSコマンドを実行される可能性があります。影響は実行中のNode.jsプロセスの権限に及び、未認証で悪用されるおそれがあります。修正版の31.73.5に更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| electroviraugment-vir | — | Not listed |
| npm@augment-vir/node |
< 31.73.5→ 31.73.5 |
31.73.5 |
Original description The description as published by the source.
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:
// 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:
// 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…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- package github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com