CVE-2025-6075: Python CPython quadratic complexity in os.path.expandvars

CVE-2025-6075 · Severity: medium · CVSS 5.5 · Published 2025-10-31

A performance issue was identified in the Python programming language's standard library, specifically in how it handles system environment variables within file paths. If an application allows a user to provide input that is then processed by this specific function, an attacker could provide a specially crafted string that causes the application to slow down significantly or stop responding. This could lead to a denial-of-service condition, impacting the availability of the affected service.

Technologies: Python Software Foundation CPython. Vendors: Python Software Foundation.

Quick answers

Is CVE-2025-6075 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2025-6075 being exploited in the wild.
How severe is CVE-2025-6075?
Medium severity, with a CVSS score of 5.5, published 31 October 2025.
Which products and versions are affected?
Python Software Foundation CPython 3.10.0 < 3.10.20, 3.11.0 < 3.11.15, 3.12.0 < 3.12.13, 3.13.0 < 3.13.10, 3.14.0 < 3.14.1, 3.15.0a1 < 3.15.0a2.
Is there a fix for CVE-2025-6075?
A patch was published on 2025-10-31: Fixes committed to CPython repository Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2025-6075 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2025-6075?
Check whether you run Python Software Foundation CPython at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

A vulnerability exists in CPython's 'os.path.expandvars()' function due to quadratic complexity (CWE-400) when processing environment variable expansions. An attacker who can provide a specially crafted string to this function can trigger excessive CPU consumption, leading to a local denial-of-service. The issue stems from inefficient string processing during the expansion of shell-style variables (e.g., $var, ${var}, or %var%). Patches have been released across multiple CPython release branches to optimize the expansion logic and mitigate the performance degradation.

Affected products

  • Python Software Foundation CPython 3.10.0 < 3.10.20, 3.11.0 < 3.11.15, 3.12.0 < 3.12.13, 3.13.0 < 3.13.10, 3.14.0 < 3.14.1, 3.15.0a1 < 3.15.0a2

Timeline

  • 2025-10-31: advisory: Vulnerability published by NVD
  • 2025-10-31: patched: Fixes committed to CPython repository

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.