CVE-2021-35517

7.5 HIGH

📋 TL;DR

CVE-2021-35517 is a denial-of-service vulnerability in Apache Commons Compress where specially crafted TAR archives can trigger excessive memory allocation, leading to out-of-memory errors. This affects any service or application that uses the vulnerable Compress library to process TAR files, potentially causing service disruption.

💻 Affected Systems

Products:
  • Apache Commons Compress
Versions: Versions 1.19 through 1.21
Operating Systems: All operating systems running Java applications
Default Config Vulnerable: ⚠️ Yes
Notes: Any Java application using the vulnerable Apache Commons Compress library to process TAR archives is affected, regardless of the underlying OS.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service outage due to memory exhaustion, potentially affecting multiple services on the same host if memory is fully consumed.

🟠

Likely Case

Targeted service becomes unresponsive or crashes when processing malicious TAR archives, requiring manual intervention to restore service.

🟢

If Mitigated

Limited impact with proper memory limits and monitoring; service may degrade but not fully crash.

🌐 Internet-Facing: HIGH - Services accepting TAR file uploads from untrusted sources are directly vulnerable to DoS attacks.
🏢 Internal Only: MEDIUM - Internal services processing TAR files from potentially untrusted internal sources could be affected.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires only the ability to submit a specially crafted TAR file to a vulnerable service. Public proof-of-concept code exists demonstrating the memory exhaustion attack.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Apache Commons Compress 1.22

Vendor Advisory: https://commons.apache.org/proper/commons-compress/security-reports.html

Restart Required: Yes

Instructions:

1. Identify all applications using Apache Commons Compress. 2. Update the commons-compress dependency to version 1.22 or later. 3. Rebuild and redeploy affected applications. 4. Restart services using the updated library.

🔧 Temporary Workarounds

Implement memory limits

all

Set JVM memory limits and implement monitoring to detect and restart services experiencing memory exhaustion.

java -Xmx512m -Xms256m -jar your-application.jar

Input validation and filtering

all

Implement file type validation and size limits for TAR file uploads before passing to Compress library.

🧯 If You Can't Patch

  • Implement strict file upload controls and only accept TAR files from trusted sources
  • Deploy memory monitoring and automated restart mechanisms for services processing TAR files

🔍 How to Verify

Check if Vulnerable:

Check the commons-compress version in your application's dependencies. If using Maven: mvn dependency:tree | grep commons-compress. If using Gradle: gradle dependencies | grep commons-compress.

Check Version:

java -cp commons-compress.jar org.apache.commons.compress.utils.IOUtils (check manifest) or check pom.xml/build.gradle for version

Verify Fix Applied:

Verify the commons-compress version is 1.22 or higher in your application's dependencies after update.

📡 Detection & Monitoring

Log Indicators:

  • OutOfMemoryError exceptions in application logs
  • JVM heap dump generation
  • Service restart events following memory exhaustion

Network Indicators:

  • Unusually large TAR file uploads to services
  • Repeated TAR file uploads from single sources

SIEM Query:

source="application.logs" AND ("OutOfMemoryError" OR "java.lang.OutOfMemoryError") AND "commons.compress"

🔗 References

📤 Share & Export