{"vuln_id":"CVE-2026-113724","aliases":["GHSA-43mp-35q3-x3fq"],"description":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the safe_delete() deletion error handler responds to a failed removal by reading mode bits with os.lstat(path) and applying owner-write permission with os.chmod(path, ...), which follows a symlink. A planted link inside a read-only directory can therefore cause a victim-owned target outside the destination that is initially not writable by the invoking user to become broadly writable before the retry fails, provided that user owns the target and can change its mode. Another account can use the widened mode only if it can traverse the target's parent directories; root does not reach the demonstrated failure path, and the operation does not itself read the target. This issue is fixed in version 21.14.9.","published_at":"2026-10-20T20:17:19.113000Z","modified_at":"2026-11-21T19:00:08.573300Z","first_seen_at":"2026-11-21T19:15:47.093879Z","severity":"medium","severity_source":"nvd","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":0.00196,"epss_percentile":0.09335,"nvd_status":"Analyzed","enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-113724"},"matched_alias":null,"items":[{"id":10757,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-43mp-35q3-x3fq: virtualenv: Deletion recovery can change a symlink target's mode","summary":"virtualenv: Deletion recovery can change a symlink target's mode\n\n## Summary\n\nThe deletion error handler obtains permission bits with lstat() but applies them through chmod(), which follows\nsymlinks. On an eligible unlink failure this can change permissions outside the destination.\n\nAnthropic's OSS Scanner reported this as `ANT-2026-UK90QC27` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nPermission recovery after a filesystem deletion error.\n\n## Attacker-controlled input\n\nA deletion must fail on a symbolic-link entry and enter the permission-recovery branch. The invoking user must have\npermission to change the target mode. This is conditional error handling, not the normal successful unlink path.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[safe_delete()](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/util/path/_sync.py).\n\n## Mechanism\n\n`safe_delete()` asks `shutil.rmtree()` to retry a failed removal after adding owner-write permission. Its error handler\ncalls `os.lstat(path)` for mode bits but `os.chmod(path, ...)` to apply them. For a symlink, `lstat` reads the link's\nmode while `chmod` follows the link. A link inside a read-only directory can therefore cause the target's mode to become\n`0777` before the retry fails. The target must be owned by the invoking user and initially not writable by that user;\nroot does not reach this failure path.\n\n## Reproduction and evidence\n\nThe scanner packed a project containing a mode-`0555` `venv/bin/python/` directory and a symlink inside it pointing to\nthe user's mode-`0400` `keys/deploy.pem`. An unprivileged user unpacked it and ran both plain `virtualenv venv` and\n`virtualenv --clear venv`. Both commands exited with `PermissionError` naming the directory inside `venv`, while the\nkey's mode changed from `0400` to `0777`. A control archive with a writable directory completed normally and left the\nkey at `0400`. The read-only mode survives `tar` or `cp -a`; a normal git clone does not preserve this setup.\n\nThis changes permissions; it does not read the target or complete the virtualenv operation. Another account can use the\nwidened mode only if it can traverse the target's parent directories. The scanner dates the active error handler to\n#3222, first released in 21.7.5. [PR #3427](https://github.com/pypa/virtualenv/pull/3427) avoids POSIX mode changes on\ndeletion failure and handles Windows read-only entries without following reparse points.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n    participant A as Prepared read-only venv tree\n    participant V as safe_delete error handler\n    participant L as Symlink in venv\n    participant K as User's 0400 key\n    A->>V: virtualenv venv or --clear venv\n    V->>L: unlink fails in 0555 directory\n    V->>L: lstat returns link mode 0777\n    V->>L: chmod follows symlink\n    L->>K: target mode becomes 0777\n    V-->>A: retry fails with PermissionError\n    Note over K: Other accounts can use new mode if parent paths are traversable\n```\n\n## Reproduc\n\nAffected: PyPI:virtualenv\n\nFixed in: 21.14.9\n\nReferences:\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-43mp-35q3-x3fq\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-113724\nhttps://github.com/pypa/virtualenv/pull/3427\nhttps://github.com/pypa/virtualenv/commit/2bfdc0230d1b2685fedfcfe66c835b9a2ec7c440\nhttps://github.com/pypa/virtualenv\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.9","url":"https://osv.dev/vulnerability/GHSA-43mp-35q3-x3fq","published_at":"2026-10-21T21:31:34Z","updated_at":"2026-11-18T12:10:52.514839Z","fetched_at":"2026-11-21T19:15:55.946155Z","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-113724","vuln_ids":["CVE-2026-113724","BIT-VIRTUALENV-2026-113724","GHSA-43MP-35Q3-X3FQ","PYSEC-2026-4383"],"tags":["osv","pypi","fix-available"],"cluster_id":4111,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10757","html":"https://vulnwatch.ve1ve2.com/item/10757"}},{"id":11328,"source":{"id":"osv","name":"OSV.dev"},"title":"DEBIAN-CVE-2026-113724: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the safe_delete() deletion error handler responds to a failed removal…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the safe_delete() deletion error handler responds to a failed removal by reading mode bits with os.lstat(path) and applying owner-write permission with os.chmod(path, ...), which follows a symlink. A planted link inside a read-only directory can therefore cause a victim-owned target outside the destination that is initially not writable by the invoking user to become broadly writable before the retry fails, provided that user owns the target and can change its mode. Another account can use the widened mode only if it can traverse the target's parent directories; root does not reach the demonstrated failure path, and the operation does not itself read the target. This issue is fixed in version 21.14.9.\n\nAffected: Debian:12:python-virtualenv, Debian:13:python-virtualenv, Debian:14:python-virtualenv\n\nFixed in: 21.15.6+ds-1\n\nReferences:\nhttps://security-tracker.debian.org/tracker/CVE-2026-113724","url":"https://osv.dev/vulnerability/DEBIAN-CVE-2026-113724","published_at":"2026-10-20T20:17:19.113000Z","updated_at":"2026-11-21T19:00:08.573300Z","fetched_at":"2026-11-21T19:23:21.853705Z","severity":"medium","cvss_score":4.5,"epss":0.00196,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"debian","product":"12:python-virtualenv","vuln_id":"CVE-2026-113724","vuln_ids":["CVE-2026-113724","DEBIAN-CVE-2026-113724","GHSA-43MP-35Q3-X3FQ"],"tags":["osv","debian","fix-available"],"cluster_id":4110,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/11328","html":"https://vulnwatch.ve1ve2.com/item/11328"}},{"id":10758,"source":{"id":"osv","name":"OSV.dev"},"title":"PYSEC-2026-4383: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the safe_delete() deletion error handler responds to a failed removal…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the safe_delete() deletion error handler responds to a failed removal by reading mode bits with os.lstat(path) and applying owner-write permission with os.chmod(path, ...), which follows a symlink. A planted link inside a read-only directory can therefore cause a victim-owned target outside the destination that is initially not writable by the invoking user to become broadly writable before the retry fails, provided that user owns the target and can change its mode. Another account can use the widened mode only if it can traverse the target's parent directories; root does not reach the demonstrated failure path, and the operation does not itself read the target. 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/2bfdc0230d1b2685fedfcfe66c835b9a2ec7c440\nhttps://github.com/pypa/virtualenv/pull/3427\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-43mp-35q3-x3fq","url":"https://osv.dev/vulnerability/PYSEC-2026-4383","published_at":"2026-10-20T20:17:19.113000Z","updated_at":"2026-11-18T12:10:52.514839Z","fetched_at":"2026-11-21T19:15:55.946155Z","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-113724","vuln_ids":["CVE-2026-113724","BIT-VIRTUALENV-2026-113724","GHSA-43MP-35Q3-X3FQ","PYSEC-2026-4383"],"tags":["osv","pypi","fix-available"],"cluster_id":4110,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10758","html":"https://vulnwatch.ve1ve2.com/item/10758"}},{"id":3768,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-113724: virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the safe_delete() deletion error handler responds to a failed removal…","summary":"virtualenv is a tool for creating isolated virtual python environments. Prior to 21.14.9, the safe_delete() deletion error handler responds to a failed removal by reading mode bits with os.lstat(path) and applying owner-write permission with os.chmod(path, ...), which follows a symlink. A planted link inside a read-only directory can therefore cause a victim-owned target outside the destination that is initially not writable by the invoking user to become broadly writable before the retry fails, provided that user owns the target and can change its mode. Another account can use the widened mode only if it can traverse the target's parent directories; root does not reach the demonstrated failure path, and the operation does not itself read the target. This issue is fixed in version 21.14.9.\n\nReferences:\nhttps://github.com/pypa/virtualenv/commit/2bfdc0230d1b2685fedfcfe66c835b9a2ec7c440\nhttps://github.com/pypa/virtualenv/pull/3427\nhttps://github.com/pypa/virtualenv/releases/tag/21.14.9\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-43mp-35q3-x3fq\nhttps://github.com/pypa/virtualenv/security/advisories/GHSA-43mp-35q3-x3fq","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-113724","published_at":"2026-10-20T20:17:19.113000Z","updated_at":"2026-11-17T16:43:04.953000Z","fetched_at":"2026-11-21T19:15:31.479292Z","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-113724","vuln_ids":["CVE-2026-113724","GHSA-43MP-35Q3-X3FQ"],"tags":["CWE-59"],"cluster_id":4110,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/3768","html":"https://vulnwatch.ve1ve2.com/item/3768"}}]}