GHSA-G857-HHFV-J68W

Vulnerability from github – Published: 2026-04-16 20:40 – Updated: 2026-04-16 20:40
VLAI?
Summary
Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption
Details

Details

A buffer overflow vulnerability exists in 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.

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
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "zlib"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.2.0"
            },
            {
              "fixed": "3.2.3"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "zlib"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.1.0"
            },
            {
              "fixed": "3.1.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "zlib"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "3.0.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-27820"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-120"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-04-16T20:40:54Z",
    "nvd_published_at": "2026-04-16T18:16:44Z",
    "severity": "MODERATE"
  },
  "details": "### Details\n\nA buffer overflow vulnerability exists in `Zlib::GzipReader`.\n\nThe `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.\n\n### Recommended action\n\nWe 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:\n\n* For Ruby 3.2 users: Update to zlib 3.0.1\n* For Ruby 3.3 users: Update to zlib 3.1.2\n\nYou can use gem update zlib to update it. If you are using bundler, please add `gem \"zlib\", \"\u003e= 3.2.3\"` to your Gemfile.\n\n### Affected versions\n\nzlib gem 3.2.2 or lower\n\n### Credits\n\n[calysteon](https://hackerone.com/calysteon)\n\n### References\n\n* https://hackerone.com/reports/3467067",
  "id": "GHSA-g857-hhfv-j68w",
  "modified": "2026-04-16T20:40:54Z",
  "published": "2026-04-16T20:40:54Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/ruby/zlib/security/advisories/GHSA-g857-hhfv-j68w"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-27820"
    },
    {
      "type": "WEB",
      "url": "https://hackerone.com/reports/3467067"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/ruby/zlib"
    },
    {
      "type": "WEB",
      "url": "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/zlib/CVE-2026-27820.yml"
    },
    {
      "type": "WEB",
      "url": "https://www.ruby-lang.org/en/news/2026/03/05/buffer-overflow-zlib-cve-2026-27820"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Buffer Overflow in Zlib::GzipReader ungetc via large input leads to memory corruption"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…