CVE-2026-27820
Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption
Reported by github_m · Published April 16, 2026
zlib is fixed in 3.2.3, 3.1.2 and 3.0.1 (RubyGems)
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.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| zlib | RubyGems | 3.2.3, 3.1.2, 3.0.1 |
| rubygem-rexml | errata.rockylinux.org | 3.4.4-14.el10 |
| rubygem-io-console | errata.rockylinux.org | 0.8.2-34.module, 0.7.1-8.module |
| ruby-default-gems | errata.rockylinux.org | 4.0.6-34.module, 3.3.12-8.module |
| rubygem-bundler | errata.rockylinux.org | 4.0.16-34.module, 2.5.22-14.el10, 2.5.22-8.module |
| rubygems | errata.rockylinux.org | 3.5.22-14.el10 |
| rubygem-bigdecimal | errata.rockylinux.org | 4.0.1-34.module, 3.1.5-14.el10, 3.1.5-8.module |
| rubygems-devel | errata.rockylinux.org | 4.0.16-34.module, 3.5.22-14.el10, 3.5.22-8.module |
| rubygem-psych | errata.rockylinux.org | 5.1.2-14.el10, 5.1.2-8.module |
| rubygem-rdoc | errata.rockylinux.org | 6.6.3.1-14.el10, 6.6.3.1-8.module |
| rubygem-minitest | errata.rockylinux.org | 6.0.0-34.module, 5.20.0-14.el10, 5.20.0-8.module |
| ruby-devel | errata.rockylinux.org | 4.0.6-34.module, 3.3.12-14.el10, 3.3.12-8.module |
37 more packages have a fixed version. See every fix in Lookup.
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| ruby | zlib | < 3.0.1, >= 3.1.0, < 3.1.2, >= 3.2.0, < 3.2.3 |
| amazon:2023 | ruby3.4-rubygem-power_assert | 0 |
| amazon:2023 | ruby3.4-rubygem-racc | 0 |
| alpine | ruby | 0, 0 |
| amazon:2023 | ruby3.4-doc | 0 |
| amazon:2023 | ruby3.4-rubygem-rbs | 0 |
| amazon:2023 | ruby3.4-rubygem-minitest | 0 |
| amazon:2023 | ruby3.4-rubygem-irb | 0 |
| RubyGems | zlib | 3.2.0, 0, 3.1.0 |
| chainguard | truffleruby | 0 |
| amazon:2023 | ruby3.4-rubygem-bundler | 0 |
| amazon:2023 | ruby3.4-bundled-gems | 0 |
| ruby | zlib | 3.2.0, 0, 3.1.0 |
| amazon:2023 | ruby3.4-default-gems | 0 |
| amazon:2023 | ruby3.4-rubygem-rss | 0 |
| amazon:2023 | ruby3.4-rubygem-rake | 0 |
| amazon:2023 | ruby3.4-devel | 0 |
| amazon:2023 | ruby3.4-rubygem-typeprof | 0 |
| amazon:2023 | ruby3.4-rubygem-psych | 0 |
| amazon:2023 | ruby3.4-rubygem-json | 0 |
…and 9 more
Timeline
- Mar 4, 2026 CVE Published
- Mar 5, 2026 PoC Published (3 in total, the first dated here)
- Apr 16, 2026 CVE Updated
- Apr 17, 2026 Security Advisory (6 in total, the first dated here)
- May 18, 2026 EPSS Score (30 in total, the first dated here)
- Jul 5, 2026 Coalition ESS Score
- Aug 11, 2026 Distribution Patch (10 in total, the first dated here)
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2026-27820
vulnetix vdb fixes CVE-2026-27820
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2026-27820/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart
References
- https://github.com/ruby/zlib/security/advisories/GHSA-g857-hhfv-j68w x_refsource_CONFIRM
- https://hackerone.com/reports/3467067 x_refsource_MISC
- https://nvd.nist.gov/vuln/detail/CVE-2026-27820 advisory
- https://github.com/advisories/GHSA-g857-hhfv-j68w advisory
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/zlib/CVE-2026-27820.yml advisory
- https://www.ruby-lang.org/en/news/2026/03/05/buffer-overflow-zlib-cve-2026-27820 url
- https://github.com/ruby/zlib url