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

Summary

CVECVE-2026-28684
StatePUBLISHED
AssignerGitHub_M
Source PriorityCVE Program / NVD first with legacy fallback
Published2026-04-20 17:16:33 UTC
Updated2026-04-27 13:44:13 UTC
Descriptionpython-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.

Risk And Classification

Primary CVSS: v3.1 6.6 MEDIUM from [email protected]

CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H

EPSS: 0.000160000 probability, percentile 0.035570000 (date 2026-04-27)

Problem Types: CWE-59 | CWE-61 | CWE-59 CWE-59: Improper Link Resolution Before File Access ('Link Following') | CWE-61 CWE-61: UNIX Symbolic Link (Symlink) Following


VersionSourceTypeScoreSeverityVector
3.1[email protected]Secondary6.6MEDIUMCVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H
3.1CNADECLARED6.6MEDIUMCVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H

CVSS v3.1 Breakdown

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
High

CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H

NVD Known Affected Configurations (CPE 2.3)

TypeVendorProductVersionUpdateEditionLanguage
Application Saurabh-kumar Python-dotenv All All All All

Vendor Declared Affected Products

SourceVendorProductVersionPlatforms
CNA Theskumar Python-dotenv affected < 1.2.2 Not specified

References

ReferenceSourceLinkTags
github.com/theskumar/python-dotenv/commit/790c5c02991100aa1bf41ee5330aca... [email protected] github.com Patch
github.com/theskumar/python-dotenv/security/advisories/GHSA-mf9w-mj56-hr94 134c704f-9b21-4f2e-91b3-4a467353bcc0 github.com Exploit, Patch, Vendor Advisory
github.com/theskumar/python-dotenv/releases/tag/v1.2.2 [email protected] github.com Release Notes
CVE Program record CVE.ORG www.cve.org canonical
NVD vulnerability detail NVD nvd.nist.gov canonical, analysis
© CVE.report 2026 |

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report