Summary
Whisper-node through version 1.1.1 contains an OS command injection vulnerability in the command construction used by its whisper() function. When attacker-controlled values reach filePath or whisperOptions.language, shell metacharacters or command substitutions may cause commands to execute with the privileges of the Node.js process.
Whisper-node through version 1.1.1 contains an OS command injection vulnerability in the command construction used by its whisper() function. When attacker-controlled values reach filePath or whisperOptions.language, shell metacharacters or command substitutions may cause commands to execute with the privileges of the Node.js process.
Affected context
The vulnerability occurs in deployments using Whisper-node through 1.1.1 where values supplied to whisper() can influence the command string generated by createCppCommand(). Risk is greater when filePath or whisperOptions.language originates from untrusted requests, uploaded-file metadata, user-controlled configuration, or another attacker-influenced source, and when the resulting command is executed through a shell.
The vulnerability occurs in deployments using Whisper-node through 1.1.1 where values supplied to whisper() can influence the command string generated by createCppCommand(). Risk is greater when filePath or whisperOptions.language originates from untrusted requests, uploaded-file metadata, user-controlled configuration, or another attacker-influenced source, and when the resulting command is executed through a shell.
Exploit preconditions
- Attack surface: The
whisper()API and its command-construction path - Required access: Ability to supply or influence
filePathor
whisperOptions.language
- Trigger point: Invocation of
shelljs.exec()after
createCppCommand() builds the command string
- Why exploitation is possible: Input values are incorporated into a
shell command without sufficiently separating data from executable shell
syntax
- Attack surface: The
whisper()API and its command-construction path - Required access: Ability to supply or influence
filePathor
whisperOptions.language
- Trigger point: Invocation of
shelljs.exec()after
createCppCommand() builds the command string
- Why exploitation is possible: Input values are incorporated into a
shell command without sufficiently separating data from executable shell
syntax
Why this happens
The underlying bug is OS command injection, mapped to CWE-78. Application data is inserted into a command string and passed to a shell-executing API, allowing shell interpretation to treat attacker-controlled characters as command syntax rather than ordinary argument data. The insecure pattern is constructing commands through string concatenation or interpolation instead of invoking a target executable with a non-shell argument interface and strict input constraints.
The underlying bug is OS command injection, mapped to CWE-78. Application data is inserted into a command string and passed to a shell-executing API, allowing shell interpretation to treat attacker-controlled characters as command syntax rather than ordinary argument data. The insecure pattern is constructing commands through string concatenation or interpolation instead of invoking a target executable with a non-shell argument interface and strict input constraints.
Potential impact
- An attacker may execute arbitrary operating-system commands.
- Commands could run with the privileges of the Node.js process.
- The application host may be compromised or used for lateral movement.
- Sensitive files, credentials, or environment data could be accessed.
- Availability, integrity, or confidentiality of application data could be affected.
- An attacker may execute arbitrary operating-system commands.
- Commands could run with the privileges of the Node.js process.
- The application host may be compromised or used for lateral movement.
- Sensitive files, credentials, or environment data could be accessed.
- Availability, integrity, or confidentiality of application data could be affected.
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from the
command-execution path and reducing trust in external input.
Common defensive patterns include:
- Prefer direct process-spawn APIs with an executable and separate,
validated argument arrays rather than shell command strings.
- Avoid shell-enabled execution for values derived from users, files, or
external configuration.
- Apply allowlists and type-appropriate validation to file paths,
language identifiers, and other options.
- Resolve paths within approved directories and reject unexpected path
structures where file access is required.
- Run the Node.js process with the least privileges needed and isolate it
from sensitive host resources.
- Treat escaping as a secondary safeguard rather than a replacement for
avoiding shell interpretation.
Mitigation generally focuses on removing shell interpretation from the
command-execution path and reducing trust in external input.
Common defensive patterns include:
- Prefer direct process-spawn APIs with an executable and separate,
validated argument arrays rather than shell command strings.
- Avoid shell-enabled execution for values derived from users, files, or
external configuration.
- Apply allowlists and type-appropriate validation to file paths,
language identifiers, and other options.
- Resolve paths within approved directories and reject unexpected path
structures where file access is required.
- Run the Node.js process with the least privileges needed and isolate it
from sensitive host resources.
- Treat escaping as a secondary safeguard rather than a replacement for
avoiding shell interpretation.
How teams detect issues like this
Detection approaches can include:
- Static analysis rules for shell execution APIs such as
shelljs.exec()
when arguments include concatenated or interpolated input.
- Code review checks for command strings built from request data, file
metadata, environment values, or configuration.
- Data-flow analysis tracing
filePathandwhisperOptions.languageinto
createCppCommand() and subsequent process execution.
- Policy enforcement that bans shell execution for untrusted values and
requires direct argument-based process APIs.
- Runtime monitoring for unexpected child processes, command interpreters,
or unusual process ancestry from the Node.js service.
- Automated code-review and security-scanning tools can help identify
command construction and shell invocation patterns.
Detection approaches can include:
- Static analysis rules for shell execution APIs such as
shelljs.exec()
when arguments include concatenated or interpolated input.
- Code review checks for command strings built from request data, file
metadata, environment values, or configuration.
- Data-flow analysis tracing
filePathandwhisperOptions.languageinto
createCppCommand() and subsequent process execution.
- Policy enforcement that bans shell execution for untrusted values and
requires direct argument-based process APIs.
- Runtime monitoring for unexpected child processes, command interpreters,
or unusual process ancestry from the Node.js service.
- Automated code-review and security-scanning tools can help identify
command construction and shell invocation patterns.

