Description
Oj (Optimized JSON) is a JSON parser and Object marshaller packaged as a Ruby gem. Prior to 3.17.2, Oj::Doc iterators (each_value, each_child, each_leaf) were vulnerable to a heap use-after-free. When a Ruby block yielded during iteration calls doc.close or d.close, the document's heap memory is freed while the C iterator is still running. When control returns from the block, the iterator reads from the freed region, producing a use-after-free accessible from pure Ruby. This issue has been fixed in version 3.17.2.
Published: 2026-06-30
Score: 2.1 Low
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Oj (Optimized JSON) is a Ruby gem that parses JSON. Versions before 3.17.2 contain a heap use‑after‑free when a.close while iterating with each_value, each_child, or each_leaf. The accessed by the C iterator, causing a memory corruption that is observable from Ruby code. This pattern also represents a control‑flow reconfiguration flaw (CWE‑364) and a use‑after‑free memory corruption flaw. The impact is a crash or unstable behaviour; no direct code execution is triggered by the flaw as described.

Affected Systems

The vendor ohler55 provides the Oj gem. Any Ruby application that loads the gem and uses the vulnerable iterators in Oj gem versions older than 3.17.2, command‑line tools, and services that decode untrusted JSON using the affected iterators.

Risk and Exploitability

The CVSS score of 2.1 indicates a low severity vulnerability, and the EPSS score of less than 1% shows a very low likelihood of exploitation. The flaw is not listed in the CISA KEV catalog. The use‑after‑free occurs when a Ruby block calls doc.close during iteration, causing memory corruption that would be observed as a crash or instability in Ruby applications. The behaviour also reflects a control‑flow reconfiguration weakness (CWE‑364), underscoring the need to guard against reentrant close calls. No public exploits are documented, and due to the need to control Ruby code execution to trigger the flaw, the overall risk remains low.

Generated by OpenCVE AI on July 21, 2026 at 15:16 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the Oj Ruby gem to version 3.17.2 or newer to eliminate the use‑after‑free vulnerability.
  • Refactor any iterator block that invokes doc.close or d.close; replace the call with safe handling or remove it entirely.
  • Ensure applications process untrusted JSON data without invoking close inside iterators by implementing input validation and guard checks.

Generated by OpenCVE AI on July 21, 2026 at 15:16 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-9ppp-w3g4-fh4q Oj: Use-After-Free in Oj::Doc Iterators via Reentrant Close
History

Tue, 07 Jul 2026 12:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-364
References
Metrics threat_severity

None

cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

threat_severity

Important


Wed, 01 Jul 2026 14:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Wed, 01 Jul 2026 10:30:00 +0000

Type Values Removed Values Added
First Time appeared Ohler
Ohler oj
Ohler55
Ohler55 oj
Vendors & Products Ohler
Ohler oj
Ohler55
Ohler55 oj

Tue, 30 Jun 2026 23:45:00 +0000

Type Values Removed Values Added
Description Oj (Optimized JSON) is a JSON parser and Object marshaller packaged as a Ruby gem. Prior to 3.17.2, Oj::Doc iterators (each_value, each_child, each_leaf) were vulnerable to a heap use-after-free. When a Ruby block yielded during iteration calls doc.close or d.close, the document's heap memory is freed while the C iterator is still running. When control returns from the block, the iterator reads from the freed region, producing a use-after-free accessible from pure Ruby. This issue has been fixed in version 3.17.2.
Title Oj : Use-After-Free in Oj::Doc Iterators via Reentrant Close
Weaknesses CWE-416
References
Metrics cvssV4_0

{'score': 2.1, 'vector': 'CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-01T12:43:02.746Z

Reserved: 2026-06-16T13:49:33.555Z

Link: CVE-2026-54897

cve-icon Vulnrichment

Updated: 2026-07-01T12:42:57.412Z

cve-icon NVD

No data.

cve-icon Redhat

Severity : Important

Publid Date: 2026-06-30T23:22:43Z

Links: CVE-2026-54897 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-07-21T15:30:07Z

Weaknesses