CVE-2021-21350: XStream Arbitrary Code Execution Vulnerability

Summary

22/03/2021
Yes i
Moderate
5.3

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

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.

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

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 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 →

Share this vulnerability

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.

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