XStream Denial of Service via stack overflow
Description
XStream serializes Java objects to XML and back again. Versions prior to 1.4.20 may allow a remote attacker to terminate the application with a stack overflow error, resulting in a denial of service only via manipulation the processed input stream. The attack uses the hash code implementation for collections and maps to force recursive hash calculation causing a stack overflow. This issue is patched in version 1.4.20 which handles the stack overflow and raises an InputManipulationException instead. A potential workaround for users who only use HashMap or HashSet and whose XML refers these only as default map or set, is to change the default implementation of java.util.Map and java.util per the code example in the referenced advisory. However, this implies that your application does not care about the implementation of the map and all elements are comparable.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
CVE-2022-41966: XStream <1.4.20 allows denial of service via recursive hash calculation in collections, causing stack overflow.
Root
Cause XStream before version 1.4.20 contains a vulnerability that can lead to a denial of service (DoS) via stack overflow. The issue stems from how XStream handles hash code computation for collections and maps (e.g., java.util.HashMap, java.util.HashSet) during XML unmarshalling. By crafting an XML input that creates deeply nested or self-referencing sets and maps, an attacker can force recursive hash calculation, exhausting the call stack and crashing the application [1][2].
Exploitation
No authentication is required; the attacker only needs to deliver a malicious XML payload to an application using XStream. The attack exploits the fact that XStream reconstructs objects based on type information in the input stream. A specifically crafted XML with multiple nested `` elements and self-references triggers an infinite or deep recursive hash evaluation [2]. The vulnerability affects all XStream versions prior to 1.4.19 inclusive [2].
Impact
Successful exploitation results in termination of the executing thread with a StackOverflowError, effectively causing a denial of service [1][3]. The attacker does not gain code execution or data access; the impact is limited to application availability.
Mitigation
XStream 1.4.20 addresses this by catching the stack overflow and raising an InputManipulationException instead [1][3]. Users unable to upgrade can apply workarounds: catch StackOverflowError in client code, set NO_REFERENCES mode if references aren't used, or deny specific collection types via the security framework [2][3]. Changing default implementations of java.util.Map and java.util.Set to TreeMap and TreeSet is possible when the application does not depend on hash-based ordering and all elements are comparable [3].
AI Insight generated on May 20, 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.
| Package | Affected versions | Patched versions |
|---|---|---|
com.thoughtworks.xstream:xstreamMaven | < 1.4.20 | 1.4.20 |
Affected products
16- ghsa-coords15 versionspkg:maven/com.thoughtworks.xstream/xstreampkg:rpm/opensuse/xstream&distro=openSUSE%20Leap%2015.4pkg:rpm/suse/xstream&distro=SUSE%20Enterprise%20Storage%207pkg:rpm/suse/xstream&distro=SUSE%20Enterprise%20Storage%207.1pkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP2-LTSSpkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP3-ESPOSpkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP3-LTSSpkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP4pkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20Real%20Time%2015%20SP3pkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP2-LTSSpkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP3-LTSSpkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP2pkg:rpm/suse/xstream&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP3pkg:rpm/suse/xstream&distro=SUSE%20Manager%20Server%20Module%204.2pkg:rpm/suse/xstream&distro=SUSE%20Manager%20Server%20Module%204.3
< 1.4.20+ 14 more
- (no CPE)range: < 1.4.20
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- (no CPE)range: < 1.4.20-150200.3.25.1
- x-stream/xstreamv5Range: < 1.4.20
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
4- github.com/advisories/GHSA-j563-grx4-pjpvghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-41966ghsaADVISORY
- github.com/x-stream/xstream/security/advisories/GHSA-j563-grx4-pjpvghsax_refsource_CONFIRMWEB
- x-stream.github.io/CVE-2022-41966.htmlghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.