CVE-2016-3674: XML External Entity Injection in XStream
Summary
CVE-2016-3674: XML External Entity Injection in XStream. Affects com.thoughtworks.xstream:xstream versions < 1.4.9. Fixed in 1.4.9. How to fix ↓
Also tracked for
- libxstream-java · Debian:11
The same CVE-2016-3674 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 a Java library that provides a simple way to serialize objects to XML and back again. It is widely used in various applications and frameworks for data serialization and deserialization. XStream supports multiple XML drivers, including Dom4JDriver, DomDriver, JDomDriver, JDom2Driver, SjsxpDriver, StandardStaxDriver, and WstxDriver. These drivers are responsible for parsing XML documents and converting them into Java objects. However, versions of XStream before 1.4.9 are vulnerable to XML external entity (XXE) injection attacks.
Vulnerability Detail
The vulnerability allows remote attackers to read arbitrary files by exploiting the XXE vulnerability in the XML parsing process. By crafting a malicious XML document, an attacker can include external entities that reference sensitive files on the server. When the XML document is processed by XStream, the parser resolves these entities and discloses the contents of the referenced files. This can lead to unauthorized access to sensitive information, such as configuration files, credentials, or other sensitive data stored on the server.
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.9
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 upgrading to the latest version of XStream is not immediately feasible, a temporary workaround is to disable external entity resolution manually. This can be done by configuring the XML parser used by XStream to disallow the processing of external entities. The specific steps to implement this workaround may vary depending on the XML parser being used. Here is an example of how to disable external entity resolution using the Woodstox XML parser:
- Add the Woodstox dependency to your project:
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>6.2.4</version>
</dependency>
- Configure XStream to use the Woodstox XML driver:
XStream xstream = new
XStream(new StaxDriver(new WstxInputFactory(), new WstxOutputFactory()));
- Disable external entity resolution in the Woodstox XML driver:
((WstxDriver)
xstream.getDriver()).getConfiguredXMLInputFactory().setProperty(XMLInputFactory.SUPPORT_DTD, false);
((WstxDriver)
xstream.getDriver()).getConfiguredXMLInputFactory().setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
By following these steps, you can mitigate the XXE vulnerability until a proper upgrade to the latest version of XStream can be performed.
Conclusion
The XML External Entity Injection vulnerability in XStream can have serious security implications, allowing attackers to read sensitive files on the server. It is crucial to upgrade to the latest version of XStream (1.4.9 or later) or apply the provided workaround to mitigate this vulnerability. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for com.thoughtworks.xstream:xstream →
FAQ
XStream is a Java library used for object serialization and deserialization to XML.
XML External Entity (XXE) injection is a vulnerability that allows an attacker to read arbitrary files on the server by exploiting the XML parsing process.
Versions of XStream before 1.4.9 are affected by this vulnerability.
This vulnerability can lead to unauthorized access to sensitive information stored on the server, such as configuration files or credentials.
To protect your application, it is recommended to upgrade to XStream version 1.4.9 or later, or apply the workaround mentioned in the 'how_to_fix' section.
Related vulnerabilities
Recent vulnerabilities recorded for com.thoughtworks.xstream:xstream.