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

> A local attacker can overwrite arbitrary files by exploiting symlink following in python-dotenv's set_key function during cross-device rename operations.

- **Severity:** Medium 6.6 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 20 Apr 2026
- **Updated:** 20 Apr 2026
- **Also known as:** CLEANSTART-2026-GV24455, CLEANSTART-2026-TX03176, DEBIAN-CVE-2026-28684, ECHO-f84b-10a2-6d9d, GHSA-mf9w-mj56-hr94, MINI-27fv-mh5x-464v, MINI-6r5f-qcqf-q452, MINI-6vf3-g9f5-xq7w, MINI-9jx5-c8wg-p6ff, MINI-c53q-8g6j-gfrc, MINI-cmhj-2469-77cx, MINI-m7gg-r6wh-w5vx, MINI-mhr4-p5hc-8gcq, MINI-qcrj-4fgf-87jg, MINI-r2xw-9r4p-48gw, MINI-rhfq-4652-3f62, MINI-w85c-6q68-r6r9, OESA-2026-2198, OESA-2026-2199, OESA-2026-2324, PYSEC-2026-2270, ROOT-APP-PYPI-CVE-2026-28684, SUSE-SU-2026:22118-1, SUSE-SU-2026:2724-1, UBUNTU-CVE-2026-28684, openSUSE-SU-2026:20952-1

## What is CVE-2026-28684?

CVE-2026-28684 is a medium-severity path traversal vulnerability in theskumar python-dotenv, published on 20 Apr 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

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

Weakness: CWE-61 (UNIX Symbolic Link (Symlink) Following), CWE-59 (Improper Link Resolution Before File Access)

## Which versions are affected by CVE-2026-28684?

3 open source packages ship an affected version, including python-dotenv. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `python-dotenv` | PyPI | All versions | 1.2.2 |
| `python-dotenv` | PyPI | All versions | 1.2.2 |
| `python-dotenv` | PyPI | All versions | 1.2.2 |
| `python-python-dotenv` | SUSE:Linux Enterprise Module for Python 3 15 SP7 | All versions | 1.0.0-150400.9.6.1 |
| `python-python-dotenv` | SUSE:Linux Enterprise Server 16.0 | All versions | 1.1.0-160000.3.1 |
| `python-python-dotenv` | SUSE:Linux Enterprise Server for SAP applications 16.0 | All versions | 1.1.0-160000.3.1 |
| `python-python-dotenv` | openSUSE:Leap 16.0 | All versions | 1.1.0-160000.3.1 |

Products: Saurabh-Kumar Python-Dotenv.

## How do I fix CVE-2026-28684?

Upgrade python-dotenv to 1.2.2 or later.

## Is CVE-2026-28684 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-28684 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-28684 and fix it if it is affected.

What it is: CVE-2026-28684 is a medium-severity path traversal vulnerability in theskumar python-dotenv, published on 20 Apr 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-28684 exists.

Affected packages and fixed versions:
- python-dotenv (PyPI): affected all versions; fixed in 1.2.2
- python-dotenv (PyPI): affected all versions; fixed in 1.2.2
- python-dotenv (PyPI): affected all versions; fixed in 1.2.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-28684/ (Markdown: https://insights.sbomify.com/CVE-2026-28684/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-28684
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-28684
- OSV: https://osv.dev/vulnerability/CVE-2026-28684

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-28684/
Summaries are generated and may contain mistakes; the official description above is the record.
