{"id":"CVE-2026-54902","published":"2026-06-30T23:40:32Z","modified":"2026-07-01T12:37:40Z","title":"Oj: Use-After-Free in Oj::Parser SAJ Long Key Callback","vendor":"ohler55","product":"oj","tier":"tail","description":{"text":"Oj (Optimized JSON) is a JSON parser and Object marshaller packaged as a Ruby gem. Prior to version 3.17.2, is vulnerable to Use-After-Free when in SAJ mode. The Oj::Parser does not protect cached object keys (≥ 35 bytes) from garbage collection, and a Ruby callback that triggers GC inside hash_end can cause the key string to be reclaimed while the C parser still holds a pointer to it. The subsequent access to the freed string VALUE results in a segfault, confirmed by an RIP pointing to address 0x4242 (a canary-style pattern suggesting control over the freed memory's content). This issue has been fixed in version 3.17.2.","provenance":"source","from":"CVE.org"},"cvss":{"score":6.3,"severity":"MEDIUM","version":"4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00499,"percentile":0.43653,"provenance":"source"},"cwes":[{"id":"CWE-416","name":"Use After Free"}],"references":[{"url":"https://github.com/ohler55/oj/security/advisories/GHSA-m578-w5vf-rfcm","tags":["x_refsource_CONFIRM"]}],"priority":{"score":13.1,"factors":[{"name":"EPSS percentile","points":8.73},{"name":"CVSS severity","points":4.41}]},"vendorSlug":"ohler55","affectedVersions":[{"vendor":"ohler55","product":"oj","versions":["< 3.17.2"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"partial","timestamp":"2026-07-01T12:37:35.388593Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"RubyGems","package":"oj","vulnerableRanges":["<3.17.3"],"patched":["3.17.3"],"from":["GHSA-m578-w5vf-rfcm"],"provenance":"source"}],"summary":{"text":"The Oj gem's JSON parser (Oj::Parser in SAJ mode, prior to 3.17.2) contains a use-after-free flaw: cached object keys of 35 bytes or more are not protected from garbage collection, so a Ruby callback that triggers GC during hash processing can free a key string the C parser still references. An attacker can exploit this by supplying crafted JSON to an application that parses it with the vulnerable Oj::Parser in SAJ mode, with no authentication or user interaction required, and the result is a crash via access to the freed memory.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:53:39Z"},"euvd":{"id":"EUVD-2026-40857","exploited":false,"provenance":"source"}}