What’s Vulnerable › Vulnerabilities
CVE-2026-54898: Oj: Use-After-Free in Oj::Parser SAJ Callback via Input Mutation
- Severity: low (CVSS 2.1 v4.0)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 0.2% 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-416
Description
Oj (Optimized JSON) is a JSON parser and Object marshaller packaged as a Ruby gem. In versions prior to 3.17.2,Oj::Parser#parse is vulnerable to a heap use-after-free when a SAJ/SAJ2 callback mutates the input JSON string during parsing. The C engine holds a raw const byte * pointer into the Ruby string's internal buffer. If a callback (e.g. hash_start) resizes the string — for example by calling String#replace with a longer value — Ruby reallocates the string buffer and frees the old one. The C parser's pointer is left dangling; the next character read at parser.c:607 is a use-after-free. This issue has been fixed in version 3.17.2.
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.2
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-q2gm-54r6-8fwm
- https://github.com/ohler55/oj/security/advisories/GHSA-q2gm-54r6-8fwm
Get alerted when CVE-2026-54898 or the next vulnerability affects your stack