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 is a Ruby gem that parses JSON. Prior to version 3.17.2, its iterators (each_value, each_child, each_leaf) contain a heap use-after-free. When a Ruby block yields during iteration calls doc.close or d.close, the document's heap memory is freed while the C iterator continues, causing a use-after-free that can be triggered from pure Ruby. This use-after-free aligns with CWE-416 and involves reentrant memory access (CWE-364).

Affected Systems

The affected product is the Oj Ruby gem, versions older than 3.17.2, developed by the vendor ohler55.

Risk and Exploitability

The CVSS score of 2.1 is low, and the EPSS score of less than 1% indicates a very low probability of exploitation. The flaw is not listed in CISA’s KEV catalog. Exploitation requires invoking doc.close or d.close during an iterating block, which is observable from Ruby code. No public exploits are documented in the provided references.

Generated by OpenCVE AI on July 31, 2026 at 15:44 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 vulnerability.
  • Refactor any iterator blocks that invoke doc.close or d.close; remove such calls or guard against them.
  • Verify that your application does not call doc.close or d.close within iterator blocks when processing JSON, particularly untrusted data.

Generated by OpenCVE AI on July 31, 2026 at 15:44 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

Status : Deferred

Published: 2026-07-01T00:16:32.983

Modified: 2026-07-01T15:27:14.107

Link: CVE-2026-54897

cve-icon Redhat

Severity : Important

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

Links: CVE-2026-54897 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-07-31T15:45:10Z

Weaknesses