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

Published Apr 16, 2026
·
Updated

Details

A buffer overflow vulnerability exists in Zlib::GzipReader.

The zstreambufferungets 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

calysteon

References

https://hackerone.com/reports/3467067

Other sources

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

NVD

zlib: Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption

Microsoft

Affected Software

9 affected componentsFixes available
rubygems/zlib<=3.0.0, =3.1.0, =3.1.1, =3.2.0, =3.2.1
rubygems/zlib<3.0.1
3.0.1
rubygems/zlib>=3.1.0<3.1.2
3.1.2
rubygems/zlib>=3.2.0<3.2.3
3.2.3
Microsoft azl3 ruby 3.3.5-7
Microsoft azl3 ruby 3.3.5-8
ruby-lang Zlib Ruby<3.0.1
ruby-lang Zlib Ruby>=3.1.0<3.1.2
ruby-lang Zlib Ruby>=3.2.0<3.2.3

Event History

Apr 16, 2026
CVE Published
via MITRE·05:27 PM
Data Sourced
via MITRE·05:27 PM
DescriptionWeakness
Data Sourced
via NVD·06:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
Affected Software
Advisory Published
via GitHub·08:40 PM
Data Sourced
via GitHub·08:40 PM
DescriptionWeaknessAffected Software
Apr 18, 2026
Data Sourced
via Microsoft·08:01 AM
DescriptionSeverityWeaknessAffected Software
Updated
via Microsoft·08:01 AM
Affected Software
Updated
via Microsoft·08:01 AM
DescriptionSeverity
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-27820?

CVE-2026-27820 has a high severity due to its potential for causing memory corruption through a buffer overflow.

2

How do I fix CVE-2026-27820?

To fix CVE-2026-27820, update zlib to version 3.2.2 or later as it addresses the buffer overflow vulnerability.

3

What versions of zlib are affected by CVE-2026-27820?

CVE-2026-27820 affects zlib versions 3.0.0 and below, and specifically versions 3.1.0, 3.1.1, 3.2.0, and 3.2.1.

4

What type of vulnerability is CVE-2026-27820?

CVE-2026-27820 is identified as a buffer overflow vulnerability in the Zlib::GzipReader.

5

Can CVE-2026-27820 be exploited remotely?

Yes, CVE-2026-27820 can potentially be exploited remotely if an attacker can send large input streams to an application using the affected zlib versions.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203