CVE-2022-31781

7.5 HIGH

📋 TL;DR

Apache Tapestry versions up to 5.8.1 contain a Regular Expression Denial of Service (ReDoS) vulnerability in the ContentType class. Attackers could cause catastrophic backtracking by passing specially crafted content types, consuming excessive CPU resources. This primarily affects applications with non-Tapestry code passing external input to the ContentType constructor.

💻 Affected Systems

Products:
  • Apache Tapestry
Versions: All versions up to and including 5.8.1
Operating Systems: All operating systems running Apache Tapestry
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability requires non-Tapestry code passing external input to ContentType class constructor. Not exploitable through standard Tapestry web requests alone.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete denial of service through CPU exhaustion, potentially crashing the application server and disrupting service availability.

🟠

Likely Case

Degraded application performance and intermittent service disruptions when malicious content types are processed.

🟢

If Mitigated

Minimal impact if input validation prevents malicious content types from reaching the vulnerable code path.

🌐 Internet-Facing: LOW - The vulnerability cannot be triggered directly through web requests in Tapestry alone.
🏢 Internal Only: MEDIUM - Requires non-Tapestry code passing external input to the ContentType constructor, which could occur in custom integrations or middleware.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires specific conditions: non-Tapestry code must pass crafted input to ContentType constructor. No direct web request exploitation possible.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Apache Tapestry 5.8.2

Vendor Advisory: https://www.openwall.com/lists/oss-security/2022/07/12/3

Restart Required: Yes

Instructions:

1. Upgrade Apache Tapestry to version 5.8.2 or later. 2. Update dependencies in your project configuration. 3. Rebuild and redeploy your application. 4. Restart application servers.

🔧 Temporary Workarounds

Input Validation Filter

all

Implement input validation to reject or sanitize content type strings before they reach the ContentType constructor

Rate Limiting

all

Implement rate limiting on endpoints that could pass content type data to prevent DoS attacks

🧯 If You Can't Patch

  • Implement strict input validation for all content type parameters in custom code
  • Monitor CPU usage and implement circuit breakers for ContentType processing

🔍 How to Verify

Check if Vulnerable:

Check your project's pom.xml or build.gradle for Apache Tapestry dependency version. If version is 5.8.1 or lower, you are vulnerable.

Check Version:

For Maven: mvn dependency:tree | grep tapestry. For Gradle: gradle dependencies | grep tapestry.

Verify Fix Applied:

After upgrade, verify the Apache Tapestry version is 5.8.2 or higher in your dependency management file.

📡 Detection & Monitoring

Log Indicators:

  • High CPU usage spikes
  • Slow response times from ContentType processing
  • Application server thread exhaustion warnings

Network Indicators:

  • Unusual content type headers in requests
  • Repeated requests with varying content type parameters

SIEM Query:

source="application_logs" AND ("ContentType" OR "content-type") AND (cpu_usage>90 OR response_time>5000)

🔗 References

📤 Share & Export