Critical Remote Code Execution Vulnerability in libxstream-java

libxstream-java Updated 02 Oct 2025

Summary

23/03/2021
N/A
Yes i
Critical
9.8

CVE-2021-21350: XStream is a Java library to serialize objects to XML and back again. Affects libxstream-java across 4 version ranges.

< 1.4.15-2 < 3dd9cc610199802e4f13bd49b02a9f99adaba145 < 7153c74dd0e860d0ca3825cc5a23e976e0242b6e < a0d4141a00ba5de4afaee160836898b41eb28065

Fixed in 1.4.15-2. How to fix ↓

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

libxstream-java is a Java library that facilitates the serialization of objects to XML and vice versa. It is widely used in various applications for data interchange and persistence. The library's functionality allows developers to easily convert Java objects into XML format, making it easier to store and transmit data. However, a significant vulnerability has been identified in versions prior to 1.4.16, which poses a risk of remote code execution if the library is not configured properly.

Vulnerability Detail

The vulnerability, identified as CVE-2021-21350, arises from improper handling of the processed input stream in XStream before version 1.4.16. A remote attacker can exploit this flaw to execute arbitrary code on the server by manipulating the input data. This vulnerability is particularly dangerous as it can lead to unauthorized access and control over the affected system. Users who do not implement XStream's security framework with a strict whitelist of allowed types are at risk, as relying on the default blacklist may not provide adequate protection.

How To Fix

Minimum fixed version

1.4.15-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libxstream-java

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

Workaround

If immediate upgrading is not feasible, a temporary workaround is to configure XStream's security framework to use a strict whitelist of allowed types. This involves explicitly defining which classes can be serialized and deserialized, thereby mitigating the risk of arbitrary code execution. Here is an example of how to set up a whitelist:

XStream xstream = new XStream();

// Allow only specific classes
xstream.allowTypes(new Class[]{MyClass.class, AnotherClass.class});

Conclusion

The CVE-2021-21350 vulnerability in libxstream-java poses a significant risk of remote code execution if not addressed. Users are strongly advised to upgrade to version 1.4.16 or later to mitigate this risk. Implementing a strict security framework can also provide a temporary safeguard against potential exploits.

See every vulnerability recorded for libxstream-java →

Share this vulnerability

FAQ

CVE-2021-21350 is a critical vulnerability in the libxstream-java library that allows remote code execution due to improper input stream handling.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The CVSS score of this vulnerability is 9.8, indicating a critical level of severity.

If you cannot upgrade immediately, configure XStream's security framework to use a strict whitelist of allowed types as a temporary workaround.

More information about libxstream-java can be found on its official GitHub repository at https://github.com/x-stream/xstream.

Related vulnerabilities

Recent vulnerabilities recorded for libxstream-java.

How To Fix

Minimum fixed version

1.4.15-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libxstream-java

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