CVE-2022-41966 XStream Denial of Service via stack overflow

High 8.2 Published Updated

Remote attackers can cause a stack overflow and crash the application by sending crafted XML input to the XStream library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-41966?

CVE-2022-41966 is a high-severity denial of service vulnerability in x-stream xstream, published on 27 Dec 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official 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.

Weakness: CWE-674, CWE-502, CWE-121, CWE-120

Which versions are affected by CVE-2022-41966?

2 open source packages ship an affected version, including com.thoughtworks.xstream:xstream. It affects 1 product.

PackageAffectedFixed in
com.thoughtworks.xstream:xstream MavenAll versions1.4.20
com.thoughtworks.xstream:xstream MavenAll versions1.4.20

Products include Xstream Xstream.

How do I fix CVE-2022-41966?

Upgrade com.thoughtworks.xstream:xstream to 1.4.20 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2022-41966 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-41966 exists.

Public exploit code: 1 proofs of concept on GitHub.

Sources

Also known as DEBIAN-CVE-2022-41966, DLA-3267-1, DSA-5315-1, GHSA-j563-grx4-pjpv, ROOT-APP-MAVEN-CVE-2022-41966, UBUNTU-CVE-2022-41966.

Is CVE-2022-41966 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free