Skip to content
DoS Advisory Intermediate CVE-2022-31781

GHSL-2022-022: Regular Expression Denial of Service (ReDoS) in Tapestry - CVE-2022-31781

Apache Tapestry's ContentType class uses a regular expression with nested repetition that can cause catastrophic backtracking when parsing a crafted Content-Type header. An attacker could supply such a header to an application using Tapestry, causing a denial of service through excessive CPU consumption.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

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.

ghsecuritylab, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The regular expression contains nested repetition that leads to exponential backtracking when the input does not fully match.

Impact

This issue may lead to a denial of service of the application using Apache Tapestry by resource consumption.

What the attacker needed

Application uses Apache Tapestry; Application passes user-supplied Content-Type to…; Running on JDK 8 or earlier

The fix

The vulnerability was fixed in version 5.8.2, though a bypass to the fix was reported and presumably addressed later.

How it was found

  1. Run the application using Apache Tapestry with JDK 8 or earlier.
  2. Pass a specially crafted Content-Type header to the ContentType constructor.
  3. Observe the exponential time taken to process the header, causing denial of service.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A regular expression is a pattern used to match text. Some patterns can take a very long time to fail on certain inputs, especially if they have nested repeats. Here, a malicious Content-Type header could make the server spend a huge amount of time checking the pattern, effectively freezing the application.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.