Summary
Rsbuild before 2.0.9 contains a command injection vulnerability in the macOS browser-opening workflow. A crafted URL supplied through the server.open configuration may cause arbitrary operating system commands to run when the URL is incorporated into a shell command.
Affected context
The vulnerability occurs in Rsbuild's openBrowser() functionality on macOS when the server.open configuration causes a URL to be passed to a shell command. The risk is present when attacker-influenced URL content reaches this workflow and shell metacharacters remain active after URL encoding.
Exploit preconditions
- Attack surface: Rsbuild's development server browser-opening functionality on macOS
- Required access: Ability to influence the URL or configuration value consumed by
server.open - Trigger point: Browser-opening logic that passes the URL to
child_process.exec() - Why exploitation is possible: The URL is interpolated into a shell command, while
encodeURI()does not neutralize all shell metacharacters
Why this happens
The underlying bug is the construction of a shell command by interpolating externally influenced URL data and executing it through child_process.exec(). URL encoding is not a substitute for shell escaping because some characters that retain shell semantics are not encoded by encodeURI(). This represents CWE-78: Improper Neutralization of Special Elements used in an OS Command, in which data is interpreted as command syntax by a shell.
Potential impact
- An attacker may execute arbitrary operating system commands in the Rsbuild process context.
- The attacker could access, modify, or delete files available to the development process.
- Credentials, source code, or environment data may be exposed.
- A compromised development environment could be used for lateral movement or supply-chain tampering.
General mitigation guidance
Mitigation generally focuses on avoiding shell interpretation of untrusted values.
Common defensive patterns include:
- Prefer direct process-spawn APIs with argument arrays over shell-based command execution.
- Avoid interpolating URL or configuration data into command strings.
- Apply strict allowlisting to browser targets, URL schemes, hosts, and permitted characters.
- Treat development-server configuration and generated URLs as untrusted at trust-boundary crossings.
- Run development tooling with least privilege and limit access to sensitive files and environment credentials.
- Use platform-specific browser-launch abstractions that do not require shell evaluation.
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis rules for
child_process.exec()and other shell-spawning APIs receiving concatenated or interpolated input. - Code review checks for URL, configuration, or request data flowing into command strings.
- Dependency and source scanning policies that flag shell execution in development-server tooling.
- Tests using metacharacter-bearing inputs to verify that values remain data rather than command syntax.
- Automated code review tools that detect missing argument separation, incomplete escaping, or unsafe shell options.

