{"vuln_id":"GHSA-cw65-gx24-rc82","aliases":["CVE-2026-113716"],"description":"virtualenv: Builtin creation follows linked environment directories","published_at":"2026-10-20T20:17:17.850000Z","modified_at":"2026-11-18T12:11:04.388986Z","first_seen_at":"2026-11-21T19:15:47.055276Z","severity":"medium","severity_source":"native","cvss_score":4.5,"cvss_vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L","cwe":["CWE-59"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-cw65-gx24-rc82"},"matched_alias":null,"items":[{"id":10743,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-cw65-gx24-rc82: virtualenv: Builtin creation follows linked environment directories","summary":"virtualenv: Builtin creation follows linked environment directories\n\n## Summary\n\nThe builtin creator accepts existing directory symlinks through ensure_dir() and writes environment files through those\ndirectories. This permits writes outside the requested destination.\n\nAnthropic's OSS Scanner reported this as `ANT-2026-MUFJEG11` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDirectory preparation before environment files are created.\n\n## Attacker-controlled input\n\nAnother account must be able to prepare linked entries below the chosen destination before creation. The invoking user\nmust have access to the linked destination. This does not require write access to the target itself under the other\naccount.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[builtin creator](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/create/via_global_ref/builtin/via_global_self_do.py),\n[ensure_dir()](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/util/path/_sync.py).\n\n## Mechanism\n\nThe builtin creator calls `ensure_dir()` for `bin`, `lib`, and package directories. `ensure_dir()` accepts an existing\nsymlink to a directory because `exists()` follows it. Interpreter creation, seed installation, and activation-script\ngeneration then write through that parent link. A final-file check cannot prevent a write through a linked parent.\n`--clear` removes the planted tree first; ordinary creation over a prepared destination reaches it.\n\n## Reproduction and evidence\n\nThe scanner's project tree contains `venv/bin -> ../../.local/bin` and a `.pth` file in the environment's package tree.\nWith the user's initially empty `~/.local/bin` first on `PATH`, `virtualenv venv` exited successfully and wrote\n`python*`, `pip*`, and `activate*` into `~/.local/bin`. The marker was absent immediately after creation; a later\n`pip --version` on the user's `PATH` loaded the seeded environment and the planted `.pth` code wrote the marker. A\nsecond case began with the `bin` link resolving inside the environment; replacement of a planted package link during\nseeding changed where it resolved, and writes again reached `~/.local/bin`.\n\nThe attacker must prepare entries in an existing destination. The `.pth` content is already attacker-controlled and\nwould run if the user used that environment directly; the added effect is creation-time writing or replacement outside\nthe requested tree and an executable on the user's `PATH` pointing at it. The scanner traces this default builtin path\nto 20.0.0b1. [PR #3429](https://github.com/pypa/virtualenv/pull/3429) replaces linked directory components before\ncreation. Concurrent parent replacement remains a separate case.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n    participant A as Prepared destination\n    participant V as Builtin creator\n    participant L as venv/bin symlink\n    participant H as ~/.local/bin\n    participant U as User\n    A->>L: point to ../../.local/bin\n    V->>L: ensure_dir acc\n\nAffected: PyPI:virtualenv\n\nFixed in: 21.14.9\n\nReferences:\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-cw65-gx24-rc82\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-113716\nhttps://github.com/pypa/virtualenv/pull/3429\nhttps://github.com/pypa/virtualenv/commit/554d9f9d4f7758f5cf53f993031e29787f1f74c5\nhttps://github.com/pypa/virtualenv\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.9","url":"https://osv.dev/vulnerability/GHSA-cw65-gx24-rc82","published_at":"2026-10-21T21:35:56Z","updated_at":"2026-11-18T12:11:04.388986Z","fetched_at":"2026-11-21T19:15:55.946145Z","severity":"medium","cvss_score":4.5,"epss":0.00196,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"virtualenv","vuln_id":"CVE-2026-113716","vuln_ids":["CVE-2026-113716","BIT-VIRTUALENV-2026-113716","GHSA-CW65-GX24-RC82","PYSEC-2026-4375"],"tags":["osv","pypi","fix-available"],"cluster_id":4095,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10743","html":"https://vulnwatch.ve1ve2.com/item/10743"}},{"id":10744,"source":{"id":"osv","name":"OSV.dev"},"title":"PYSEC-2026-4375: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the builtin creator calls ensure_dir() for executable, library, and p…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the builtin creator calls ensure_dir() for executable, library, and package directories, and ensure_dir() accepts an existing symlink to a directory because exists() follows it. Interpreter creation, seed installation, and activation generation then write through the linked parent outside the requested destination when another local account prepared the tree and the invoking user can access the target. The --clear option removes the planted tree first, while ordinary creation reaches it; arbitrary attacker-selected output bytes are not established. This issue is fixed in version 21.14.9.\n\nAffected: PyPI:virtualenv\n\nFixed in: 21.14.9\n\nReferences:\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.9\nhttps://github.com/pypa/virtualenv/commit/554d9f9d4f7758f5cf53f993031e29787f1f74c5\nhttps://github.com/pypa/virtualenv/pull/3429\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-cw65-gx24-rc82","url":"https://osv.dev/vulnerability/PYSEC-2026-4375","published_at":"2026-10-20T20:17:17.850000Z","updated_at":"2026-11-18T12:11:04.388986Z","fetched_at":"2026-11-21T19:15:55.946146Z","severity":"medium","cvss_score":4.5,"epss":0.00196,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"virtualenv","vuln_id":"CVE-2026-113716","vuln_ids":["CVE-2026-113716","BIT-VIRTUALENV-2026-113716","GHSA-CW65-GX24-RC82","PYSEC-2026-4375"],"tags":["osv","pypi","fix-available"],"cluster_id":4094,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10744","html":"https://vulnwatch.ve1ve2.com/item/10744"}},{"id":3760,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-113716: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the builtin creator calls ensure_dir() for executable, library, and p…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the builtin creator calls ensure_dir() for executable, library, and package directories, and ensure_dir() accepts an existing symlink to a directory because exists() follows it. Interpreter creation, seed installation, and activation generation then write through the linked parent outside the requested destination when another local account prepared the tree and the invoking user can access the target. The --clear option removes the planted tree first, while ordinary creation reaches it; arbitrary attacker-selected output bytes are not established. This issue is fixed in version 21.14.9.\n\nReferences:\nhttps://github.com/pypa/virtualenv/commit/554d9f9d4f7758f5cf53f993031e29787f1f74c5\nhttps://github.com/pypa/virtualenv/pull/3429\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.9\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-cw65-gx24-rc82","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-113716","published_at":"2026-10-20T20:17:17.850000Z","updated_at":"2026-11-17T20:28:31.660000Z","fetched_at":"2026-11-21T19:15:31.479285Z","severity":"medium","cvss_score":4.5,"epss":0.00196,"is_kev":false,"has_exploit":true,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-113716","vuln_ids":["CVE-2026-113716","GHSA-CW65-GX24-RC82"],"tags":["CWE-59"],"cluster_id":4094,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/3760","html":"https://vulnwatch.ve1ve2.com/item/3760"}}]}