CVE-2021-21350: XStream Arbitrary Code Execution Vulnerability
Summary
CVE-2021-21350: 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
- activemq · Bitnami
- libxstream-java · Debian:11
The same CVE-2021-21350 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
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.
No signup required · Results in about 60 seconds
Background
XStream is an open-source Java library that allows objects to be serialized to XML and deserialized back into objects. It provides a simple way to convert Java objects to XML and vice versa. The library is widely used in various applications and frameworks. However, XStream is vulnerable to an Arbitrary Code Execution attack, which can allow a remote attacker to execute arbitrary code by manipulating the processed input stream. This vulnerability can have serious consequences if an attacker is able to exploit it.
Vulnerability Detail
The vulnerability in XStream arises from a lack of proper input validation and filtering. By manipulating the input stream, an attacker can inject malicious code that will be executed during the deserialization process. This can lead to remote code execution, allowing the attacker to take control of the affected system. 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 you are unable to immediately update XStream to version 1.4.16, you can implement the recommended workarounds provided by XStream. These workarounds are specific to different versions and cover all related CVEs. It is important to carefully follow the instructions provided in the XStream documentation to ensure the effectiveness of the workarounds.
Conclusion
The XStream Arbitrary Code Execution vulnerability (CVE-2021-21350) poses a significant risk to applications using affected versions of XStream. It is crucial to update to at least version 1.4.16 or implement the recommended workarounds to mitigate the vulnerability. Failure to address this vulnerability can result in remote code execution and potential compromise of the affected system. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for com.thoughtworks.xstream:xstream →
FAQ
XStream is a Java library that allows objects to be serialized to XML and deserialized back into objects. It provides a convenient way to convert Java objects to XML and vice versa.
The vulnerability in XStream can allow a remote attacker to execute arbitrary code by manipulating the input stream. This can lead to remote code execution and potential takeover of the affected system.
The vulnerability was discovered and reported by threedr3am.
To protect your application, it is recommended to update XStream to version 1.4.16 or implement the provided workarounds. These measures will mitigate the vulnerability and enhance the security of your application.
No, only versions prior to 1.4.16 are affected by this vulnerability. If you have already updated XStream to version 1.4.16 or later, you are not vulnerable to this specific issue.
Related vulnerabilities
Recent vulnerabilities recorded for com.thoughtworks.xstream:xstream.