CVE-2026-27820 — Buffer Overflow in zlib — CVE Details
Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption
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.
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
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.
gem install zlib -v 3.2.3
gem install zlib -v 3.0.1
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).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-120Buffer Copy Without Checking SizeMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/ruby/zlib/security/advisories/GHSA-g857-hhfv-j68wWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-27820ADVISORY
- https://hackerone.com/reports/3467067WEB
- https://github.com/ruby/zlibPACKAGE
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/zlib/CVE-2026-27820.ymlWEB
- https://www.ruby-lang.org/en/news/2026/03/05/buffer-overflow-zlib-cve-2026-27820WEB
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
Maximum impact if exploited, often with little effort or access required.
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
Related CVEs
- CVE-2026-128084MEDIUM
sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
- CVE-2026-115472MEDIUM
Doorkeeper: When using public clients, any client can revoke any access token