CVE-2021-39149: XStream Arbitrary Code Execution Vulnerability

Summary

25/08/2021
Yes i
High
8.5

CVE-2021-39149: 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-39149 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

XStream is an open-source Java library that allows for the serialization and deserialization of Java objects to XML and back. It provides a simple API for converting Java objects to XML and vice versa. XStream is widely used in various applications and frameworks for data persistence and communication. However, it is vulnerable to an Arbitrary Code Execution attack, which can allow a remote attacker to load and execute arbitrary code from a remote host by manipulating the processed input stream.

Vulnerability Detail

The vulnerability in XStream arises from the lack of proper input validation and filtering during the deserialization process. By crafting a malicious XML payload, an attacker can exploit this vulnerability to execute arbitrary code on the target system. This can lead to various consequences, including remote code execution, data theft, and unauthorized access to sensitive information. The impact of this vulnerability can be mitigated by following the recommended security practices, such as setting up XStream's security framework with a whitelist limited to the minimal required types.

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 of XStream is not feasible, alternative workarounds are available. These workarounds are specific to different versions and can be found in the XStream documentation for CVE-2021-39149. Implementing the recommended workarounds can help mitigate the vulnerability until a proper update can be applied.

Conclusion

The CVE-2021-39149 vulnerability in XStream exposes systems to the risk of arbitrary code execution. It is crucial to update XStream to version 1.4.18 or later to mitigate this vulnerability. If updating is not immediately possible, implementing the recommended workarounds can provide temporary protection. For further support and assistance in vulnerability remediation, please contact DevNack.com.

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

Share this vulnerability

FAQ

XStream is an open-source Java library used for serialization and deserialization of Java objects to XML and vice versa. It provides a convenient API for converting Java objects to XML and back.

The vulnerability allows a remote attacker to execute arbitrary code on the target system by manipulating the input stream. This can lead to remote code execution, data theft, and unauthorized access to sensitive information.

To fix this vulnerability, it is recommended to update XStream to version 1.4.18 or later. This update addresses the vulnerability and reduces the risk of arbitrary code execution.

Yes, if updating to the latest version is not feasible, XStream provides specific workarounds for different versions. These workarounds can be implemented to mitigate the vulnerability until a proper update can be applied.

The vulnerability was discovered and reported by Lai Han of the NSFOCUS security team. They provided the necessary information to reproduce the issue and worked with XStream to address the vulnerability.

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