CVE-2021-39151: Arbitrary Code Execution in com.thoughtworks.xstream:xstream

Summary

25/08/2021
Yes i
High
8.5

CVE-2021-39151: XStream is vulnerable to an Arbitrary Code Execution attack. Affects com.thoughtworks.xstream:xstream versions < 1.4.18. Fixed in 1.4.18. How to fix ↓

Also tracked for

The same CVE-2021-39151 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

com.thoughtworks.xstream:xstream is an open-source library used for serialization and deserialization of Java objects to XML and vice versa. It provides a simple API for converting objects to XML and XML to objects. However, a vulnerability has been discovered in XStream that allows remote attackers to execute arbitrary code by manipulating the input stream. This vulnerability can be mitigated by setting up XStream's security framework with a whitelist limited to the minimal required types.

Vulnerability Detail

The vulnerability in XStream arises from the lack of proper input validation and processing. By manipulating the input stream, a remote attacker can inject and execute arbitrary code on the target system. This can lead to various security risks, including unauthorized access, data leakage, and remote code execution. XStream 1.4.18 has addressed this vulnerability by no longer using a blacklist by default.

How To Fix

Latest published version: 1.4.21 as of 22 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.4.18

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating to the latest version is not feasible, a workaround can be implemented by following the steps provided in XStream's documentation for CVE-2021-39151. The workaround involves configuring XStream's security framework with a whitelist that includes only the required types and disabling the use of external entity resolution.

Conclusion

The vulnerability in com.thoughtworks.xstream:xstream allows remote attackers to execute arbitrary code by manipulating the input stream. It is crucial to update to version 1.4.18 or later and configure XStream's security framework properly. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for com.thoughtworks.xstream:xstream →

Share this vulnerability

FAQ

com.thoughtworks.xstream:xstream is an open-source library used for serialization and deserialization of Java objects to XML and vice versa. It provides a simple API for converting objects to XML and XML to objects.

The vulnerability allows remote attackers to execute arbitrary code on the target system by manipulating the input stream. This can lead to unauthorized access, data leakage, and remote code execution.

To fix this vulnerability, update the com.thoughtworks.xstream:xstream package to version 1.4.18 or later and configure XStream's security framework with a whitelist limited to the necessary types.

Yes, if updating to the latest version is not possible, you can follow the workaround steps provided in XStream's documentation for CVE-2021-39151. This involves configuring XStream's security framework with a whitelist and disabling external entity resolution.

The vulnerability was discovered and reported by Smi1e of DBAPPSecurity WEBIN Lab. They provided the necessary information to reproduce the issue.

Related vulnerabilities

Recent vulnerabilities recorded for com.thoughtworks.xstream:xstream.

How To Fix

Latest published version: 1.4.21 as of 22 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.4.18

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback