CVE-2026-28684

python-dotenv: Symlink following in set_key allows arbitrary file overwrite via cross-device rename fallback

Published Apr 20, 2026 CVSS 3.1 · 6.6 Medium EPSS < 1% KEV · Not listed
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-mf9w-mj56-hr94 python-dotenv: Symlink following in set_key allows arbitrary file overwrite via cross-device rename fallback
History
Type Values Removed Values Added
First Time appeared Saurabh-kumar
Saurabh-kumar python-dotenv
CPEs cpe:2.3:a:saurabh-kumar:python-dotenv:*:*:*:*:*:python:*:*
Vendors & Products Saurabh-kumar
Saurabh-kumar python-dotenv
Type Values Removed Values Added
First Time appeared Theskumar
Theskumar python-dotenv
Vendors & Products Theskumar
Theskumar python-dotenv
References
Metrics threat_severity

None

threat_severity

Moderate

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title python-dotenv: Symlink following in set_key allows arbitrary file overwrite via cross-device rename fallback
Weaknesses CWE-59
CWE-61
References
Metrics cvssV3_1

{'score': 6.6, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Apr 20, 2026, 5:43 PM
Reserved
Mar 2, 2026, 9:43 PM
Status
Analyzed
Published
Apr 20, 2026, 5:16 PM
Modified
Oct 26, 2026, 9:10 PM
Severity
Moderate
Public date
Apr 20, 2026, 4:25 PM