MediumGHSA-cjpr-jw2g-fw99CVE-2026-141523

Ruby JSON: Out of Bound Write in parser when `allow_control_characters: true` is enabled

Published 1 Dec 2026 · Updated 1 Dec 2026

Affected packages

jsonRubyGems
Affected
>=2.18.0 <2.18.2
Fixed in
2.18.2
Update to the fixed version for your release line, for example:bundle update --conservative json # Gemfile: '>= 2.18.2'
jsonRubyGems
Affected
>=2.19.0 <2.19.3
Fixed in
2.19.3
Update to the fixed version for your release line, for example:bundle update --conservative json # Gemfile: '>= 2.19.3'

We confirm your address first. See our privacy policy.

Which json does your project really install?

Drop your Gemfile.lock hereWe find the exact json version you install, even when another package pulls it in, and tell you if it’s affected and what to run. Free, no sign-up.

Works for private projects: the file is read in memory to run the scan and then dropped. Also reads Gemfile.

Public repo?

Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Details

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.

Is GHSA-cjpr-jw2g-fw99 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected json, and gives you the command that fixes it.

More advisories for json

  • LowCVE-2026-71847Ruby JSON: JSON::ResumableParser#partial_value dereferences a freed input buffer and crashes on truncated duplicate-key streams · 7 Aug 2026
  • LowCVE-2026-54696Ruby json: JSON generator heap buffer overflow when streaming to an IO · 23 Jul 2026
  • HighCVE-2026-33210Ruby JSON has a format string injection vulnerability · 19 Mar 2026
  • HighCVE-2025-27788Out-of-bounds Read in Ruby JSON Parser · 12 Mar 2025
  • HighCVE-2020-10663Unsafe object creation in json RubyGem · 27 Jul 2020
  • HighCVE-2013-0269JSON gem has Improper Input Validation vulnerability · 24 Oct 2017
json security overview

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.