Vulnerability · Published Apr 20, 2026 · Assigned by GitHub_M
CVE-2026-28684python-dotenv: Symlink following in set_key allows arbitrary file overwrite via cross-device rename fallback
Medium 6.6
In plain English
A medium-severity security flaw in python-dotenv from theskumar. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 17% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
python-dotenv reads key-value pairs from a .env file and can set them as environment variables. Prior to version 1.2.2, `set_key()` and `unset_key()` in python-dotenv follow symbolic links when rewriting `.env` files, allowing a local attacker to overwrite arbitrary files via a crafted symlink when a cross-device rename fallback is triggered. Users should upgrade to v.1.2.2 or, as a workaround, apply the patch manually.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | python-dotenv | no fix listed | DEBIAN-CVE-2026-28684 |
| Debian:13 | python-dotenv | no fix listed | DEBIAN-CVE-2026-28684 |
| Debian:14 | python-dotenv | no fix listed | DEBIAN-CVE-2026-28684 |
| PyPI | python-dotenv | 1.2.2 | GHSA-mf9w-mj56-hr94 |
| PyPI | python-dotenv | 1.2.2 | PYSEC-2026-2270 |
| Ubuntu:22.04:LTS | python-dotenv | no fix listed | UBUNTU-CVE-2026-28684 |
| Ubuntu:24.04:LTS | python-dotenv | no fix listed | UBUNTU-CVE-2026-28684 |
| Ubuntu:25.10 | python-dotenv | no fix listed | UBUNTU-CVE-2026-28684 |
| Ubuntu:26.04:LTS | python-dotenv | no fix listed | UBUNTU-CVE-2026-28684 |
| Ubuntu:26.10 | python-dotenv | no fix listed | UBUNTU-CVE-2026-28684 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| theskumar | python-dotenv | < 1.2.2 |
Weakness: CWE-59, CWE-61 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H