Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit crafted gzip payload to Ruby service
-
DeliveryApplication decompresses via Zlib::GzipReader
-
Exploitungetc invoked with oversized input
-
Executionzstream_buffer_ungets skips capacity check
-
Persistmemmove corrupts adjacent heap memory
-
ImpactRuby process crashes or corrupts state
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Buffer copy size validation
MITRE ATT&CK
1 technique across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires that the target application uses Zlib::GzipReader (or a code path that invokes it) and calls ungetc - or an internal path that reaches zstream_buffer_ungets - with attacker-influenced data whose length, combined with previously buffered output, exceeds the backing Ruby String's allocated capacity. This is a non-default code path: standard sequential gzip decompression without ungetc calls is not affected. The CVSS 4.0 AT:P metric confirms that a specific attack prerequisite (heap capacity/state condition) must be met. Exploitation is limited to availability impact (process crash or memory corruption); no confidentiality or integrity compromise is indicated by any available scoring source. There is no authentication requirement to supply gzip data to a network-accessible service, but the application must expose a GzipReader ungetc code path to attacker-controlled input. |
| Impact | Signals are broadly consistent but point toward low real-world risk. The CVSS 4.0 base score of 1.7 reflects AV:N (network-reachable gzip input), AT:P (attack requirements present - the overflow requires the prepend length to exceed buffer capacity, a non-trivial heap-state condition), PR:N, UI:N, and impact limited to VA:L with no confidentiality or integrity impact. EPSS at 0.04% (13th percentile) and SSVC exploitation=none confirm no observed exploitation. SSVC automatable=yes suggests that once a triggering input is identified, it could be delivered at scale, but technical impact is rated only partial, which is consistent with the low-severity crash/instability outcome rather than code execution. The memory corruption is real and classified as CWE-120, but the practical outcome appears limited to availability (process crash or instability) rather than arbitrary code execution, based on all available scoring. No KEV listing and no public POC further reduce priority. For applications that pass untrusted gzip streams through GzipReader with ungetc, patching is still warranted given the memory-corruption class. |
| Exploit ScenarioDerived | An attacker who can supply a crafted gzip-compressed payload to a Ruby application that decompresses it via Zlib::GzipReader and invokes ungetc with content sized to exceed the internal buffer's allocated capacity could trigger the out-of-bounds memmove, corrupting heap memory and causing the Ruby process to crash or behave unexpectedly. No public proof-of-concept exploit has been identified at the time of analysis. The AT:P requirement in the CVSS 4.0 vector indicates that a specific heap state condition must be satisfied for the overflow to occur, making reliable exploitation somewhat dependent on runtime memory layout. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 24, 2026
Buffer overflow in the Ruby zlib gem's Zlib::GzipReader allows remote or local attackers supplying crafted gzip data to corrupt process memory via the zstream_buffer_ungets function. Affected versions span all 3.0.x releases through 3.0.0, the 3.1.0-3.1.1 range, and 3.2.0-3.2.1, collectively covering a wide install base across Ruby 3.2 and 3.3 runtime environments. The vulnerability carries an EPSS of 0.04% (13th percentile) and is not listed in CISA KEV, indicating low current exploitation probability despite the memory-corruption class of the flaw.
RemediationAI
The primary fix is to upgrade the zlib gem to a patched release: Ruby 3.2 users should upgrade to zlib 3.0.1; Ruby 3.3 users should upgrade to zlib 3.1.2; Ruby 3.4 and later users should upgrade to zlib 3.2.3 or higher. Running gem update zlib will pull the latest compatible release. For Bundler-managed projects, add gem "zlib", ">= 3.2.3" (or the appropriate minimum for the series in use) to the Gemfile and run bundle update zlib. Ubuntu users on affected LTS releases should apply the packages from USN-8556-1. If an immediate upgrade is not feasible, the most effective compensating control is to ensure that application code does not call GzipReader#ungetc or equivalent unget paths with externally controlled input lengths, effectively removing the trigger path at the application layer - though this may break legitimate decompression workflows. No generic workaround eliminates the underlying unsafe memmove in the gem itself.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in rubygems
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The Ruby zlib gem (rubygems/zlib, CPE cpe:2.3:a:ruby:zlib:*:*:*:*:*:*:*:*) wraps the native zlib C library to expose gzip read/write functionality to Ruby programs. The root cause is CWE-120 (Buffer Copy without Checking Size of Input): the C-level zstream_buffer_ungets function prepends caller-supplied bytes ahead of previously buffered output by using memmove to shift existing data rightward in the backing Ruby String object. It performs this memmove without first verifying that the String's allocated capacity can accommodate the additional bytes. When the combined length of prepended plus existing data exceeds capacity, the memmove writes out-of-bounds, corrupting adjacent heap memory. The defect is triggered through GzipReader#ungetc or related unget paths that invoke zstream_buffer_ungets with attacker-influenced input lengths.
Know when Zlib gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U
Network-reachable via gzip input (AV:N), but heap-state precondition required for overflow (AC:H); no auth needed (PR:N); impact limited to availability (A:L) per all scoring sources.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
4DescriptionCVE.org
zlib is a Ruby interface for the zlib compression/decompression library. Versions 3.0.0 and below, 3.1.0, 3.1.1, 3.2.0 and 3.2.1 contain a buffer overflow vulnerability in the Zlib::GzipReader. The zstream_buffer_ungets function prepends caller-provided bytes ahead of previously produced output but fails to guarantee the backing Ruby string has enough capacity before the memmove shifts the existing data. This can lead to memory corruption when the buffer length exceeds capacity. This issue has been fixed in versions 3.0.1, 3.1.2 and 3.2.3.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.
zlib through 1.2.12 has a heap-based buffer over-read or buffer overflow in inflate in inflate.c via a large gzip header
inffast.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact by leveraging improper pointe
The crc32_big function in crc32.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact via v
inftrees.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact by leveraging improper point
Heap buffer overflow in zlib 1.3.1.2 through 1.3.2 allows remote attackers to corrupt memory via crafted input to applic
MiniZip in zlib through 1.3 has an integer overflow and resultant heap-based buffer overflow in zipOpenNewFileInZip4_64
The inflateMark function in inflate.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact v
Multiple directory traversal vulnerabilities in pigz 2.3.1 allow remote attackers to write to arbitrary files via a (1)
zlib before 1.3.2 allows CPU consumption via crc32_combine64 and crc32_combine_gen64 because x2nmodp can do right shifts
Local privilege escalation in zlib 1.3.1.2 and earlier allows authenticated users to achieve arbitrary code execution th
Race condition in pigz before 2.2.5 uses permissions derived from the umask when compressing a file before setting that
Cloudflare version of zlib library was found to be vulnerable to memory corruption issues affecting the deflation algori
EUVD-2026-23278
GHSA-g857-hhfv-j68w
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB