CVE-2018-11771: Vulnerability in org.apache.commons:commons-compress

Summary

19/10/2018
Yes i
Moderate
5.5

CVE-2018-11771: Moderate severity vulnerability that affects org.apache.commons:commons-compress. Affects org.apache.commons:commons-compress versions >= 1.7, < 1.18. Fixed in 1.18. How to fix ↓

Also tracked for

The same CVE-2018-11771 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The org.apache.commons:commons-compress package is a popular open-source library used for working with compressed files in Java applications. It provides functionality for reading and writing various compression formats, including ZIP archives. This vulnerability affects versions 1.7 to 1.17 of the library. The package is commonly used in a wide range of applications and services that handle compressed files.

Vulnerability Detail

The vulnerability (CVE-2018-11771) arises when the read method of Apache Commons Compress 1.7 to 1.17's ZipArchiveInputStream is used to read a specially crafted ZIP archive. In certain cases, the read method fails to return the correct end-of-file (EOF) indication after reaching the end of the stream. This issue becomes critical when combined with a java.io.InputStreamReader, as it can result in an infinite stream. Attackers can exploit this vulnerability to launch denial-of-service attacks against services that utilize the Compress' zip package.

How To Fix

Minimum fixed version

1.18

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a workaround, developers can implement input stream size limits or timeouts to prevent potential denial-of-service attacks. This can be achieved by setting appropriate constraints on the input stream used with ZipArchiveInputStream. Here's an example of how to set a timeout of 5 seconds using the java.util.zip.ZipInputStream class:

import java.util.zip.ZipInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class ZipReader {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("path/to/archive.zip");
        ZipInputStream zis = new ZipInputStream(fis);
        zis.setTimeout(5000);
        // Rest of the code
    }
}

Conclusion

In conclusion, the org.apache.commons:commons-compress package is vulnerable to a denial-of-service attack due to a flaw in the read method of ZipArchiveInputStream. Upgrading to version 1.18 or higher of the package is recommended to fix the vulnerability. Developers can also implement input stream size limits or timeouts as a temporary workaround. For further assistance and support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for org.apache.commons:commons-compress →

Share this vulnerability

FAQ

This vulnerability can be exploited to launch denial-of-service attacks against services that use the org.apache.commons:commons-compress package. By sending a specially crafted ZIP archive, an attacker can cause the affected service to enter an infinite loop, consuming excessive resources and potentially rendering the service unavailable.

Versions 1.7 to 1.17 of the org.apache.commons:commons-compress package are affected by this vulnerability.

Yes, this vulnerability has been assigned the CVE identifier CVE-2018-11771.

Yes, the vulnerability can be fixed by upgrading the org.apache.commons:commons-compress package to version 1.18 or higher.

Developers can implement input stream size limits or timeouts to mitigate the risk of denial-of-service attacks. By setting constraints on the input stream used with ZipArchiveInputStream, the impact of the vulnerability can be reduced.

Related vulnerabilities

Recent vulnerabilities recorded for org.apache.commons:commons-compress.

How To Fix

Minimum fixed version

1.18

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback