GHSA-xvcc-vqjv-phqh: augment-vir: Shell Command Injection in `grep()` via Unsanitized `searchPattern`
augment-vir is a collection of helper functions. Prior to version 31.73.5, 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. This issue has been patched in version 31.73.5.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
@augment-vir/nodeto a version that resolves this vulnerability.Fixed in 31.73.5
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Downstream applications are exposed if they pass untrusted input into the grep() function's pattern or patterns field. The impact is local code execution and may be remote if an attacker can control that input remotely.
What does an attacker need to exploit it?
The attacker needs control of a search pattern that reaches grep(). No privileges are required, but the supplied vector indicates user interaction is required.
How can I determine whether my application is affected?
Check whether it uses @augment-vir/node versions earlier than 31.73.5 and whether untrusted data can flow to grep() through pattern or patterns. Such input can contain bash command substitution expressions that are evaluated when the command is run.
What should be done if an immediate upgrade is not possible?
Prevent untrusted input from reaching grep()'s pattern and patterns fields until the dependency can be updated. The issue is patched in version 31.73.5.