Ruby JSON Parser has Out-of-bounds Read
Description
JSON is a JSON implementation for Ruby. Starting in version 2.10.0 and prior to version 2.10.2, a specially crafted document could cause an out of bound read, most likely resulting in a crash. Versions prior to 2.10.0 are not vulnerable. Version 2.10.2 fixes the problem. No known workarounds are available.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Ruby JSON gem versions 2.10.0 and 2.10.1 have an out-of-bounds read vulnerability in JSON parsing, leading to a crash.
Description
CVE-2025-27788 affects the json gem for Ruby, versions 2.10.0 up to (but not including) 2.10.2. The vulnerability is an out-of-bounds read that occurs when parsing a specially crafted JSON document [1]. This flaw can cause the Ruby process to crash, as the parser attempts to read memory beyond the allocated buffer for the input string.
Exploitation
An attacker can exploit this vulnerability by supplying a malicious JSON document to an application that uses the vulnerable json gem for parsing. No special network position or authentication is required; the attack surface is any component that processes JSON input from untrusted sources, such as API endpoints or file upload handlers [2]. The out-of-bounds read is triggered during the parsing phase, before the document is fully validated.
Impact
The primary impact is a denial of service (DoS) condition, as the most likely outcome of the out-of-bounds read is a segmentation fault or other crash of the Ruby process [1]. While this is a read access, exploitation could potentially lead to information disclosure in certain edge cases, though the advisory emphasizes the crash as the primary risk.
Mitigation
The issue is fixed in version 2.10.2 of the json gem [1][4]. Users are strongly advised to update to this patched version immediately. No known workarounds exist; upgrading is the only remediation [1].
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
jsonRubyGems | >= 2.10.0, < 2.10.2 | 2.10.2 |
Affected products
16- osv-coords15 versionspkg:apk/chainguard/ruby3.1-fluentd-kubernetes-daemonset-1.16pkg:apk/chainguard/ruby3.1-fluentd-kubernetes-daemonset-1.16-kinesispkg:apk/chainguard/ruby3.2-fluentd-kubernetes-daemonset-1.16pkg:apk/chainguard/ruby3.2-fluentd-kubernetes-daemonset-1.16-kinesispkg:apk/chainguard/ruby3.2-jsonpkg:apk/chainguard/ruby3.3-fluentd-kubernetes-daemonset-1.16pkg:apk/chainguard/ruby3.3-fluentd-kubernetes-daemonset-1.16-kinesispkg:apk/chainguard/ruby3.3-jsonpkg:apk/chainguard/ruby3.4-fluentd-kubernetes-daemonset-1.16pkg:apk/chainguard/ruby3.4-fluentd-kubernetes-daemonset-1.16-kinesispkg:apk/chainguard/ruby3.4-jsonpkg:apk/wolfi/ruby3.2-jsonpkg:apk/wolfi/ruby3.3-jsonpkg:apk/wolfi/ruby3.4-jsonpkg:gem/json
< 1.16.7.1.1-r1+ 14 more
- (no CPE)range: < 1.16.7.1.1-r1
- (no CPE)range: < 1.16.7.1.1-r1
- (no CPE)range: < 1.16.7.1.1-r1
- (no CPE)range: < 1.16.7.1.1-r1
- (no CPE)range: < 2.10.2-r0
- (no CPE)range: < 1.16.7.1.1-r1
- (no CPE)range: < 1.16.7.1.1-r1
- (no CPE)range: < 2.10.2-r0
- (no CPE)range: < 1.16.8.1.0-r0
- (no CPE)range: < 1.16.8.1.0-r0
- (no CPE)range: < 2.10.2-r0
- (no CPE)range: < 2.10.2-r0
- (no CPE)range: < 2.10.2-r0
- (no CPE)range: < 2.10.2-r0
- (no CPE)range: >= 2.10.0, < 2.10.2
- ruby/jsonv5Range: >= 2.10.0, < 2.10.2
Patches
12 files changed · +2 −1
CHANGES.md+1 −0 modified@@ -1,5 +1,6 @@ # Changes +* Fix a potential crash in the C extension parser. * Raise a ParserError on all incomplete unicode escape sequence. This was the behavior until `2.10.0` unadvertently changed it. * Ensure document snippets that are included in parser errors don't include truncated multibyte characters.
ext/json/ext/parser/parser.c+1 −1 modified@@ -608,7 +608,7 @@ static VALUE json_string_unescape(JSON_ParserState *state, const char *string, c buffer = RSTRING_PTR(result); bufferStart = buffer; - while ((pe = memchr(pe, '\\', stringEnd - pe))) { + while (pe < stringEnd && (pe = memchr(pe, '\\', stringEnd - pe))) { unescape = (char *) "?"; unescape_len = 1; if (pe > p) {
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-9m3q-rhmv-5q44ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-27788ghsaADVISORY
- github.com/ruby/json/commit/c56db31f800d5d508389793e69682f99749dbadfghsax_refsource_MISCWEB
- github.com/ruby/json/releases/tag/v2.10.2ghsax_refsource_MISCWEB
- github.com/ruby/json/security/advisories/GHSA-9m3q-rhmv-5q44ghsax_refsource_CONFIRMWEB
- github.com/rubysec/ruby-advisory-db/blob/master/gems/json/CVE-2025-27788.ymlghsaWEB
News mentions
0No linked articles in our index yet.