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

- Severity: Low 1.7 (CVSS:4.0, scored by GitHub_M) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.58%, higher than 49% of CVEs (2026-12-01)
- Published: 2026-04-16T17:27:48.944Z
- Modified: 2026-10-26T21:10:00.170Z
- Also known as: GHSA-g857-hhfv-j68w
- Weaknesses: CWE-120, CWE-131
- SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- ruby zlib: < 3.0.1; >= 3.1.0, < 3.1.2; >= 3.2.0, < 3.2.3
- zlib (RubyGems): from 3.2.0 before 3.2.3; from 3.1.0 before 3.1.2; before 3.0.1
- ruby-lang zlib: before 3.0.1; from 3.1.0 before 3.1.2; from 3.2.0 before 3.2.3

## Every score

- GitHub_M: CVSS:4.0 1.7 Low `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`
- GitHub: CVSS:3.1 9.8 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- GitHub: CVSS:4.0 Medium `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`
- NVD: CVSS:3.1 9.8 Critical `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-j68w> (vendor-advisory, web)
- <https://hackerone.com/reports/3467067> (permissions-required, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-27820> (advisory)
- <https://github.com/ruby/zlib> (package)
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/zlib/CVE-2026-27820.yml> (web)
- <https://www.ruby-lang.org/en/news/2026/03/05/buffer-overflow-zlib-cve-2026-27820> (web)

## Sources

- CVE List: [CVE-2026-27820](https://www.cve.org/CVERecord?id=CVE-2026-27820), CVE Terms of Use, modified 2026-04-16
- GitHub Advisory Database: [GHSA-g857-hhfv-j68w](https://github.com/advisories/GHSA-g857-hhfv-j68w), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-27820](https://nvd.nist.gov/vuln/detail/CVE-2026-27820), Public domain, modified 2026-10-26

---

Page: https://cve.day/CVE-2026-27820 · Whole record: https://cve.day/CVE-2026-27820.json · Rebuilt by cve.day 2026-11-25T22:59:18.910Z
