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