VulnWatch by ve1ve2
medium 4.5 EPSS 0.20%

GHSA-hhxq-47xx-j5xx: virtualenv: Seed replacement does not contain metadata deletion paths

Source:
OSV.dev
Published:
Fetched:
Updated:
Affects:
virtualenv

https://osv.dev/vulnerability/GHSA-hhxq-47xx-j5xx ↗

osvpypifix-available

virtualenv: Seed replacement does not contain metadata deletion paths ## Summary The app-data seeder joins paths from existing distribution metadata to site-packages and deletes the resulting paths without checking containment within the environment. Anthropic's OSS Scanner reported this as `ANT-2026-SXOEHWP7` in `virtualenv-20261015-005`, received on 15 October 2026. ## Affected area Removal of a previously installed seed package. ## Attacker-controlled input An environment being reused must contain distribution metadata influenced by another account. The invoking user must have deletion rights over the paths named by that metadata. Installing a new environment without existing package metadata does not enter this cleanup path. ## Affected code The relevant 21.14.8 source is in [seed uninstall](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/seed/embed/via_app_data/pip_install/base.py). ## Mechanism Before reinstalling a seed wheel, `PipInstall._uninstall_previous_version()` accepts an existing `pip-*.dist-info` directory in the destination. `_uninstall_dist()` reads its `top_level.txt` and `RECORD`, joins each entry to `site-packages`, and deletes the result. It does not check whether `..`, an absolute entry, or a linked parent takes the path outside the environment. The default app-data seeder reaches this path when it reuses a tree containing seed-package metadata; `--clear` removes that tree first. ## Reproduction and evidence The scanner prepared a project with `.venv/lib/python3.14/site-packages/pip-1.0.dist-info/`. Its `top_level.txt` contained `../../../../../Documents`; its `RECORD` named `../../../../../notes.txt,,`. The user's home initially held `Documents/thesis/chapter1.txt` and `notes.txt`. Running `virtualenv .venv` exited successfully but removed both paths. A control tree with `top_level.txt` set to `pip` and a normal `pip/__init__.py` RECORD entry left the home files in place. The reproducer prints `BUG` only when the control files survive and both attack targets disappear. The deletion uses the invoking user's permissions and runs during creation, before any use of the environment. It requires an existing destination that another account could populate; a fresh empty environment does not supply hostile metadata. The report traces this cleanup to #2186, first released in 20.8.1. [PR #3428](https://github.com/pypa/virtualenv/pull/3428) checks each deletion path against the resolved environment root and refuses to delete the root itself. ## Attack sequence ```mermaid sequenceDiagram participant A as Prepared .venv metadata participant V as App-data seeder participant P as site-packages participant H as User home A->>P: top_level.txt names ../../../../../Documents A->>P: RECORD names ../../../../../notes.txt V->>P: read pip-1.0.dist-info before reinstall P->>H: join entries without containment check V->>H: remove Documents and notes.txt V-->>A: virtualenv exits successfully ``` ## Reproducer file Affected: PyPI:virtualenv Fixed in: 21.14.9 References: https://github.com/pypa/virtualenv/security/advisories/GHSA-hhxq-47xx-j5xx https://nvd.nist.gov/vuln/detail/CVE-2026-113719 https://github.com/pypa/virtualenv/pull/3428 https://github.com/pypa/virtualenv/commit/e3cea6fa10a50fa29cf1fdddd772458fba076d5f https://github.com/pypa/virtualenv https://github.com/pypa/virtualenv/releases/tag/21.14.9

Linked vulnerabilities (2)

CVE-2026-113719 medium 4.5 EPSS 0.20% (p9) NVDCVE.orgGHSA
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L

virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, PipInstall._uninstall_previous_version() accepts existing seed-package metadata and _uninstall_dist() joins entries from top_level.txt and RECORD to site-packages without checking containment. When a reused destination contains distribution metadata influenced by another account, relative traversal, absolute entries, or linked parents can cause app-data reseeding to delete files outside the environment or the environment root with the invoking user's permissions, provided that user has deletion rights...

CWE: CWE-22Aliases: GHSA-hhxq-47xx-j5xxNVD: Analyzed
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L

virtualenv: Seed replacement does not contain metadata deletion paths

CWE: CWE-22Aliases: CVE-2026-113719