Skip to main content

Ruby zlib gem CVE-2026-27820

| EUVDEUVD-2026-23278 LOW
Classic Buffer Overflow (CWE-120)
2026-04-16 GitHub_M GHSA-g857-hhfv-j68w
1.7
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit crafted gzip payload to Ruby service
  2. Delivery
    Application decompresses via Zlib::GzipReader
  3. Exploit
    ungetc invoked with oversized input
  4. Execution
    zstream_buffer_ungets skips capacity check
  5. Persist
    memmove corrupts adjacent heap memory
  6. Impact
    Ruby 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.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

zlib < 3.0.1
zlib 3.1.0, < 3.1.2
zlib 3.2.0, < 3.2.3

Affected Packages

rubygems zlib fix: 3.0.1, 3.1.2, 3.2.3

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

Vendor (GitHub_M) PRIMARY 1.7 LOW
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
vuln.today AI 3.7 LOW

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.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
Low
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

4
Patch released
Apr 17, 2026 - 15:38 nvd
Patch available
Patch available
Apr 16, 2026 - 19:16 EUVD
CVSS changed
Apr 16, 2026 - 18:22 NVD
1.7 (LOW)
CVE Published
Apr 16, 2026 - 17:27 nvd
LOW 1.7

DescriptionCVE.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

EPSS Score
0.0%
Top 87% exploitable
Prevalence
Medium
bundled gem in Ruby standard library, used where Ruby apps process gzip
Threat Intel
1
1 source
Social Media
3
Sightings
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA CIRCL GitHub VulDB

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.

SignalValue
Severity LOW
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
LOW severity (CVSS 0.1-3.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
Yes
Human Impact· derived
Low
Technical Impact
Partial

Priority Score

8
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +8
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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.

More in Zlib

View all
CVE-2022-37434 CRITICAL POC
9.8 Aug 05

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

CVE-2016-9841 CRITICAL
9.8 May 23

inffast.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact by leveraging improper pointe

CVE-2016-9843 CRITICAL
9.8 May 23

The crc32_big function in crc32.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact via v

CVE-2016-9840 HIGH
8.8 May 23

inftrees.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact by leveraging improper point

CVE-2026-85091 HIGH POC
8.3 Sep 03

Heap buffer overflow in zlib 1.3.1.2 through 1.3.2 allows remote attackers to corrupt memory via crafted input to applic

CVE-2023-45853 CRITICAL
9.8 Oct 14

MiniZip in zlib through 1.3 has an integer overflow and resultant heap-based buffer overflow in zipOpenNewFileInZip4_64

CVE-2016-9842 HIGH
8.8 May 23

The inflateMark function in inflate.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact v

CVE-2015-1191 MEDIUM POC
5.0 Jan 21

Multiple directory traversal vulnerabilities in pigz 2.3.1 allow remote attackers to write to arbitrary files via a (1)

CVE-2026-27171 LOW POC
2.9 Feb 18

zlib before 1.3.2 allows CPU consumption via crc32_combine64 and crc32_combine_gen64 because x2nmodp can do right shifts

CVE-2026-22184 MEDIUM
4.6 Jan 07

Local privilege escalation in zlib 1.3.1.2 and earlier allows authenticated users to achieve arbitrary code execution th

CVE-2013-0296 MEDIUM
4.4 Apr 27

Race condition in pigz before 2.2.5 uses permissions derived from the umask when compressing a file before setting that

CVE-2023-6992 MEDIUM
4.0 Jan 04

Cloudflare version of zlib library was found to be vulnerable to memory corruption issues affecting the deflation algori

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy