All vulnerabilities
CVE-2026-102925BIT-virtualenv-2026-102925GHSA-p58f-9548-mpm2PYSEC-2026-4013

virtualenv bash and fish activation scripts execute commands embedded in paths

pypa virtualenvpipLibraries & packages
CVSS
7.8High
ExploitationNo known exploitationNot in CISA KEV, which does not prove it is unexploitedCISA KEV
Exploit odds (EPSS)0.15%Chance of exploitation activity in the next 30 days, higher than 4% of CVEs. Scored 23 Oct 2026FIRST EPSS
Fixed in21.7.13Fixed versionGitHub
Published29 Sep 2026Updated 6 Oct 2026CVE List

What fixes it

  • 21.7.13virtualenv, pipGitHub
  • 21.7.13virtualenv, PyPIOSVpip install "virtualenv>=21.7.13"

A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.

Description

Impact

The generated activate (bash/zsh) and activate.fish scripts interpolate a shlex.quote-ed value into a position that quotes it a second time. The extra quotes terminate the quoted run early and leave part of the value parsed as shell code, so a path containing shell metacharacters runs commands when a user sources the activation script.

activate is affected through the virtual environment's own path, on the branch that reports a relocated environment:

echo "Virtual environment directory __VIRTUAL_ENV__ does not exist!" >&2

For a destination named x'$(id)'y, shlex.quote emits 'x'"'"'$(id)'"'"'y'. The inner " closes the enclosing double quote and $(id) is left unquoted. Backtick and ; payloads reach the same result. This branch runs whenever the recorded path is absent, which is the normal case for a virtual environment copied or distributed to another machine.

activate.fish is affected through the interpreter's Tcl/Tk library paths:

set -gx TCL_LIBRARY '__TCL_LIBRARY__'

shlex.quote already returns '/tcl/(cmd)/lib', so the rendered line is ''/tcl/(cmd)/lib''. fish concatenates the adjacent quoted runs and expands the (cmd) left between them. The same doubling also splits a path containing a space into two list elements, corrupting TCL_LIBRARY and TK_LIBRARY.

This is the same defect class as GHSA-x78j-v8h9-3j2q, which covered activate.bat.

Patches

Fixed in 21.7.13 by moving the placeholders outside the surrounding quotes, so each value keeps only the quoting shlex.quote applied. Fix: https://github.com/pypa/virtualenv/pull/3252

Workarounds

Avoid creating or distributing virtual environments whose path contains ', ` `, $, ;, ( or )`, and inspect the generated activation script before sourcing one you did not create.

Text from GitHub Advisory Database

Affected versions 53

  • virtualenv, pip<= 21.7.12GitHub
  • virtualenvaffected: < 21.7.13CVE List
  • virtualenv, PyPIfrom first release, fixed in 21.7.13OSV
  • virtualenv, PyPI0.8OSV
  • virtualenv, PyPI0.8.1OSV
  • virtualenv, PyPI0.8.2OSV
  • virtualenv, PyPI0.8.3OSV
  • virtualenv, PyPI0.8.4OSV
  • virtualenv, PyPI0.9OSV
  • virtualenv, PyPI0.9.1OSV
  • virtualenv, PyPI0.9.2OSV
  • virtualenv, PyPI1.0OSV
  • virtualenv, PyPI1.1OSV
  • virtualenv, PyPI1.10OSV
  • virtualenv, PyPI1.10.1OSV
  • virtualenv, PyPI1.11OSV
  • virtualenv, PyPI1.11.1OSV
  • virtualenv, PyPI1.11.2OSV
  • virtualenv, PyPI1.11.3OSV
  • virtualenv, PyPI1.11.4OSV
  • virtualenv, PyPI1.11.5OSV
  • virtualenv, PyPI1.11.6OSV
  • virtualenv, PyPI1.2OSV
  • virtualenv, PyPI1.3OSV
  • virtualenv, PyPI1.3.1OSV
  • virtualenv, PyPI1.3.2OSV
  • virtualenv, PyPI1.3.3OSV
  • virtualenv, PyPI1.3.4OSV
  • virtualenv, PyPI1.4OSV
  • virtualenv, PyPI1.4.1OSV
  • virtualenv, PyPI1.4.2OSV
  • virtualenv, PyPI1.4.3OSV
  • virtualenv, PyPI1.4.4OSV
  • virtualenv, PyPI1.4.5OSV
  • virtualenv, PyPI1.4.6OSV
  • virtualenv, PyPI1.4.7OSV
  • virtualenv, PyPI1.4.8OSV
  • virtualenv, PyPI1.4.9OSV
  • virtualenv, PyPI1.4rc1OSV
  • virtualenv, PyPI1.5OSV
  • virtualenv, PyPI1.5.1OSV
  • virtualenv, PyPI1.5.2OSV
  • virtualenv, PyPI1.6OSV
  • virtualenv, PyPI1.6.1OSV
  • virtualenv, PyPI1.6.2OSV
  • virtualenv, PyPI1.6.3OSV
  • virtualenv, PyPI1.6.4OSV
  • virtualenv, PyPI1.7OSV
  • virtualenv, PyPI1.7.1OSV
  • virtualenv, PyPI1.7.1.1OSV
  • virtualenv, PyPI1.7.1.2OSV
  • virtualenv, PyPI1.7.2OSV
  • virtualenv, PyPI1.8OSV

References 9