REDHAT-BUG-2459798: Medium severity pypi/python-dotenv vulnerability

Published Apr 20, 2026
·
Updated

python-dotenv reads key-value pairs from a .env file and can set them as environment variables. Prior to version 1.2.2, setkey() and unsetkey() 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 Software

1 affected component
pypi/python-dotenv<1.2.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade python-dotenv to a version that resolves this vulnerability.

    Fixed in 1.2.2
  2. Compensating control

    As a workaround for versions prior to 1.2.2, manually apply the patch that prevents set_key() and unset_key() from following symbolic links when rewriting .env files during cross-device rename fallback.

Event History

Apr 20, 2026
Data Sourced
via Red Hat·05:02 PM
DescriptionSeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of REDHAT-BUG-2459798?

The severity of REDHAT-BUG-2459798 is medium, rated at 4.

2

How do I fix REDHAT-BUG-2459798?

To fix REDHAT-BUG-2459798, upgrade python-dotenv to version 1.2.2 or later.

3

What does REDHAT-BUG-2459798 affect?

REDHAT-BUG-2459798 affects python-dotenv prior to version 1.2.2.

4

What kind of attack can exploit REDHAT-BUG-2459798?

A local attacker can exploit REDHAT-BUG-2459798 to overwrite arbitrary files via a crafted symlink.

5

What functionality is compromised in REDHAT-BUG-2459798?

The `set_key()` and `unset_key()` functions in python-dotenv improperly handle symbolic links when modifying .env files.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203