# CVE-2026-71847: Ruby JSON heap-use-after-free in ResumableParser

Source: https://junglewise.ai/threats/cve-2026-71847-ruby-json-heap-use-after-free-in-resumableparser  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-07. Updated: 2026-08-07  
License: CC BY 4.0 with a link back

CVE-2026-71847 · Severity: low · CVSS 5.3 · Published 2026-08-07

The Ruby JSON gem contains a flaw in its streaming data parser, which is used by applications to process large or ongoing data feeds. An attacker can send a specially crafted, incomplete JSON stream containing duplicate keys to cause the application to crash. This results in a denial-of-service, potentially taking down web services or background workers that process JSON data.

Technologies: [json (RubyGems)](https://junglewise.ai/threats/technologies/rubygems-json). Vendors: [RubyGems](https://junglewise.ai/threats/vendors/rubygems).

## Quick answers

**Is CVE-2026-71847 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-71847 being exploited in the wild.

**How severe is CVE-2026-71847?** Low severity, with a CVSS score of 5.3, published 7 August 2026.

**Which products and versions are affected?** json (RubyGems) ECOSYSTEM:introduced=2.20.0,fixed=2.21.2.

**Is there a fix for CVE-2026-71847?** Yes. json (RubyGems): upgrade to 2.21.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-71847 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-71847?** Check whether you run json (RubyGems) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- json (RubyGems): upgrade to 2.21.2 or later

  ```sh
  bundle update json
  ```


## Technical details

A heap-use-after-free (UAF) exists in the native C extension of the Ruby JSON gem within the `JSON::ResumableParser` component. When the parser reaches the end of an input buffer, it clears the buffer but fails to invalidate the `state.start`, `state.cursor`, and `state.end` pointers. If `partial_value` is subsequently called on an incomplete object containing duplicate keys, the duplicate-key warning logic invokes `cursor_position`, which dereferences these stale pointers. An unauthenticated remote attacker can exploit this by providing a truncated JSON stream with duplicate keys, leading to a `SIGSEGV` or AddressSanitizer-detected UAF, resulting in a denial of service. The issue is fixed in version 2.21.2.

## Affected products

- RubyGems json >= 2.20.0, <= 2.21.1

## Identifiers

- CVE-2026-71847
- GHSA-9hj4-r449-hfvc

## Timeline

- 2026-07-31: disclosed
- 2026-08-07: advisory
- 2026-08-07: patched: Fixed in version 2.21.2

## References

- [https://github.com/ruby/json/security/advisories/GHSA-9hj4-r449-hfvc](https://github.com/ruby/json/security/advisories/GHSA-9hj4-r449-hfvc)
- [https://api.github.com/repos/ruby/json/security-advisories/GHSA-9hj4-r449-hfvc](https://api.github.com/repos/ruby/json/security-advisories/GHSA-9hj4-r449-hfvc)

## Related threats

- [Ruby JSON heap buffer overflow in JSON generator streaming](https://junglewise.ai/threats/cve-2026-54696-ruby-json-heap-buffer-overflow-in-json-generator-streaming)
- [Ruby JSON format string injection in JSON parser](https://junglewise.ai/threats/cve-2026-33210-ruby-json-format-string-injection-in-json-parser)
- [Out-of-bounds Read in Ruby JSON Parser](https://junglewise.ai/threats/cve-2025-27788-out-of-bounds-read-in-ruby-json-parser)
- [Unsafe object creation in json RubyGem](https://junglewise.ai/threats/cve-2020-10663-unsafe-object-creation-in-json-rubygem)
- [JSON gem has Improper Input Validation vulnerability](https://junglewise.ai/threats/cve-2013-0269-json-gem-has-improper-input-validation-vulnerability)
