CVE-2022-48565

9.8 CRITICAL
XXE

📋 TL;DR

This CVE describes an XML External Entity (XXE) vulnerability in Python's plistlib module through version 3.9.1. Attackers can exploit this by crafting malicious XML plist files to read arbitrary files from the server, potentially leading to sensitive data exposure or denial of service. Any Python application that processes untrusted XML plist files using the vulnerable plistlib module is affected.

💻 Affected Systems

Products:
  • Python
Versions: Python versions up to and including 3.9.1
Operating Systems: All operating systems running vulnerable Python versions
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using plistlib to parse XML plist files from untrusted sources. Binary plist files are not affected.

📦 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 →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution, complete system compromise, or exfiltration of sensitive files like /etc/passwd, SSH keys, or configuration files containing credentials.

🟠

Likely Case

Arbitrary file read from the server, potentially exposing sensitive configuration files, source code, or user data.

🟢

If Mitigated

Limited impact if proper input validation and XML parsing restrictions are in place, or if plist files are from trusted sources only.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

XXE vulnerabilities are well-understood with many public exploit examples. The specific plistlib implementation details make exploitation straightforward.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Python 3.9.2 and later

Vendor Advisory: https://bugs.python.org/issue42051

Restart Required: No

Instructions:

1. Upgrade Python to version 3.9.2 or later. 2. For systems that cannot upgrade immediately, apply backported patches from your distribution vendor. 3. Test applications after upgrade to ensure plist parsing still works correctly.

🔧 Temporary Workarounds

Disable external entity processing

all

Configure XML parser to reject external entity declarations before passing to plistlib

import xml.etree.ElementTree as ET
parser = ET.XMLParser()
parser.entity = lambda x, y, z, w: None

Use binary plist format

all

Convert XML plist files to binary plist format which is not vulnerable to XXE

import plistlib
# Use plistlib.dumps(data, fmt=plistlib.FMT_BINARY) for binary format

🧯 If You Can't Patch

  • Implement strict input validation to reject XML plist files from untrusted sources
  • Use a web application firewall (WAF) with XXE protection rules to block malicious payloads

🔍 How to Verify

Check if Vulnerable:

Check Python version with 'python --version' or 'python3 --version'. If version is 3.9.1 or earlier, check if application uses plistlib to parse XML plist files.

Check Version:

python --version

Verify Fix Applied:

After patching, test with a safe XXE payload to confirm it's rejected. Verify Python version is 3.9.2 or later.

📡 Detection & Monitoring

Log Indicators:

  • Unusual file access patterns from Python processes
  • Large XML plist files being processed
  • Error logs showing XML parsing failures with entity references

Network Indicators:

  • Incoming requests with XML plist files containing DOCTYPE declarations or entity references

SIEM Query:

source="application.log" AND "plistlib" AND ("DOCTYPE" OR "ENTITY" OR "SYSTEM")

🔗 References

📤 Share & Export