{"schema_version":"1.7.5","id":"GHSA-g857-hhfv-j68w","published":"2026-04-16T20:40:54Z","modified":"2026-06-10T13:40:46Z","aliases":["CVE-2026-27820"],"related":["CGA-6256-f6rw-c36p"],"summary":"Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption","details":"### Details\n\nA buffer overflow vulnerability exists in `Zlib::GzipReader`.\n\nThe `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.\n\n### Recommended action\n\nWe 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:\n\n* For Ruby 3.2 users: Update to zlib 3.0.1\n* For Ruby 3.3 users: Update to zlib 3.1.2\n\nYou can use gem update zlib to update it. If you are using bundler, please add `gem \"zlib\", \">= 3.2.3\"` to your Gemfile.\n\n### Affected versions\n\nzlib gem 3.2.2 or lower\n\n### Credits\n\n[calysteon](https://hackerone.com/calysteon)\n\n### References\n\n* https://hackerone.com/reports/3467067","affected":[{"package":{"name":"zlib","ecosystem":"RubyGems","purl":"pkg:gem/zlib"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.2.0"},{"fixed":"3.2.3"}]}],"versions":["3.2.0","3.2.1","3.2.2"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-g857-hhfv-j68w/GHSA-g857-hhfv-j68w.json"}},{"package":{"name":"zlib","ecosystem":"RubyGems","purl":"pkg:gem/zlib"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.1.0"},{"fixed":"3.1.2"}]}],"versions":["3.1.0","3.1.1"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-g857-hhfv-j68w/GHSA-g857-hhfv-j68w.json"}},{"package":{"name":"zlib","ecosystem":"RubyGems","purl":"pkg:gem/zlib"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.0.1"}]}],"versions":["0.0.1","0.1.0","1.0.0","1.1.0","2.0.0","2.1.0","2.1.1","3.0.0"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-g857-hhfv-j68w/GHSA-g857-hhfv-j68w.json"}}],"references":[{"type":"WEB","url":"https://github.com/ruby/zlib/security/advisories/GHSA-g857-hhfv-j68w"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-27820"},{"type":"WEB","url":"https://hackerone.com/reports/3467067"},{"type":"PACKAGE","url":"https://github.com/ruby/zlib"},{"type":"WEB","url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/zlib/CVE-2026-27820.yml"},{"type":"WEB","url":"https://www.ruby-lang.org/en/news/2026/03/05/buffer-overflow-zlib-cve-2026-27820"}],"database_specific":{"cwe_ids":["CWE-120"],"github_reviewed":true,"github_reviewed_at":"2026-04-16T20:40:54Z","nvd_published_at":"2026-04-16T18:16:44Z","severity":"MODERATE"},"severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"},{"type":"CVSS_V4","score":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U"}]}