CVE-2021-39150

8.5 HIGH

📋 TL;DR

CVE-2021-39150 is a deserialization vulnerability in XStream library that allows remote attackers to access internal resources by manipulating XML input streams. Only affects users who rely on XStream's default blacklist security configuration rather than implementing a proper whitelist. Requires Java runtime versions 8-14.

💻 Affected Systems

Products:
  • XStream
Versions: All versions before 1.4.18
Operating Systems: All platforms running Java 8-14
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when using default blacklist security configuration. Not vulnerable if proper whitelist security framework is implemented.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote attacker could access sensitive internal resources, potentially leading to data exfiltration or further internal network compromise.

🟠

Likely Case

Unauthorized access to internal resources that should not be publicly exposed, potentially exposing configuration files, internal APIs, or sensitive data.

🟢

If Mitigated

No impact for users who properly configured XStream's security framework with a minimal required types whitelist.

🌐 Internet-Facing: HIGH - Remote exploitation possible without authentication if vulnerable endpoint is exposed.
🏢 Internal Only: MEDIUM - Could be exploited by internal attackers or through other compromised systems.

🎯 Exploit Status

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

Exploitation requires sending specially crafted XML to XStream endpoints. Public advisory includes technical details.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.4.18

Vendor Advisory: https://github.com/x-stream/xstream/security/advisories/GHSA-cxfm-5m4g-x7xp

Restart Required: Yes

Instructions:

1. Update XStream dependency to version 1.4.18 or later. 2. Update pom.xml or build.gradle to reference new version. 3. Rebuild and redeploy application. 4. Restart affected services.

🔧 Temporary Workarounds

Implement Security Framework Whitelist

all

Configure XStream's security framework with minimal required types whitelist instead of relying on default blacklist.

// Java code example: XStream xstream = new XStream(); xstream.allowTypes(new Class[]{MyClass1.class, MyClass2.class});

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all XML input to XStream endpoints
  • Restrict network access to XStream endpoints using firewalls or network segmentation

🔍 How to Verify

Check if Vulnerable:

Check XStream version in application dependencies. If version < 1.4.18 and using default security configuration, system is vulnerable.

Check Version:

Check build configuration files (pom.xml, build.gradle) or run: java -cp "xstream-*.jar" com.thoughtworks.xstream.XStream --version

Verify Fix Applied:

Verify XStream version is 1.4.18 or later in application dependencies and verify security framework is properly configured.

📡 Detection & Monitoring

Log Indicators:

  • Unusual XML parsing errors
  • Unexpected class loading attempts in XStream logs
  • Access to unexpected internal resources

Network Indicators:

  • Unusual XML payloads to application endpoints
  • Requests to internal resources from application servers

SIEM Query:

source="application.logs" AND ("XStream" OR "deserialization") AND ("error" OR "exception") AND ("ClassNotFoundException" OR "SecurityException")

🔗 References

📤 Share & Export