/

CVE-2026-25244

Severity:

CRITICAL RISK

(9.8)

Command Injection in WebdriverIO Git Metadata Helper

CVE-2026-25244

Modified

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution on CI/CD infrastructure and developer workstations

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A command injection flaw in WebdriverIO's Git metadata helper allows Git branch names to be interpolated directly into shell commands used by execSync() without sanitization.

If an attacker can supply or influence the Git repository used for smart test selection, they can craft a malicious branch name that results in remote code execution on CI/CD servers or developer machines.

Affected context

This vulnerability appears in WebdriverIO environments that:

  • Use versions prior to 9.24.0
  • Enable or rely on test orchestration with smart selection (testOrchestrationOptions.runSmartSelection)
  • Invoke getGitMetadataForAISelection() to collect Git-related metadata
  • Run tests in Git repositories where branch names may contain shell metacharacters

The risk is especially relevant for shared CI/CD workers, ephemeral build agents, or developer machines that execute WebdriverIO commands against repositories cloned from semi-trusted or untrusted sources.

Exploit preconditions

  • Attack surface: WebdriverIO test runs that call into getGitMetadataForAISelection() as part of test orchestration, typically in CI/CD pipelines or local dev workflows.
  • Required access:
  • Ability to provide or control the Git repository used for smart selection, either via:
  • testOrchestrationOptions.runSmartSelection.source pointing to an attacker-controlled repository, or
  • The current working directory being a repository the attacker can influence (e.g., via a compromised or malicious project clone).
  • Ability to create or select a Git branch whose name contains shell metacharacters and payload.
  • Trigger point: Execution of WebdriverIO's Git metadata retrieval logic, which builds a shell command with the branch name and passes it to execSync() without proper escaping or validation.
  • Why exploitation is possible: Branch names are treated as trusted input and directly interpolated into shell commands, enabling arbitrary command execution when the shell parses metacharacters contained in the branch name.

Why this happens

The underlying issue is a classic shell command injection pattern, mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

WebdriverIO's getGitMetadataForAISelection() collects Git metadata by constructing shell commands that include the current branch name. Git itself permits branch names with spaces and shell metacharacters. Instead of treating the branch name as untrusted data, the implementation interpolates it directly into a command string passed to execSync(), relying on the system shell for execution. Because there is no escaping, quoting, or validation of these values, any embedded shell syntax in the branch name is interpreted as part of the command, allowing arbitrary OS-level commands to be injected and executed within the test runner's process.

Potential impact

  • Remote code execution on CI/CD servers running WebdriverIO-based test suites
  • Remote code execution on developer machines executing tests against compromised repositories
  • Theft of environment credentials, API tokens, and other secrets from build environments
  • Exfiltration of source code, SSH keys, and configuration from affected hosts
  • Tampering with build artifacts, leading to downstream supply chain compromise
  • Persistence or lateral movement within the CI/CD or developer infrastructure

General mitigation guidance

Mitigation centers on eliminating command construction patterns that treat user- or environment-controlled strings as shell syntax:

  • Prefer API-based Git access (e.g., library calls) over spawning shell commands, especially when including branch names, tags, or commit messages.
  • When OS commands are unavoidable, use argument-vector execution (e.g., execFile/spawn with an array) rather than passing a single command string to a shell.
  • Apply strict input neutralization to any value that can be influenced by repository state:
  • Reject or safely encode branch names containing shell metacharacters where they must be used in commands.
  • Normalize or whitelist expected patterns for branch names in orchestration logic.
  • Run test orchestration under least-privilege accounts and with minimal environment secrets to reduce blast radius if command injection occurs.
  • Isolate CI/CD jobs (containerization, ephemeral runners, restricted network access) so that compromise of one job does not easily lead to broader system access.
  • Incorporate defensive defaults in configuration: disable or constrain features that automatically consume repository metadata in high-risk contexts unless they are strictly needed and properly hardened.

How teams detect issues like this

Potential detection and assessment techniques include:

  • Static analysis:
  • Scan for uses of execSync, exec, or equivalent APIs where arguments are assembled via string concatenation or template literals that include variables derived from Git metadata (branch names, tags, commit messages).
  • Flag patterns where repository-derived values are passed to shell commands without explicit escaping or validation.
  • Code review cues:
  • Look for utility functions that wrap Git commands and accept dynamic input from configuration or runtime repository state.
  • Pay special attention to new orchestration, AI-selection, or metadata-gathering features that tie into CI/CD pipelines.
  • Policy and tooling:
  • Enforce development guidelines that prohibit direct shell invocation with untrusted data and require safer alternatives.
  • Integrate automated code review tools or linters with rules around command execution APIs and user-controlled inputs.
  • Runtime monitoring:
  • Enable logging of unusual or unexpected shell commands launched during CI/CD runs.
  • Monitor for test jobs invoking commands that do not align with standard WebdriverIO test execution patterns.

Sources

SourceLink
github.comgithub.com/webdriverio/webdriverio/blob/ea0e3e00288abced4c739ff9e46c46977b7cdbd2/packages/wdio-browserstack-service/src/testorchestration/helpers.ts#L204
github.comgithub.com/webdriverio/webdriverio/releases/tag/v9.24.0
github.comgithub.com/webdriverio/webdriverio/security/advisories/GHSA-5c46-x3qw-q7j7
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-25244
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2479692
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-25244.json

Frequently asked

questions

Yes, in many setups. If an attacker can convince a CI/CD system or developer to run WebdriverIO tests against an attacker-controlled repository (or a compromised fork), they can trigger remote code execution through a malicious branch name without needing direct shell access.

The attacker must be able to influence the Git repository used by WebdriverIO test orchestration. This could happen by providing a malicious repository path in testOrchestrationOptions.runSmartSelection.source, compromising an existing repository, or getting a developer or pipeline to clone and test a repository under the attacker's control.

Replace shell-based Git invocations that interpolate branch names or other repository data with library-based calls or command execution APIs that accept argument arrays. Ensure all repository-derived values are treated as untrusted input, validated, and never concatenated directly into shell command strings.

Establish secure coding standards that forbid building shell commands from untrusted input, require the use of safe process execution primitives, and mandate security review for any new functionality that interacts with version control metadata or CI/CD orchestration. Combine these standards with automated static analysis and code review practices to catch unsafe patterns early.

Find out what's already
exploitable in your codebase.