Description
Oj (Optimized JSON) is a JSON parser and Object marshaller packaged as a Ruby gem. In versions prior to 3.17.3, Oj::Doc#each_child, when invoked recursively over a deeply nested JSON document, overflows a fixed-size stack buffer and aborts the process, leading to DoS. In a two-step chain in ext/oj/fast.c, doc_each_child increments doc->where past the where_path[MAX_STACK = 100] array with no bounds check and never restores it (the doc->where-- is missing), so calling each_child recursively from inside the yield block drives doc->where beyond the array. On the next entry the function copies the path into the 800-byte stack-local buffer save_path[MAX_STACK] using wlen = doc->where - doc->where_path, so when the previous recursive call left doc->where past where_path[100] the wlen exceeds MAX_STACK and the memcpy overflows save_path on the C stack; because the Oj::Doc parser imposes no JSON nesting-depth limit (relying on a C-stack pressure check), deeply nested attacker input reaches this path. This issue has been fixed in version 3.17.3.
Published: 2026-06-30
Score: 7.5 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

In Oj (Optimized JSON), a stack buffer overflow occurs in the Oj::Doc#each_child method when parsing deeply nested JSON. The recursive invocation increments a pointer within the internal where_path array beyond its 100‑element limit, and due to a missing decrement the pointer remains out of bounds. During the next iteration the parser copies the path into an 800‑byte stack buffer using a length based on the out‑of‑bounds pointer, causing a memcpy overflow on the C stack. The overflow terminates the Ruby process, resulting in a denial of service. Unchecked memory writes, buffer overflows, and improper buffer handling underlie the flaw.

Affected Systems

Any installation of the Oj Ruby gem distributed by ohler55 that uses a version earlier than 3.17.3 is vulnerable, as those releases lack the bounds check and decrement introduced in 3.17.3.

Risk and Exploitability

The CVSS score of 7.5 classifies this vulnerability as high severity, but the EPSS score of < 1% indicates a very low probability of exploitation in the wild. The flaw is not listed in CISA’s KEV catalog. The likely attack vector is any code that feeds deeply nested JSON into Oj for parsing; the attacker can supply such input locally, through an API, or any other entry point that leads to Oj processing untrusted data.

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

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Oj to version 3.17.3 or later
  • Avoid parsing untrusted or excessively nested JSON with older Oj releases
  • If upgrading is not immediately possible, limit the depth of JSON input or the recursion depth when calling Oj::Doc#each_child

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

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-3m6q-jj5j-38c9 Oj: Stack Buffer Overflow in Oj::Doc#each_child via Deeply Nested Input
History

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

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

None

threat_severity

Important


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

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', '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
Vendors & Products Ohler
Ohler 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. In versions prior to 3.17.3, Oj::Doc#each_child, when invoked recursively over a deeply nested JSON document, overflows a fixed-size stack buffer and aborts the process, leading to DoS. In a two-step chain in ext/oj/fast.c, doc_each_child increments doc->where past the where_path[MAX_STACK = 100] array with no bounds check and never restores it (the doc->where-- is missing), so calling each_child recursively from inside the yield block drives doc->where beyond the array. On the next entry the function copies the path into the 800-byte stack-local buffer save_path[MAX_STACK] using wlen = doc->where - doc->where_path, so when the previous recursive call left doc->where past where_path[100] the wlen exceeds MAX_STACK and the memcpy overflows save_path on the C stack; because the Oj::Doc parser imposes no JSON nesting-depth limit (relying on a C-stack pressure check), deeply nested attacker input reaches this path. This issue has been fixed in version 3.17.3.
Title Oj: Stack Buffer Overflow in Oj::Doc#each_child via Deeply Nested Input
Weaknesses CWE-125
CWE-787
References
Metrics cvssV3_1

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


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-01T12:35:39.923Z

Reserved: 2026-06-15T19:45:23.539Z

Link: CVE-2026-54592

cve-icon Vulnrichment

Updated: 2026-07-01T12:34:41.095Z

cve-icon NVD

No data.

cve-icon Redhat

Severity : Important

Publid Date: 2026-06-30T23:16:24Z

Links: CVE-2026-54592 - Bugzilla

cve-icon OpenCVE Enrichment

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

Weaknesses
  • CWE-120

    Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

  • CWE-125

    Out-of-bounds Read

  • CWE-787

    Out-of-bounds Write