CVE-2021-21347: XStream Arbitrary Code Execution Vulnerability

Summary

22/03/2021
Yes i
Moderate
6.1

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

Also tracked for

The same CVE-2021-21347 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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 exchange and persistence. 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 a lack of proper input validation and filtering during the deserialization process. By crafting a malicious input stream, 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. It is important to note that users who have followed the recommendation to set up XStream's security framework with a whitelist limited to the minimal required types are not affected by this vulnerability.

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.16

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 immediately feasible, there are workarounds available for different versions. These workarounds involve configuring XStream's security framework to mitigate the risk of the vulnerability. Detailed instructions for implementing the workarounds can be found in XStream's documentation for CVE-2021-21347.

Conclusion

The XStream Arbitrary Code Execution vulnerability (CVE-2021-21347) poses a significant risk to applications using XStream for XML serialization and deserialization. It is crucial to update to the latest version of XStream (1.4.16) or apply the recommended workarounds to protect against this vulnerability. Regularly monitoring for updates and following secure coding practices can help mitigate the risk of similar vulnerabilities in the future. 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 that provides a simple API for converting Java objects to XML and vice versa. It is widely used for data exchange and persistence in various applications and frameworks.

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.

The vulnerability was discovered and reported by threedr3am.

To protect your application, it is recommended to update XStream to at least version 1.4.16. Additionally, you should follow the best practices for secure deserialization and implement proper input validation and filtering.

Yes, there are workarounds available for different versions of XStream. These workarounds involve configuring XStream's security framework to mitigate the risk of the vulnerability. Detailed instructions can be found in XStream's documentation for CVE-2021-21347.

Related vulnerabilities

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

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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.16

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