CVE-2026-54899: ohler55 Oj heap use-after-free in Oj::Parser symbol_keys toggle

CVE-2026-54899 · Severity: high · CVSS 4 · Published 2026-07-01

Oj is a high-performance JSON processing library for the Ruby programming language. A flaw in how the library manages memory when switching configuration settings can lead to a system crash or unpredictable behavior. This occurs when the library attempts to reuse memory that has already been released, potentially allowing an attacker to disrupt service or gain unauthorized access to information if they can control the JSON data being processed.

Technologies: oj (RubyGems). Vendors: RubyGems.

Quick answers

Is CVE-2026-54899 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-54899 being exploited in the wild.
How severe is CVE-2026-54899?
High severity, with a CVSS score of 4, published 1 July 2026.
Which products and versions are affected?
oj (RubyGems) < 3.17.2, ECOSYSTEM:introduced=0,fixed=3.17.3.
Is there a fix for CVE-2026-54899?
Yes. oj (RubyGems): upgrade to 3.17.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-54899 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-54899?
Check whether you run oj (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

  • oj (RubyGems): upgrade to 3.17.3 or later
    bundle update oj

Technical details

A heap use-after-free vulnerability exists in the Oj (Optimized JSON) Ruby gem prior to version 3.17.2. The flaw is located in `ext/oj/usual.c` within the `opt_symbol_keys_set` function. When the `symbol_keys` option is toggled from true to false on a reused `Oj::Parser` instance, the internal key cache is freed via `cache_free`, but the `d->key_cache` pointer is not cleared. Subsequent calls to `parse` trigger `cache_intern`, which attempts to read from the now-freed memory address. This vulnerability can be triggered by providing specific JSON input to a parser instance that has undergone this configuration change, potentially leading to a crash or limited information disclosure. The issue is fixed in version 3.17.2.

Affected products

  • ohler55 oj < 3.17.2

Identifiers

  • CVE-2026-54899
  • GHSA-2cw7-v8ff-p88r

Timeline

  • 2026-06-16: advisory: GitHub security advisory published
  • 2026-06-30: disclosed: CVE published to NVD
  • 2026-07-01: patched: Fix confirmed in version 3.17.2

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.