CVE-2022-31781 Regular Expression Denial of Service (ReDoS) in ContentType.java. (GHSL-2022-022)

High 7.5 Published Updated

Attackers can cause denial of service via catastrophic backtracking in ContentType parsing if external input reaches the constructor.

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-31781?

CVE-2022-31781 is a high-severity denial of service vulnerability in Apache Tapestry, published on 13 Jul 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Apache Tapestry up to version 5.8.1 is vulnerable to Regular Expression Denial of Service (ReDoS) in the way it handles Content Types. Specially crafted Content Types may cause catastrophic backtracking, taking exponential time to complete. Specifically, this is about the regular expression used on the parameter of the org.apache.tapestry5.http.ContentType class. Apache Tapestry 5.8.2 has a fix for this vulnerability. Notice the vulnerability cannot be triggered by web requests in Tapestry code alone. It would only happen if there's some non-Tapestry codepath passing some outside input to the ContentType class constructor.

Weakness: CWE-1333

Which versions are affected by CVE-2022-31781?

2 open source packages ship an affected version, including org.apache.tapestry:tapestry-core. It affects 1 product.

PackageAffectedFixed in
org.apache.tapestry:tapestry-core MavenAll versions5.8.2
org.apache.tapestry:tapestry-core MavenAll versions5.8.2

Products include Apache Tapestry.

How do I fix CVE-2022-31781?

Upgrade org.apache.tapestry:tapestry-core to 5.8.2 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-31781 being exploited?

There is no known exploitation of CVE-2022-31781 in the wild and no public exploit code.

Sources

Also known as GHSA-227g-7cvv-6ff3.

Is CVE-2022-31781 in your software?

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

Check your SBOMs for free