CVE-2022-26488

7.0 HIGH

📋 TL;DR

This CVE allows local Windows users to escalate privileges by hijacking the system search path. The Python installer on Windows can incorrectly add user-writable directories to PATH during repair operations, enabling attackers to execute malicious code with higher privileges. Affects Python installations where an administrator installed for all users with PATH modifications enabled.

💻 Affected Systems

Products:
  • Python (CPython)
Versions: Python 3.7.x through 3.7.12, 3.8.x through 3.8.12, 3.9.x through 3.9.10, 3.10.x through 3.10.2
Operating Systems: Windows
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when Python was installed for all users with PATH modifications enabled, and a non-administrative user can trigger a repair operation.

📦 What is this software?

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Local privilege escalation to SYSTEM or administrator privileges, allowing complete system compromise, data theft, and persistence establishment.

🟠

Likely Case

Local privilege escalation to higher user privileges, enabling lateral movement, data access, and installation of malware.

🟢

If Mitigated

Limited to user-level impact with proper access controls and monitoring preventing privilege escalation.

🌐 Internet-Facing: LOW - This is a local privilege escalation vulnerability requiring local access to the system.
🏢 Internal Only: HIGH - Internal users with local access can exploit this to gain elevated privileges on affected Windows systems.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires local user access and ability to trigger Python installer repair. The vulnerability is well-documented in security advisories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Python 3.10.3, 3.9.11, 3.8.13, 3.7.13

Vendor Advisory: https://mail.python.org/archives/list/security-announce@python.org/thread/657Z4XULWZNIY5FRP3OWXHYKUSIH6DMN/

Restart Required: No

Instructions:

1. Download and install patched Python version from python.org. 2. Uninstall vulnerable Python versions. 3. Verify PATH environment variable doesn't contain user-writable directories.

🔧 Temporary Workarounds

Remove user-writable directories from PATH

windows

Manually audit and remove any user-writable directories from the system PATH environment variable

echo %PATH%
setx PATH "modified_path_without_user_writable_dirs"

Restrict repair operations

windows

Prevent non-administrative users from running Python installer repair operations

icacls "C:\Program Files\Python*" /deny Users:(OI)(CI)R

🧯 If You Can't Patch

  • Audit and remove user-writable directories from system PATH environment variable
  • Implement strict access controls to prevent non-administrative users from modifying Python installation directories

🔍 How to Verify

Check if Vulnerable:

Check Python version with 'python --version' and verify if it's in affected range. Check if Python was installed for all users with PATH modifications.

Check Version:

python --version

Verify Fix Applied:

Verify Python version is 3.10.3+, 3.9.11+, 3.8.13+, or 3.7.13+. Check PATH environment variable doesn't contain user-writable directories.

📡 Detection & Monitoring

Log Indicators:

  • Windows Event Logs showing Python installer repair operations by non-administrative users
  • Process creation events for python.exe from unexpected directories

Network Indicators:

  • No network indicators - local privilege escalation

SIEM Query:

EventID=4688 AND (ProcessName="python.exe" OR CommandLine LIKE "%repair%") AND SubjectUserName NOT IN (admin_users_list)

🔗 References

📤 Share & Export