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

- Severity: Medium 6.6 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.26%, higher than 19% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-04-20T16:25:12.302Z
- Modified: 2026-10-26T21:10:00.170Z
- Also known as: GHSA-mf9w-mj56-hr94, PYSEC-2026-2270
- Weaknesses: CWE-59, CWE-61
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

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

(As written by CVE List.)

## Affected

- theskumar python-dotenv: < 1.2.2
- python-dotenv (PyPI): before 1.2.2
- saurabh-kumar python-dotenv: before 1.2.2

## Every score

- GitHub_M: CVSS:3.1 6.6 Medium `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H`
- GitHub: CVSS:3.1 6.6 Medium `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H`
- PyPA Advisory Database: CVSS:3.1 6.6 Medium `CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H`

## References

- <https://github.com/theskumar/python-dotenv/security/advisories/GHSA-mf9w-mj56-hr94> (exploit, fix, patch, vendor-advisory, web)
- <https://github.com/theskumar/python-dotenv/commit/790c5c02991100aa1bf41ee5330aca75edc51311> (fix, patch, web)
- <https://github.com/theskumar/python-dotenv/releases/tag/v1.2.2> (advisory, release-notes, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-28684> (advisory)
- <https://github.com/theskumar/python-dotenv/commit/790c5c02991100aa1bf41ee5330aca75edc51311.patch> (web)
- <https://github.com/theskumar/python-dotenv> (package)

## Sources

- CVE List: [CVE-2026-28684](https://www.cve.org/CVERecord?id=CVE-2026-28684), CVE Terms of Use, modified 2026-04-20
- GitHub Advisory Database: [GHSA-mf9w-mj56-hr94](https://github.com/advisories/GHSA-mf9w-mj56-hr94), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-28684](https://nvd.nist.gov/vuln/detail/CVE-2026-28684), Public domain, modified 2026-10-26
- PyPA Advisory Database: [PYSEC-2026-2270](https://osv.dev/vulnerability/PYSEC-2026-2270), CC-BY-4.0, modified 2026-07-13

---

Page: https://cve.day/CVE-2026-28684 · Whole record: https://cve.day/CVE-2026-28684.json · Rebuilt by cve.day 2026-11-25T22:59:19.048Z
