Skip to main content

CVE-2026-27820 — Buffer Overflow in zlib — CVE Details

MEDIUM

Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption

Published April 16, 2026Updated September 10, 2026Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (0.78%). Schedule for your next planned update.

Does your project use an affected zlib version?

Paste your Gemfile.lock to check it for CVE-2026-27820 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my Gemfile.lock

Summary

Details

A buffer overflow vulnerability exists in 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.

Recommended action

We recommend to update the zlib gem to version 3.2.3 or later. In order to ensure compatibility with bundled version in older Ruby series, you may update as follows instead:

  • For Ruby 3.2 users: Update to zlib 3.0.1
  • For Ruby 3.3 users: Update to zlib 3.1.2

You can use gem update zlib to update it. If you are using bundler, please add gem "zlib", ">= 3.2.3" to your Gemfile.

Affected versions

zlib gem 3.2.2 or lower

Credits

calysteon

References

Advisory Timeline

  • First published April 16, 2026 (224 days ago).
  • Last revised September 10, 2026 — 146 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Bundler
Update zlib to 3.2.3 or later
gem install zlib -v 3.2.3
Bundler
Update zlib to 3.0.1 or later
gem install zlib -v 3.0.1
Bundler
Update zlib to 3.1.2 or later
gem install zlib -v 3.1.2

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (3)

Affects 1 ecosystem: RubyGems (1).

PackageFixed In
zlib RubyGems · Affected: 3.2.0, 3.2.1, 3.2.23.2.3
zlib RubyGems · Affected: 0.0.1, 0.1.0, 1.0.0, 1.1.0 (+4 more)3.0.1
zlib RubyGems · Affected: 3.1.0, 3.1.13.1.2

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-120
    Buffer Copy Without Checking SizeMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2026-27820?
Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 9.8/10).
How do I check if my project is affected by CVE-2026-27820?
CVE-2026-27820 affects zlib. It has a 0.8% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-27820 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.8

Maximum impact if exploited, often with little effort or access required.

EPSS Score (30-day exploit probability)
0.78%
EPSS percentile: 52.4

This is an above-median EPSS score — 52.4% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.

Also Known As

GHSA-g857-hhfv-j68w

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my Gemfile.lock