CVE-2021-21341

7.5 HIGH

📋 TL;DR

CVE-2021-21341 is a denial-of-service vulnerability in XStream library where specially crafted XML input can cause 100% CPU consumption on target systems. Only users who haven't implemented XStream's security framework with a minimal type whitelist are affected. Users relying on default blacklists are vulnerable.

💻 Affected Systems

Products:
  • XStream
  • Applications using XStream library
Versions: All versions before 1.4.16
Operating Systems: All platforms running Java
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable if using default security configuration without proper type whitelist

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system unavailability due to 100% CPU consumption, potentially affecting multiple systems if exploited in parallel

🟠

Likely Case

Degraded performance or temporary service disruption on affected systems processing malicious XML

🟢

If Mitigated

No impact for users who implemented proper type whitelisting as recommended

🌐 Internet-Facing: MEDIUM - Exploitation requires XML processing endpoint exposure, but many applications use XStream internally
🏢 Internal Only: MEDIUM - Internal applications processing untrusted XML could be affected

🎯 Exploit Status

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

Exploitation requires ability to submit XML input to XStream parser

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.4.16

Vendor Advisory: https://github.com/x-stream/xstream/security/advisories/GHSA-2p3x-qw9c-25hh

Restart Required: Yes

Instructions:

1. Update XStream dependency to version 1.4.16 or later
2. Update pom.xml or build.gradle to use XStream >=1.4.16
3. Redeploy application
4. Verify update with version check

🔧 Temporary Workarounds

Implement Type Whitelist

all

Configure XStream security framework with minimal required type whitelist instead of default blacklist

xstream.addPermission(new ExplicitTypePermission(new Class[]{YourAllowedClass.class}));

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all XML input
  • Deploy network controls to limit XML processing to trusted sources only

🔍 How to Verify

Check if Vulnerable:

Check XStream version in application dependencies or classpath

Check Version:

java -cp "xstream-*.jar" com.thoughtworks.xstream.XStream --version

Verify Fix Applied:

Verify XStream version is 1.4.16 or higher in deployed application

📡 Detection & Monitoring

Log Indicators:

  • High CPU usage spikes
  • XML parsing errors
  • Application performance degradation

Network Indicators:

  • Unusual XML payloads to application endpoints
  • Repeated XML submissions

SIEM Query:

source="application.logs" AND ("CPU 100%" OR "XStream" OR "XML parsing")

🔗 References

📤 Share & Export