Advisory

PYSEC-2026-2270

Also known as: CVE-2026-28684, GHSA-mf9w-mj56-hr94

Summary

The record has no summary.

Details

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.

Severity

Medium Basis: CVSS v3 score 6.6, vector CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H

Dates

Published
2026-04-20 17:16 UTC
Modified
2026-07-13 07:15 UTC

Affected packages and fixes

python-dotenv

PyPI · All systems

Affected

  • introduced 0, fixed 1.2.2 (ecosystem)

Fixed versions

1.2.2

Fix

  • Fixed version 1.2.2
    pip install --upgrade python-dotenv==1.2.2

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: PyPA Advisory Database · CC BY 4.0

Sources & licences