CVE-2026-141523
JSON

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 packageVersionsReported by
ruby json>= 2.18.0, < 2.18.2, >= 2.19.0, < 2.19.3CVE List
json (RubyGems)from 2.18.0 before 2.18.2, from 2.19.0 before 2.19.3GitHub Advisory Database

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H
GitHub6.5medium CVSS:3.1CVSS: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

SourceRecordLicence
CVE ListCVE-2026-141523 changed 2026-12-01CVE Terms of Use
GitHub Advisory DatabaseGHSA-cjpr-jw2g-fw99 changed 2026-12-01CC-BY-4.0
NVDCVE-2026-141523 changed 2026-12-01Public domain