Repository navigation
fix(deps): update dependency virtualenv to v21 [security] - #509
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/pypi-virtualenv-vulnerability
branch
from
October 6, 2026 17:07
05b5790 to
7f80ab3
Compare
renovate
Bot
force-pushed
the
renovate/pypi-virtualenv-vulnerability
branch
from
October 7, 2026 21:33
7f80ab3 to
4f825a4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==20.39.1→==21.7.13virtualenv writes prompt values into pyvenv.cfg without sanitizing line boundaries, allowing configuration injection
BIT-virtualenv-2026-102938 / CVE-2026-102938 / GHSA-9h9j-4vrj-gf7g / PYSEC-2026-4012
More information
Details
Summary
pyvenv.cfgis a line-based format with no escape syntax.PyEnvCfg.write()wrote values verbatim, whilePyEnvCfg._read_values()parses the file withstr.splitlines(). A value containing a line boundary therefore became additional configuration lines, and because reading is last-wins, the injected keys replaced any key written earlier in the file.Impact
The
promptvalue is the reachable input: it is set by--prompt, by theVIRTUALENV_PROMPTenvironment variable, or from the config file, andwrite()emitspromptbeforehome. A crafted prompt can therefore sethomein the generatedpyvenv.cfg:homeis what tooling reads to locate the base interpreter, so a consumer that trusts it can be pointed elsewhere.implementation,version_info,version,executable,commandandvirtualenvare also written beforepromptand can be replaced the same way.This requires the prompt to come from somewhere other than the person running the command, for example a CI job templating a branch name into it, tooling deriving an environment name from user-supplied data, or an inherited
VIRTUALENV_PROMPT. Where the operator supplies the prompt directly they already control the command line, and the effect is corruption rather than privilege gain: the value is truncated at the boundary and read back with a dangling quote.Details
The boundary set is the one
str.splitlines()recognizes, which is wider than\n:\r,\v,\f, the file, group and record separators,U+0085,U+2028andU+2029were all written through unchanged and all split the line when read back.Patches
PyEnvCfg.write()now collapses those boundaries to spaces as it serializes each line, so it cannot emit a structurally invalid file regardless of what a caller places incontent.Workarounds
Do not pass externally influenced data as the virtualenv prompt. Strip line boundaries from any value before using it as
--promptorVIRTUALENV_PROMPT.Severity
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
virtualenv writes prompt values into pyvenv.cfg without sanitizing line boundaries, allowing configuration injection
BIT-virtualenv-2026-102938 / CVE-2026-102938 / GHSA-9h9j-4vrj-gf7g / PYSEC-2026-4012
More information
Details
pyvenv.cfgis a line-based format with no escape syntax.PyEnvCfg.write()wrote values verbatim, while
PyEnvCfg._read_values()parses the file withstr.splitlines(). A value containing a line boundary therefore becameadditional configuration lines, and because reading is last-wins, the injected
keys replaced any key written earlier in the file.
The
promptvalue is the reachable input: it is set by--prompt, by theVIRTUALENV_PROMPTenvironment variable, or from the config file, andwrite()emitspromptbeforehome. A crafted prompt can therefore sethomein the generatedpyvenv.cfg.homeis what tooling reads to locatethe base interpreter, so a consumer that trusts it can be pointed elsewhere.
implementation,version_info,version,executable,commandandvirtualenvare also written beforepromptand can be replaced the sameway.
This requires the prompt to come from somewhere other than the person running
the command, for example a CI job templating a branch name into it, tooling
deriving an environment name from user-supplied data, or an inherited
VIRTUALENV_PROMPT.The boundary set is the one
str.splitlines()recognizes, which is wider than\n:\r,\v,\f, the file, group and record separators,U+0085,U+2028andU+2029were all written through unchanged and all split theline when read back.
Fixed in 21.7.11:
PyEnvCfg.write()now collapses those boundaries to spacesas it serializes each line, so it cannot emit a structurally invalid file
regardless of what a caller places in
content.Severity
Unknown
References
This data is provided by OSV and the PyPI Advisory Database (CC-BY 4.0).
virtualenv: Downloaded seed wheels (pip/setuptools) are not integrity-checked before use
BIT-virtualenv-2026-102930 / CVE-2026-102930 / GHSA-94p9-xgh2-xp45 / PYSEC-2026-4011
More information
Details
download_wheel()runspip downloadand hands the result straight to the seeder, with nothing checking the bytes it gets back. The embedded pip and setuptools wheels carry aBUNDLE_SHA256that virtualenv checks on every load, but a wheel fetched over the network for the periodic-update feature or the--downloadflag had no equivalent verification.A compromised index, a stale mirror, or a MITM'd download (when TLS is intercepted, e.g. via a misconfigured or malicious CA) could substitute a different wheel under the same distribution/version/filename, and virtualenv would cache and seed it into every environment created afterward with no warning.
Fixed by computing the downloaded wheel's sha256 and comparing it against the digest PyPI's public JSON API reports for that exact release, independent of which index actually served the file. The check is skipped, not treated as failure, when a custom index (
PIP_INDEX_URL,PIP_EXTRA_INDEX_URL,PIP_INDEX) is configured, since a private index can legitimately serve a different, intentionally rebuilt wheel. Fix: https://github.com/pypa/virtualenv/pull/3251Severity
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
virtualenv: Command injection via --prompt in activate.bat (batch activator)
BIT-virtualenv-2026-102937 / CVE-2026-102937 / GHSA-x78j-v8h9-3j2q / PYSEC-2026-4014
More information
Details
BatchActivator.quote()returned its input unchanged, the only activator with no escaping at all.--prompt, theVIRTUALENV_PROMPTenvironment variable, and the config file all set the prompt, andactivate.batwrites it straight into@set "VAR=value". A prompt containing a double quote closes that string early, and whatever follows runs as live cmd.exe syntax:runs
calcthe moment someone activates the environment. Confirmed on a real Windows runner. Anyone who templates a prompt from untrusted input (a CI job using a branch name, a wrapper script deriving an environment name from user input) hands an attacker code execution in the shell of anyone who activates the resulting venv on Windows.Fixed in 21.7.12 by escaping the characters cmd.exe treats as live syntax inside this construct. Fix: https://github.com/pypa/virtualenv/pull/3250
Severity
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Downloaded seed wheels (pip/setuptools) are not integrity-checked before use
BIT-virtualenv-2026-102930 / CVE-2026-102930 / GHSA-94p9-xgh2-xp45 / PYSEC-2026-4011
More information
Details
download_wheel()runspip downloadand hands the result straight to theseeder, with nothing checking the bytes it gets back. The embedded pip and
setuptools wheels carry a
BUNDLE_SHA256that virtualenv checks on every load,but a wheel fetched over the network for the periodic-update feature or the
--downloadflag had no equivalent verification.A compromised index, a stale mirror, or a MITM'd download (when TLS is
intercepted, e.g. via a misconfigured or malicious CA) could substitute a
different wheel under the same distribution/version/filename, and virtualenv
would cache and seed it into every environment created afterward with no
warning.
Fixed in 21.7.12 by computing the downloaded wheel's sha256 and comparing it
against the digest PyPI's public JSON API reports for that exact release,
independent of which index actually served the file. The check is skipped, not
treated as failure, when a custom index (
PIP_INDEX_URL,PIP_EXTRA_INDEX_URL,PIP_INDEX) is configured, since a private index canlegitimately serve a different, intentionally rebuilt wheel.
Severity
Unknown
References
This data is provided by OSV and the PyPI Advisory Database (CC-BY 4.0).
Command injection via --prompt in activate.bat (batch activator)
BIT-virtualenv-2026-102937 / CVE-2026-102937 / GHSA-x78j-v8h9-3j2q / PYSEC-2026-4014
More information
Details
BatchActivator.quote()returned its input unchanged, the only activator withno escaping at all.
--prompt, theVIRTUALENV_PROMPTenvironment variable,and the config file all set the prompt, and
activate.batwrites it straightinto
@set "VAR=value". A prompt containing a double quote closes that stringearly, and whatever follows runs as live cmd.exe syntax. For example, a venv
created with
--prompt 'x" & calc & "'runscalcthe moment someone runsactivate.bat.Anyone who templates a prompt from untrusted input (a CI job using a branch
name, a wrapper script deriving an environment name from user input) hands an
attacker code execution in the shell of anyone who activates the resulting venv
on Windows.
Fixed in 21.7.12 by escaping the characters cmd.exe treats as live syntax
inside this construct.
Severity
Unknown
References
This data is provided by OSV and the PyPI Advisory Database (CC-BY 4.0).
virtualenv bash and fish activation scripts execute commands embedded in paths
BIT-virtualenv-2026-102925 / CVE-2026-102925 / GHSA-p58f-9548-mpm2 / PYSEC-2026-4013
More information
Details
Impact
The generated
activate(bash/zsh) andactivate.fishscripts interpolate ashlex.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.activateis affected through the virtual environment's own path, on the branch that reports a relocated environment:For a destination named
x'$(id)'y,shlex.quoteemits'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.fishis affected through the interpreter's Tcl/Tk library paths:shlex.quotealready 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, corruptingTCL_LIBRARYandTK_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.quoteapplied. Fix: https://github.com/pypa/virtualenv/pull/3252Workarounds
Avoid creating or distributing virtual environments whose path contains
',`,$,;,(or), and inspect the generated activation script before sourcing one you did not create.Severity
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
virtualenv bash and fish activation scripts execute commands embedded in paths
BIT-virtualenv-2026-102925 / CVE-2026-102925 / GHSA-p58f-9548-mpm2 / PYSEC-2026-4013
More information
Details
The generated
activate(bash/zsh) andactivate.fishscripts interpolate ashlex.quote-ed value into a position that quotes it a second time. The extraquotes 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.
activateis affected through the virtual environment's own path, on the branchthat reports a relocated environment (
Virtual environment directory __VIRTUAL_ENV__ does not exist!). For a destination namedx'$(id)'y,shlex.quoteemits'x'"'"'$(id)'"'"'y'; the inner"closes the enclosingdouble quote and
$(id)is left unquoted. This branch runs whenever therecorded path is absent, which is the normal case for a virtual environment
copied or distributed to another machine.
activate.fishis affected through the interpreter's Tcl/Tk library paths(
set -gx TCL_LIBRARY '__TCL_LIBRARY__'). The rendered line becomes''/tcl/(cmd)/lib'', and fish expands the(cmd)left between the adjacentquoted runs. The same doubling splits a path containing a space into two list
elements, corrupting
TCL_LIBRARYandTK_LIBRARY.This is the same defect class as GHSA-x78j-v8h9-3j2q, which covered
activate.bat.Fixed in 21.7.13 by moving the placeholders outside the surrounding quotes, so
each value keeps only the quoting
shlex.quoteapplied.Severity
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HReferences
This data is provided by OSV and the PyPI Advisory Database (CC-BY 4.0).
Release Notes
pypa/virtualenv (virtualenv)
v21.7.13Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.12...21.7.13
v21.7.12Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.11...21.7.12
v21.7.11Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.10...21.7.11
v21.7.10Compare Source
What's Changed
New Contributors
Full Changelog: pypa/virtualenv@21.7.9...21.7.10
v21.7.9Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.8...21.7.9
v21.7.8Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.7...21.7.8
v21.7.7Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.6...21.7.7
v21.7.6Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.5...21.7.6
v21.7.5Compare Source
What's Changed
New Contributors
Full Changelog: pypa/virtualenv@21.7.4...21.7.5
v21.7.4Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.3...21.7.4
v21.7.3Compare Source
What's Changed
New Contributors
Full Changelog: pypa/virtualenv@21.7.2...21.7.3
v21.7.2Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.1...21.7.2
v21.7.1Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.7.0...21.7.1
v21.7.0Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.6.1...21.7.0
v21.6.1Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.6.0...21.6.1
v21.6.0Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.5.2...21.6.0
v21.5.2Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.5.1...21.5.2
v21.5.1Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.5.0...21.5.1
v21.5.0Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.4.3...21.5.0
v21.4.3Compare Source
What's Changed
New Contributors
Full Changelog: pypa/virtualenv@21.4.2...21.4.3
v21.4.2Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.4.1...21.4.2
v21.4.1Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.4.0...21.4.1
v21.4.0Compare Source
What's Changed
New Contributors
Full Changelog: pypa/virtualenv@21.3.3...21.4.0
v21.3.3Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.3.2...21.3.3
v21.3.2Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.3.1...21.3.2
v21.3.1Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.3.0...21.3.1
v21.3.0Compare Source
What's Changed
New Contributors
Full Changelog: pypa/virtualenv@21.2.4...21.3.0
v21.2.4Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.2.3...21.2.4
v21.2.3Compare Source
Full Changelog: pypa/virtualenv@21.2.2...21.2.3
v21.2.2Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.2.1...21.2.2
v21.2.1Compare Source
What's Changed
New Contributors
Full Changelog: pypa/virtualenv@21.2.0...21.2.1
v21.2.0Compare Source
What's Changed
Full Changelog: pypa/virtualenv@21.1.0...21.2.0
v21.1.0Compare Source
If you want to rebase/retry this PR, check this boxThis PR was generated by Mend Renovate. View the repository job log.