CVE-2021-46143

8.1 HIGH

📋 TL;DR

CVE-2021-46143 is an integer overflow vulnerability in Expat's XML parser that can lead to heap memory corruption. Attackers can exploit this by providing specially crafted XML input, potentially causing denial of service or arbitrary code execution. Any application using vulnerable versions of libexpat (Expat library) is affected.

💻 Affected Systems

Products:
  • Expat (libexpat)
  • Applications using libexpat library
  • Embedded systems with XML parsing
Versions: All versions before 2.4.3
Operating Systems: All operating systems using vulnerable libexpat versions
Default Config Vulnerable: ⚠️ Yes
Notes: Any application that parses XML using libexpat is vulnerable regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or ransomware deployment.

🟠

Likely Case

Denial of service through application crashes or memory corruption, potentially leading to service disruption.

🟢

If Mitigated

Limited impact with proper input validation and memory protections; crashes contained within affected process.

🌐 Internet-Facing: HIGH - XML parsing is common in web services and APIs, making internet-facing systems prime targets.
🏢 Internal Only: MEDIUM - Internal applications using XML parsing remain vulnerable but have reduced attack surface.

🎯 Exploit Status

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

Proof-of-concept code exists in public repositories. Exploitation requires sending malicious XML to vulnerable parser.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.4.3 and later

Vendor Advisory: https://github.com/libexpat/libexpat/releases/tag/R_2_4_3

Restart Required: Yes

Instructions:

1. Update libexpat to version 2.4.3 or later. 2. Recompile applications against updated library. 3. Restart affected services. 4. Test XML parsing functionality.

🔧 Temporary Workarounds

Input Validation Filter

all

Implement strict input validation to reject malformed XML before reaching libexpat parser

Memory Protection

linux

Enable ASLR and other memory protection mechanisms to reduce exploit reliability

sysctl -w kernel.randomize_va_space=2

🧯 If You Can't Patch

  • Implement network segmentation to isolate vulnerable systems
  • Deploy web application firewall with XML parsing protection rules

🔍 How to Verify

Check if Vulnerable:

Check libexpat version: 'strings /path/to/libexpat.so | grep -i expat' or 'ldd /path/to/application | grep expat'

Check Version:

expat --version 2>/dev/null || strings $(ldd $(which your_app) | grep expat | awk '{print $3}') 2>/dev/null | grep -i 'expat'

Verify Fix Applied:

Verify libexpat version is 2.4.3 or higher: 'pkg-config --modversion expat' or check package manager

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults
  • Memory corruption errors in system logs
  • Unusual XML parsing errors

Network Indicators:

  • Unusually large XML payloads
  • XML with malformed structure patterns
  • Repeated XML parsing attempts

SIEM Query:

source="application.logs" AND ("segmentation fault" OR "memory corruption" OR "xml parse error")

🔗 References

📤 Share & Export