CVE-2026-27820
Buffer Overflow in zlib Ruby GzipReader Causes Memory Corruption
Publication date: 2026-04-16
Last updated on: 2026-04-16
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| ruby | zlib | to 3.0.1 (exc) |
| ruby | zlib | to 3.1.2 (exc) |
| ruby | zlib | to 3.2.3 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-120 | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer. |
| CWE-131 | The product does not correctly calculate the size to be used when allocating a buffer, which could lead to a buffer overflow. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability exists in the zlib Ruby interface, specifically in the Zlib::GzipReader component. Certain versions of zlib (3.0.0 and below, 3.1.0, 3.1.1, 3.2.0, and 3.2.1) have a buffer overflow issue caused by the zstream_buffer_ungets function. This function attempts to prepend bytes provided by the caller before previously produced output but does not ensure that the underlying Ruby string has enough capacity before shifting existing data. As a result, if the buffer length exceeds its capacity, memory corruption can occur.
The vulnerability has been fixed in versions 3.0.1, 3.1.2, and 3.2.3.
How can this vulnerability impact me? :
This buffer overflow vulnerability can lead to memory corruption when processing compressed data using the affected zlib versions. Memory corruption may cause application crashes, unexpected behavior, or potentially allow an attacker to execute arbitrary code or cause denial of service, depending on how the corrupted memory is exploited.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, you should upgrade the zlib Ruby interface to a fixed version. Specifically, update to versions 3.0.1, 3.1.2, or 3.2.3 or later, as these versions contain the fix for the buffer overflow issue in Zlib::GzipReader.