6.5medium
Ruby JSON: Out of Bound Write in parser when `allow_control_characters: true` is enabled
- Severity
- 6.5medium CVSS:3.1 by GitHub_M
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-cjpr-jw2g-fw99
Description
Ruby JSON is a JSON implementation for Ruby. From 2.18.0 until 2.18.2 and 2.19.3, JSON.parse can perform an out-of-bounds write when allow_control_characters is enabled and attacker-controlled invalid JSON contains sufficient padding before a backslash immediately followed by an ASCII control character. This malformed escape sequence can defeat the parser's bounds checks, potentially corrupting heap memory and more likely crashing the Ruby VM, which can cause denial of service in applications that parse untrusted input with the affected option. This issue is fixed in versions 2.18.2 and 2.19.3.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| ruby json | >= 2.18.0, < 2.18.2, >= 2.19.0, < 2.19.3 | CVE List |
| json (RubyGems) | from 2.18.0 before 2.18.2, from 2.19.0 before 2.19.3 | GitHub Advisory Database |
All scores
| GitHub_M | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H |
Classification
What each source says
CVE List
Ruby JSON is a JSON implementation for Ruby. From 2.18.0 until 2.18.2 and 2.19.3, JSON.parse can perform an out-of-bounds write when allow_control_characters is enabled and attacker-controlled invalid JSON contains sufficient padding before a backslash immediately followed by an ASCII control character. This malformed escape sequence can defeat the parser's bounds checks, potentially corrupting heap memory and more likely crashing the Ruby VM, which can cause denial of service in applications that parse untrusted input with the affected option. This issue is fixed in versions 2.18.2 and 2.19.3.
GitHub Advisory Database
Summary
Parsing invalid JSON with the allow_control_characters: true option enabled can result in an out of bound write, potentially corrupting the heap, but more likely a VM crash.
Details
If an ASCI control character is preceded by a backslash, the bound checks can be defeated.
Originally fixed as a regular bug in json 1.9.3.
Proof of concept
The issue can easily be reproduced with a backslash followed by a control character. Some padding is required.
require "json"
doc = '"' + ("A" * 4096) + "\\\x01" + '"'
JSON.parse(doc, allow_control_characters: true)
Impact
If the allow_control_characters: true option is used to parse untrusted input, it could be used as a DOS vector.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-141523 changed 2026-12-01 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-cjpr-jw2g-fw99 changed 2026-12-01 | CC-BY-4.0 |
| NVD | CVE-2026-141523 changed 2026-12-01 | Public domain |