VYPR
Moderate severityNVD Advisory· Published Mar 22, 2021· Updated Aug 3, 2024

XStream is vulnerable to an Arbitrary Code Execution attack

CVE-2021-21351

Description

XStream is a Java library to serialize objects to XML and back again. In XStream before version 1.4.16, there is a vulnerability may allow a remote attacker to load and execute arbitrary code from a remote host only by manipulating the processed input stream. No user is affected, who followed the recommendation to setup XStream's security framework with a whitelist limited to the minimal required types. If you rely on XStream's default blacklist of the Security Framework, you will have to use at least version 1.4.16.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

XStream before version 1.4.16 is vulnerable to remote code execution via a crafted input stream.

Vulnerability

Overview CVE-2021-21351 is a deserialization vulnerability in XStream, a Java library for XML serialization. The flaw resides in the unmarshalling process where type information from the input stream is used to create objects. An attacker can inject malicious data to load and execute arbitrary code from a remote host [1][3].

Exploitation

The attack requires no authentication, only the ability to supply a manipulated input stream to XStream. The proof-of-concept in [4] demonstrates how to craft an XML payload using a TreeSet and JNDI injection to trigger remote code execution. This is possible because XStream's default blacklist is insufficient; a whitelist-based security framework is recommended [2].

Impact

Successful exploitation allows an attacker to execute arbitrary code on the server, potentially leading to full system compromise, data theft, or denial of service [2].

Mitigation

Users should upgrade to XStream 1.4.16 or later [1]. If upgrading is not possible, configure XStream's security framework with a whitelist of allowed classes to limit the attack surface [2].

AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
com.thoughtworks.xstream:xstreamMaven
< 1.4.161.4.16

Affected products

10

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

23

News mentions

0

No linked articles in our index yet.