Skip to content
OpenAdvisories
Medium · 6.6 CVE-2026-28684 EUVD-2026-23901GHSA-mf9w-mj56-hr94PYSEC-2026-2270

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

Published Apr 20, 2026 · Updated Apr 20, 2026 · 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.

Affected products

VendorProductAffectedFixed
theskumar python-dotenv < 1.2.2 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 python-dotenv No fix yet —
Debian 13 python-dotenv No fix yet —
Debian 12 python-dotenv No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 python-dotenv No fix yet —
Ubuntu 26.04 LTS python-dotenv No fix yet —
Ubuntu 25.10 python-dotenv No fix yet —
Ubuntu 24.04 LTS python-dotenv No fix yet —
Ubuntu 22.04 LTS python-dotenv No fix yet —
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu 20.04 LTS python-dotenv No fix yet —
Ubuntu 18.04 LTS python-dotenv No fix yet —
ReleasePackageFixed inAdvisory
SLES 3 python-python-dotenv 1.0.0-150400.9.6.1 SUSE-SU-2026:2724-1
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 16.0 python-python-dotenv 1.1.0-160000.3.1 SUSE-SU-2026:22118-1
SLES 16.0 python-python-dotenv 1.1.0-160000.3.1 SUSE-SU-2026:22118-1
ReleasePackageFixed inAdvisory
openSUSE Leap 16.0 python-python-dotenv 1.1.0-160000.3.1 openSUSE-SU-2026:20952-1

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling ggshield 1.49.0-r1 —
Wolfi rolling kserve-storage-controller 0.17.0-r2 —
Wolfi rolling superset-6.0 6.0.0-r11 —

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI python-dotenv < 1.2.2 1.2.2 GHSA-mf9w-mj56-hr94

Advisories 6

References