|
| 1 | +--- |
| 2 | +gem: zlib |
| 3 | +cve: 2026-27820 |
| 4 | +url: https://www.ruby-lang.org/en/news/2026/03/05/buffer-overflow-zlib-cve-2026-27820 |
| 5 | +title: Buffer overflow vulnerability in Zlib::GzipReader |
| 6 | +date: 2026-03-05 |
| 7 | +description: | |
| 8 | + A buffer overflow vulnerability exists in Zlib::GzipReader. |
| 9 | + This vulnerability has been assigned the CVE identifier |
| 10 | + CVE-2026-27820. We recommend upgrading the zlib gem. |
| 11 | +
|
| 12 | + ## Details |
| 13 | +
|
| 14 | + The zstream_buffer_ungets function prepends caller-provided bytes |
| 15 | + ahead of previously produced output but fails to guarantee the |
| 16 | + backing Ruby string has enough capacity before the memmove shifts |
| 17 | + the existing data. This can lead to memory corruption when the |
| 18 | + buffer length exceeds capacity. |
| 19 | +
|
| 20 | + ## Recommended action |
| 21 | +
|
| 22 | + We recommend to update the zlib gem to version 3.2.3 or later. |
| 23 | + In order to ensure compatibility with bundled version in older |
| 24 | + Ruby series, you may update as follows instead: |
| 25 | +
|
| 26 | + * For Ruby 3.2 users: Update to zlib 3.0.1 |
| 27 | + * For Ruby 3.3 users: Update to zlib 3.1.2 |
| 28 | + * You can use gem update zlib to update it. If you are using |
| 29 | + bundler, please add gem "zlib", ">= 3.2.3" to your Gemfile. |
| 30 | +
|
| 31 | + ## Affected versions: |
| 32 | +
|
| 33 | + zlib gem 3.2.2 or lower |
| 34 | +
|
| 35 | + ## Credits |
| 36 | +
|
| 37 | + Thanks to calysteon for reporting this issue. Also thanks to |
| 38 | + nobu for creating the patch. |
| 39 | +patched_versions: |
| 40 | + - "~> 3.0.1" |
| 41 | + - "~> 3.1.2" |
| 42 | + - ">= 3.2.3" |
| 43 | +related: |
| 44 | + url: |
| 45 | + - https://www.ruby-lang.org/en/news/2026/03/05/buffer-overflow-zlib-cve-2026-27820 |
| 46 | + - https://rubygems.org/gems/zlib/versions/3.2.3 |
| 47 | + - https://rubygems.org/gems/zlib/versions/3.1.2 |
| 48 | + - https://rubygems.org/gems/zlib/versions/3.0.1 |
0 commit comments