What’s Vulnerable › Vulnerabilities
CVE-2026-54592: Oj: Stack Buffer Overflow in Oj::Doc#each_child via Deeply Nested Input
- Severity: high (CVSS 7.5 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 0.3% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2026-07-01 · updated 2026-10-25
- Weakness: CWE-125
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 products
- Rubygems Oj: before 3.17.3; 0.5, 0.5.1, 0.5.2, 0.6.0, 0.7.0, 0.8.0 (+288) — fixed in 3.17.3
- ohler55 oj: before 3.17.3
How to fix
Upgrade to a fixed version: Rubygems Oj 3.17.3. Check the vendor advisory for mitigations.
References
- https://github.com/ohler55/oj/security/advisories/GHSA-3m6q-jj5j-38c9
- https://github.com/ohler55/oj/security/advisories/GHSA-3m6q-jj5j-38c9
Get alerted when CVE-2026-54592 or the next vulnerability affects your stack