{"id":"CVE-2026-54592","published":"2026-06-30T23:16:24Z","modified":"2026-07-01T12:35:39Z","title":"Oj: Stack Buffer Overflow in Oj::Doc#each_child via Deeply Nested Input","vendor":"ohler55","product":"oj","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.5,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00328,"percentile":0.26519,"provenance":"source"},"cwes":[{"id":"CWE-125","name":"Out-of-bounds Read"},{"id":"CWE-787","name":"Out-of-bounds Write"}],"references":[{"url":"https://github.com/ohler55/oj/security/advisories/GHSA-3m6q-jj5j-38c9","tags":["x_refsource_CONFIRM"]}],"priority":{"score":10.6,"factors":[{"name":"EPSS percentile","points":5.3},{"name":"CVSS severity","points":5.25}]},"vendorSlug":"ohler55","affectedVersions":[{"vendor":"ohler55","product":"oj","versions":["< 3.17.3"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"partial","timestamp":"2026-07-01T12:35:37.238466Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"RubyGems","package":"oj","vulnerableRanges":["<3.17.3"],"patched":["3.17.3"],"from":["GHSA-3m6q-jj5j-38c9"],"provenance":"source"}],"summary":{"text":"The Oj (Optimized JSON) Ruby gem, prior to version 3.17.3, has a stack buffer overflow in Oj::Doc#each_child: when called recursively over deeply nested JSON, the document's path index runs past its fixed-size array and a later copy overflows a stack-local buffer, which aborts the process. An unauthenticated remote attacker can trigger this over the network by supplying deeply nested JSON input that is processed through Oj::Doc with recursive each_child calls, with no user interaction required, resulting in denial of service.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:05:31Z"},"euvd":{"id":"EUVD-2026-40851","exploited":false,"provenance":"source"}}