---
schema_version: '1.0'
id: security-20260812-6130c6
title: CVE-2026-28684 — python-dotenv
url: https://osv.dev/vulnerability/PYSEC-2026-2270
url_hash: 6130c66f045d582a9daae0ba8a83bdce24a9eb3bb59b32be55fc0d1d64916786
canonical_url: https://osv.dev/vulnerability/PYSEC-2026-2270
source: osv:pypa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-28684
- PYSEC-2026-2270
- severity:CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H
- python-dotenv
- PyPI
lang: en
published_at: '2026-04-20T17:16:33Z'
fetched_at: '2026-08-12T16:00:04.778194Z'
updated_at: '2026-08-22T14:49:09Z'
status: published
content_hash: 70b206850a6eba4454cd053c90ea29ff50b57fc20d59c4053900dc969a28c551
content_changed_at: '2026-08-22T13:15:21.932521Z'
license_note: full
summary: 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 c
summary_source: rss
summary_en: 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 c
summary_omitted_reason: null
redistribution: true
keywords_en:
- CVE
- CVE-2026-28684
- library vulnerability
- PyPI
- PYSEC-2026-2270
- python-dotenv
- severity:CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H
- software security
entities_en:
- name: CVE
  type: data
- name: PyPI
  type: artifact
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE
  type: data
- name: PyPI
  type: artifact
related_auto:
- name: Portal
  type: organization
  weight: 1.0
- name: Hugging Face
  type: organization
  weight: 1.0
computed_at: '2026-08-22T14:49:07Z'
---

# CVE-2026-28684 — python-dotenv

## TL;DR
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 c

## Key Points
- cve / CVE-2026-28684 / PYSEC-2026-2270 / severity:CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H / python-dotenv / PyPI

## Details
**Severity:** CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H
**Advisory:** PYSEC-2026-2270 (CVE-2026-28684)

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

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

_Data: OSV.dev (upstream: pypa) — https://osv.dev/vulnerability/PYSEC-2026-2270_

## Source
元記事: [CVE-2026-28684 — python-dotenv](https://osv.dev/vulnerability/PYSEC-2026-2270) — published 2026-04-20T17:16:33Z
