CVE Database›Document archive›CVE-2026-102925

CVE-2026-102925

virtualenv: virtualenv: Arbitrary code execution via crafted paths in activation scripts

Loading…

Severity

Important

Red Hat Product Security

7.8

CVSS 3.1

Review impact separately from score.

Published · September 30, 2026

Updated · November 2, 2026

Description

A flaw was found in virtualenv. The generated activation scripts for shells such as bash, zsh, and fish apply improper quoting to environment and library path variables. An attacker can exploit this by providing a crafted virtual environment path containing shell metacharacters. When an unsuspecting user sources the activation script, the embedded metacharacters are executed as shell commands, leading to arbitrary code execution with the privileges of that user.

Statement

An Important severity flaw was found in virtualenv, a tool for creating isolated Python virtual environments that is bundled as a dependency in a number of Red Hat products, including Red Hat OpenShift AI, Red Hat Enterprise Linux container images, Red Hat Hardened Images, and other Red Hat-delivered components. The generated activate (bash and zsh) and activate.fish scripts place path values that were already escaped by shlex.quote inside an additional quoted context. The surplus quotes can terminate the data-only quoted run, leaving shell metacharacters within a crafted value to be parsed as shell commands: in the bash and zsh scripts a crafted virtual environment path is interpolated when a relocated environment's recorded directory is absent, and in the fish script crafted Tcl or Tk library paths are interpolated into TCL_LIBRARY or TK_LIBRARY. When a user sources such an activation script, an attacker who controls the crafted path can execute arbitrary code with the privileges of that user. The flaw was rated Important (CVSS 3.1 score 7.8, AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H), consistent with the upstream severity; exploitation requires local control of the affected path values and user interaction to source the activation script. Red Hat product relationships for this flaw are DELEGATED: the impact described above applies where vulnerable virtualenv versions are bundled, fixes are being pursued through the responsible product components, and components where virtualenv is not present in the shipped artifact are being marked not affected.

CVSS score applicability

The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Mitigation

Avoid creating, copying, or distributing virtual environments whose path contains characters such as ', `, $, ;, (, or ), and inspect the generated activation script before sourcing one that you did not create; these precautions prevent shell metacharacters embedded in a crafted path from being executed when an activation script is sourced. The upstream project has released a fixed version of virtualenv, so updating to a version that includes the fix (21.7.13 or later, or a product update containing it) also addresses the issue.

CVSS / CWE

CVSS 3.1 · 7.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

CWE-94 · Improper Control of Generation of Code