CVE-2025-6075
BaseFortify
Publication date: 2025-10-31
Last updated on: 2026-02-04
Assigner: Python Software Foundation
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| python | cpython | 3.12 |
| python | cpython | 3.9 |
| python | cpython | 3.14 |
| python | cpython | 3.13 |
| python | cpython | 3.10 |
| python | python | From 3.13.1 (inc) to 3.13.11 (inc) |
| python | python | 3.15.0 |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-400 | The product does not properly control the allocation and maintenance of a limited resource. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2025-6075 is a low severity performance vulnerability in Python's os.path.expandvars() function. When the input to this function is controlled by a user, specially crafted inputs can cause the function to run with quadratic time complexity, leading to significant slowdowns or performance degradation. This happens because the original implementation used inefficient iterative parsing and string operations that scaled poorly with input size. The vulnerability can be exploited by providing large inputs with many environment variable expansions, causing excessive processing time and potential denial-of-service conditions. The issue has been fixed by refactoring the function to use compiled regular expressions for variable substitution, reducing the complexity from quadratic to linear. [1, 2, 3, 4, 5, 6, 7, 8]
How can this vulnerability impact me? :
This vulnerability can impact you by causing performance degradation or denial-of-service (DoS) scenarios if an attacker can supply user-controlled input to os.path.expandvars(). The quadratic time complexity means that large or specially crafted inputs with many environment variable expansions can cause the function to consume excessive CPU resources, slowing down or halting the application or system using it. Although the severity is low and exploitation is relatively tedious, it can still be used to degrade service availability or responsiveness in affected Python applications. [1, 3, 4, 5, 6, 7, 8]
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability is related to the Python function os.path.expandvars() experiencing performance degradation when processing user-controlled inputs with many environment variable expansions. Detection involves identifying if your Python environment uses vulnerable versions of CPython (before the fix) and if any user inputs are passed unchecked to os.path.expandvars(). There are no specific network detection commands provided. However, you can test for the vulnerability by running a Python script that calls os.path.expandvars() with a large, crafted string containing many environment variable expansions (e.g., repeating variables 100,000 times) and observing if the function exhibits significant slowdowns or high CPU usage, indicating quadratic time complexity. For example, you could run a Python snippet like: ```python import os large_input = '$VAR' * 100000 os.environ['VAR'] = 'value' result = os.path.expandvars(large_input) ``` If this call takes an unusually long time or consumes excessive CPU, the environment is likely vulnerable. Monitoring system performance during such tests can help detect the issue. [1, 2, 4, 5, 6, 7, 8]
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, immediately update your Python environment to a version where the fix for CVE-2025-6075 has been applied. The fix has been implemented starting from Python 3.9 and backported through versions up to 3.14. The patch refactors os.path.expandvars() to use efficient regular expression-based substitution, eliminating the quadratic time complexity and preventing performance degradation. If upgrading is not immediately possible, avoid passing user-controlled input directly to os.path.expandvars() or implement input validation and sanitization to limit the size and complexity of environment variable expansions. Additionally, monitor and limit resource usage to prevent denial-of-service scenarios caused by this vulnerability. [1, 2, 3, 4, 5, 6, 7, 8]