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.

Severity (CVSS 3.1)6.6Medium
Exploit odds (30 days)0.3%top 83.2% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

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

EcosystemPackageFixed inAdvisory
Debian:12python-dotenvno fix listedDEBIAN-CVE-2026-28684
Debian:13python-dotenvno fix listedDEBIAN-CVE-2026-28684
Debian:14python-dotenvno fix listedDEBIAN-CVE-2026-28684
PyPIpython-dotenv1.2.2GHSA-mf9w-mj56-hr94
PyPIpython-dotenv1.2.2PYSEC-2026-2270
Ubuntu:22.04:LTSpython-dotenvno fix listedUBUNTU-CVE-2026-28684
Ubuntu:24.04:LTSpython-dotenvno fix listedUBUNTU-CVE-2026-28684
Ubuntu:25.10python-dotenvno fix listedUBUNTU-CVE-2026-28684
Ubuntu:26.04:LTSpython-dotenvno fix listedUBUNTU-CVE-2026-28684
Ubuntu:26.10python-dotenvno fix listedUBUNTU-CVE-2026-28684

Affected products (as reported)

VendorProductVersions
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

References