Summary
The grep() helper in @augment-vir/node can pass caller-controlled search patterns into a Bash command without sanitizing them. If an application supplies untrusted input as a pattern, shell command substitution may execute commands with the Node.js process's privileges.
Affected context
The issue occurs in applications that use the affected @augment-vir/node grep() helper and pass caller-controlled values as its pattern or patterns field. Risk depends on whether untrusted users can influence those values and cause the helper to run a command through Bash.
Exploit preconditions
- Attack surface: Any application path that calls the helper with an attacker-influenced pattern
- Required access: The ability to supply or affect that pattern; authentication requirements depend on the downstream application's interface
- Trigger point: The application invokes
grep()and the constructed command is passed to Bash - Why exploitation is possible: Pattern data is inserted into a shell command string, where Bash can interpret command substitutions
Why this happens
The helper places caller-controlled pattern data inside a double-quoted shell command and runs it with Bash. Shell metacharacters and command substitutions in that data can therefore be interpreted rather than treated as literal search input. This is CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly known as OS command injection.
Potential impact
- An attacker may execute operating-system commands as the Node.js process user.
- The attacker could access or alter data available to that process.
- A compromised process may be used to affect other services or systems, depending on its permissions and environment.
General mitigation guidance
Defensive patterns focus on avoiding shell interpretation and limiting the trust placed in search patterns:
- Prefer process APIs that pass executable arguments directly without invoking a shell.
- Avoid assembling commands by concatenating or interpolating caller-controlled data.
- Treat search patterns as untrusted input and apply narrowly defined validation appropriate to the intended pattern syntax.
- Run the application with least privilege and restrict its access to sensitive files and services.
How teams detect issues like this
Look for shell-enabled process execution where command strings include variables, function parameters, or other externally influenced values. Code review and static analysis can flag shell invocation, command construction, and data flows from request or configuration inputs into process APIs. Policy checks can require argument-based process execution without a shell for operations that accept untrusted input.

