Skip to content

chore(deps): update dependency virtualenv to v21 [security] - #188

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/pypi-virtualenv-vulnerability
Open

renovate[bot] wants to merge 1 commit into
masterfrom
renovate/pypi-virtualenv-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Jan 14, 2025 •

Copy link
Copy Markdown
Contributor

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
virtualenv (changelog) ==20.23.1 → ==21.7.12 age confidence

virtualenv allows command injection through activation scripts for a virtual environment

CVE-2024-53899 / GHSA-rqc4-2hc7-8c8v

More information

Details

virtualenv before 20.26.6 allows command injection through the activation scripts for a virtual environment. Magic template strings are not quoted correctly when replacing. NOTE: this is not the same as CVE-2024-9287.

Severity

  • CVSS Score: 8.4 / 10 (High)
  • Vector String: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


virtualenv Has TOCTOU Vulnerabilities in Directory Creation

CVE-2026-22702 / GHSA-597g-3phw-6986

More information

Details

Impact

TOCTOU (Time-of-Check-Time-of-Use) vulnerabilities in virtualenv allow local attackers to perform symlink-based attacks on directory creation operations. An attacker with local access can exploit a race condition between directory existence checks and creation to redirect virtualenv's app_data and lock file operations to attacker-controlled locations.

Affected versions: All versions up to and including 20.36.1

Affected users: Any user running virtualenv on multi-user systems where untrusted local users have filesystem access to shared temporary directories or where VIRTUALENV_OVERRIDE_APP_DATA points to a user-writable location.

Attack scenarios:

  • Cache poisoning: Attacker corrupts wheels or Python metadata in the cache
  • Information disclosure: Attacker reads sensitive cached data or metadata
  • Lock bypass: Attacker controls lock file semantics to cause concurrent access violations
  • Denial of service: Lock starvation preventing virtualenv operations
Patches

The vulnerability has been patched by replacing check-then-act patterns with atomic os.makedirs(..., exist_ok=True) operations.

Fixed in: PR #​3013

Versions with the fix: 20.36.2 and later

Users should upgrade to version 20.36.2 or later.

Workarounds

If you cannot upgrade immediately:

  1. Ensure VIRTUALENV_OVERRIDE_APP_DATA points to a directory owned by the current user with restricted permissions (mode 0700)
  2. Avoid running virtualenv in shared temporary directories where other users have write access
  3. Use separate user accounts for different projects to isolate app_data directories
References
  • GitHub PR: https://github.com/pypa/virtualenv/pull/3013
  • Vulnerability reported by: @​tsigouris007
  • CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization (TOCTOU)
  • CWE-59: Improper Link Resolution Before File Access

Severity

  • CVSS Score: 4.5 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


virtualenv: Downloaded seed wheels (pip/setuptools) are not integrity-checked before use

CVE-2026-102930 / GHSA-94p9-xgh2-xp45

More information

Details

download_wheel() runs pip download and hands the result straight to the seeder, with nothing checking the bytes it gets back. The embedded pip and setuptools wheels carry a BUNDLE_SHA256 that virtualenv checks on every load, but a wheel fetched over the network for the periodic-update feature or the --download flag 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/3251

Severity

  • CVSS Score: 7.7 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


virtualenv writes prompt values into pyvenv.cfg without sanitizing line boundaries, allowing configuration injection

CVE-2026-102938 / GHSA-9h9j-4vrj-gf7g

More information

Details

Summary

pyvenv.cfg is a line-based format with no escape syntax. PyEnvCfg.write() wrote values verbatim, while PyEnvCfg._read_values() parses the file with str.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 prompt value is the reachable input: it is set by --prompt, by the VIRTUALENV_PROMPT environment variable, or from the config file, and write() emits prompt before home. A crafted prompt can therefore set home in the generated pyvenv.cfg:

$ virtualenv --prompt $'x"\nhome = /attacker/path\nprompt = "z' venv
$ grep '^home' venv/pyvenv.cfg
home = /attacker/path

home is what tooling reads to locate the base interpreter, so a consumer that trusts it can be pointed elsewhere. implementation, version_info, version, executable, command and virtualenv are also written before prompt and 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+2028 and U+2029 were 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 in content.

Workarounds

Do not pass externally influenced data as the virtualenv prompt. Strip line boundaries from any value before using it as --prompt or VIRTUALENV_PROMPT.

Severity

  • CVSS Score: 5.8 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

pypa/virtualenv (virtualenv)

v21.7.12

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.11...21.7.12

v21.7.11

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.10...21.7.11

v21.7.10

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@21.7.9...21.7.10

v21.7.9

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.8...21.7.9

v21.7.8

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.7...21.7.8

v21.7.7

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.6...21.7.7

v21.7.6

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.5...21.7.6

v21.7.5

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@21.7.4...21.7.5

v21.7.4

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.3...21.7.4

v21.7.3

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@21.7.2...21.7.3

v21.7.2

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.1...21.7.2

v21.7.1

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.7.0...21.7.1

v21.7.0

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.6.1...21.7.0

v21.6.1

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.6.0...21.6.1

v21.6.0

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.5.2...21.6.0

v21.5.2

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.5.1...21.5.2

v21.5.1

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.5.0...21.5.1

v21.5.0

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.4.3...21.5.0

v21.4.3

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@21.4.2...21.4.3

v21.4.2

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.4.1...21.4.2

v21.4.1

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.4.0...21.4.1

v21.4.0

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@21.3.3...21.4.0

v21.3.3

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.3.2...21.3.3

v21.3.2

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.3.1...21.3.2

v21.3.1

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.3.0...21.3.1

v21.3.0

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@21.2.4...21.3.0

v21.2.4

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.2.3...21.2.4

v21.2.3

Compare Source

Full Changelog: pypa/virtualenv@21.2.2...21.2.3

v21.2.2

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.2.1...21.2.2

v21.2.1

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@21.2.0...21.2.1

v21.2.0

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.1.0...21.2.0

v21.1.0

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@21.0.0...21.1.0

v21.0.0

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@20.39.1...21.0.0

v20.39.1

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@20.39.0...20.39.1

v20.39.0

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@20.38.0...20.39.0

v20.38.0

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@20.37.0...20.38.0

v20.36.1

Compare Source

What's Changed

Full Changelog: pypa/virtualenv@20.36.0...20.36.1

v20.36.0

Compare Source

What's Changed

New Contributors

Full Changelog: pypa/virtualenv@20.35.3...20.36.0

v20.35.4

[Compare Source](http

❗ Important

✂ PR body was truncated to here.


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate

renovate Bot commented Jan 14, 2025

Copy link
Copy Markdown
Contributor Author

Branch automerge failure

This PR was configured for branch automerge. However, this is not possible, so it has been raised as a PR instead.


  • Branch has one or more failed status checks

@renovate
renovate Bot force-pushed the renovate/pypi-virtualenv-vulnerability branch from 37b920b to 4e30633 Compare January 13, 2026 20:43
@renovate renovate Bot changed the title chore(deps): update dependency virtualenv to v20.26.6 [security] chore(deps): update dependency virtualenv to v20.36.1 [security] Jan 13, 2026
@renovate renovate Bot changed the title chore(deps): update dependency virtualenv to v20.36.1 [security] chore(deps): update dependency virtualenv to v20.36.1 [security] - autoclosed Mar 27, 2026
@renovate renovate Bot closed this Mar 27, 2026
@renovate
renovate Bot deleted the renovate/pypi-virtualenv-vulnerability branch March 27, 2026 00:51
@renovate renovate Bot changed the title chore(deps): update dependency virtualenv to v20.36.1 [security] - autoclosed chore(deps): update dependency virtualenv to v20.36.1 [security] Mar 30, 2026
@renovate renovate Bot reopened this Mar 30, 2026
@renovate
renovate Bot force-pushed the renovate/pypi-virtualenv-vulnerability branch 2 times, most recently from 4e30633 to 9807e7c Compare March 30, 2026 21:18
@renovate renovate Bot changed the title chore(deps): update dependency virtualenv to v20.36.1 [security] chore(deps): update dependency virtualenv to v20.36.1 [security] - autoclosed Apr 27, 2026
@renovate renovate Bot closed this Apr 27, 2026
@renovate renovate Bot changed the title chore(deps): update dependency virtualenv to v20.36.1 [security] - autoclosed chore(deps): update dependency virtualenv to v20.36.1 [security] Apr 27, 2026
@renovate renovate Bot reopened this Apr 27, 2026
@renovate
renovate Bot force-pushed the renovate/pypi-virtualenv-vulnerability branch 2 times, most recently from 9807e7c to 0072927 Compare April 27, 2026 21:10
@renovate
renovate Bot force-pushed the renovate/pypi-virtualenv-vulnerability branch from 0072927 to d70104c Compare October 7, 2026 00:30
@renovate renovate Bot changed the title chore(deps): update dependency virtualenv to v20.36.1 [security] chore(deps): update dependency virtualenv to v21 [security] Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants