Intel

AIKIDO-2026-769167

json is vulnerable to Use After Free

CVE-2026-71847Published Jul 31, 2026
July 31, 2026

45

CVE Score

Medium

Use After Free

Are you affected? Scan for Free

TL;DR

JSON::ResumableParser#parse clears the consumed input buffer at end-of-stream but leaves state.start, state.cursor, and state.end pointing into the released storage. When an application later calls partial_value on an incomplete object that contains duplicate keys, the duplicate-key warning path invokes cursor_position, which walks those stale pointers and reads freed memory. An attacker who can feed a crafted truncated JSON stream to a resumable parser and trigger partial_value can crash the Ruby process via this heap use-after-free. The fix resets the parser-state pointers when the buffer is cleared and skips cursor-based line/column computation on the resumable warning path.

How do I fix this?

Upgrade the json library to the patch version.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your application uses JSON::ResumableParser with partial_value on untrusted streaming JSON input.

Package

Versions

2.20.0 - 2.21.1

Fixed in 2.21.2

Background info

json is vulnerable to Use After Free in versions 2.20.0 - 2.21.1.

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea