CVE-2026-27820 zlib: Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption
A buffer overflow in the Ruby zlib library allows attackers to cause memory corruption and potentially execute code via crafted gzip input.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2026-27820?
CVE-2026-27820 is a low-severity memory corruption vulnerability in ruby zlib, published on 16 Apr 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Which versions are affected by CVE-2026-27820?
6 open source packages ship an affected version, including zlib. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
zlib RubyGems | All versions | 3.0.1 |
zlib RubyGems | All versions | 3.0.1 |
zlib RubyGems | From 3.1.0 | 3.1.2 |
zlib RubyGems | From 3.1.0 | 3.1.2 |
zlib RubyGems | From 3.2.0 | 3.2.3 |
zlib RubyGems | From 3.2.0 | 3.2.3 |
Products include Ruby-Lang Zlib.
How do I fix CVE-2026-27820?
Upgrade zlib to a fixed version for your release line: 3.0.1, 3.1.2 or 3.2.3.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is CVE-2026-27820 being exploited?
There is no known exploitation of CVE-2026-27820 in the wild and no public exploit code.
Sources
Also known as ALPINE-CVE-2026-27820, AZL-83450, BELL-CVE-2026-27820, CLSA-2026-1785320518, CLSA-2026-1785428387, CLSA-2026-1786470325 and 10 more.