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

> Local attackers can exploit a race condition in virtualenv to redirect file operations via symlinks, potentially leading to privilege escalation or data modification.

- **Severity:** Medium 4.5 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 10 Jan 2026
- **Updated:** 12 Jan 2026
- **Also known as:** AZL-74210, AZL-74237, BIT-virtualenv-2026-22702, DEBIAN-CVE-2026-22702, ECHO-bff4-eee0-85f1, GHSA-597g-3phw-6986, MINI-64r7-4747-gmq6, MINI-pq7m-m9vm-6xpx, OESA-2026-1185, OESA-2026-1186, OESA-2026-1187, OESA-2026-1188, PYSEC-2026-2009, ROOT-APP-PYPI-CVE-2026-22702, SUSE-SU-2026:0233-1, SUSE-SU-2026:20129-1, UBUNTU-CVE-2026-22702, openSUSE-SU-2026:20086-1

## What is CVE-2026-22702?

CVE-2026-22702 is a medium-severity vulnerability in pypa virtualenv, published on 10 Jan 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official 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.

Weakness: CWE-59 (Improper Link Resolution Before File Access), CWE-362 (Concurrent Execution using Shared Resource with Improper Synchronization)

## Which versions are affected by CVE-2026-22702?

4 open source packages ship an affected version, including virtualenv. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `virtualenv` | Bitnami | All versions | 20.36.1 |
| `virtualenv` | PyPI | All versions | 20.36.1 |
| `virtualenv` | PyPI | All versions | 20.36.1 |
| `virtualenv` | PyPI | All versions | 20.36.1 |
| `python-virtualenv` | SUSE:Linux Enterprise Module for Python 3 15 SP7 | All versions | 20.22.0-150400.9.9.1 |
| `python-virtualenv` | SUSE:Linux Enterprise Server 16.0 | All versions | 20.29.3-160000.3.1 |
| `python-virtualenv` | SUSE:Linux Enterprise Server for SAP applications 16.0 | All versions | 20.29.3-160000.3.1 |
| `python-virtualenv` | openSUSE:Leap 15.6 | All versions | 20.22.0-150400.9.9.1 |
| `python-virtualenv` | openSUSE:Leap 16.0 | All versions | 20.29.3-160000.3.1 |

Products: Virtualenv Virtualenv.

## How do I fix CVE-2026-22702?

Upgrade virtualenv to 20.36.1 or later.

## Is CVE-2026-22702 being exploited?

There is no known exploitation of CVE-2026-22702 in the wild and no public exploit code.

## Other vulnerabilities in pypa virtualenv

- [CVE-2024-53899](https://insights.sbomify.com/CVE-2024-53899/): virtualenv allows command injection through activation scripts for a virtual environment (high 8.4)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-22702 and fix it if it is affected.

What it is: CVE-2026-22702 is a medium-severity vulnerability in pypa virtualenv, published on 10 Jan 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-22702 in the wild and no public exploit code.

Affected packages and fixed versions:
- virtualenv (Bitnami): affected all versions; fixed in 20.36.1
- virtualenv (PyPI): affected all versions; fixed in 20.36.1
- virtualenv (PyPI): affected all versions; fixed in 20.36.1
- virtualenv (PyPI): affected all versions; fixed in 20.36.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-22702/ (Markdown: https://insights.sbomify.com/CVE-2026-22702/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-22702
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-22702
- OSV: https://osv.dev/vulnerability/CVE-2026-22702

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-22702/
Summaries are generated and may contain mistakes; the official description above is the record.
