Vulnerability · Published Jun 30, 2026 · Assigned by GitHub_M

CVE-2026-54592Oj: Stack Buffer Overflow in Oj::Doc#each_child via Deeply Nested Input

High 7.5

In plain English

A high-severity out-of-bounds read in oj from ohler55. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 26% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.5High
Exploit odds (30 days)0.3%top 74.0% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

Official 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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12ruby-oj3.14.2-1+deb12u1DEBIAN-CVE-2026-54592
Debian:13ruby-oj3.16.3-1+deb13u1DEBIAN-CVE-2026-54592
Debian:14ruby-oj3.17.3-1DEBIAN-CVE-2026-54592
RubyGemsoj3.17.3GHSA-3m6q-jj5j-38c9
Ubuntu:22.04:LTSruby-ojno fix listedUBUNTU-CVE-2026-54592
Ubuntu:24.04:LTSruby-ojno fix listedUBUNTU-CVE-2026-54592
Ubuntu:25.10ruby-ojno fix listedUBUNTU-CVE-2026-54592
Ubuntu:26.04:LTSruby-ojno fix listedUBUNTU-CVE-2026-54592
Ubuntu:26.10ruby-ojno fix listedUBUNTU-CVE-2026-54592

Affected products (as reported)

VendorProductVersions
ohler55 oj < 3.17.3

Weakness: CWE-125, CWE-787 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

References