Oj: Use-After-Free in Oj::Parser SAJ Long Key Callback
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Attack requirements
- Present
- Impact type
- —
- Confidentiality · integrity · availability
- None · None · Low
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| ohler55 | oj | before 3.17.2 | 3.17.2 | Patch available | CNA |
| — | oj (RubyGems) | before 3.17.3 | 3.17.3 | Patch available | GHSA-m578-w5vf-rfcm |
- oj Vendorohler55 Affected before 3.17.2 Fixed in 3.17.2 Patch available CNA
- oj (RubyGems) Vendor— Affected before 3.17.3 Fixed in 3.17.3 Patch available GHSA-m578-w5vf-rfcm
Remediation
- Fix · CNA oj (ohler55) Fixed in 3.17.2
- Fix · GHSA-m578-w5vf-rfcm oj (RubyGems) Fixed in 3.17.3 Advisory →
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2026-54902
- 2026-10-03 Alias added: GHSA-m578-w5vf-rfcm
References
More ohler55 vulnerabilities
- TI-2026-39426 Oj: Stack Buffer Overflow in Oj::Doc#each_child via Deeply Nested Input CVSS 3.1HIGH 7.5
- TI-2026-39672 Oj: Negative-Size memcpy in Oj::Parser create_id Attribute Handling CVSS 4.0MEDIUM 6.3
- TI-2026-39348 Oj: Stack Buffer Overflow in Oj.dump via Large Indent CVSS 4.0MEDIUM 6.3
- TI-2026-39675 Oj: Integer Overflow in Oj.load 2GB String Handling CVSS 4.0MEDIUM 6.3
- TI-2026-39673 Oj: Use-After-Free in Oj::Parser array_class/hash_class GC Marking CVSS 4.0MEDIUM 6.3
- TI-2026-39671 Oj: Use-After-Free in Oj::Parser Symbol Key Cache Toggle CVSS 4.0MEDIUM 6.3
Sources
- CVE-2026-54902 · CVE Program
- CVE-2026-54902 · NVD
- FIRST EPSS
- GHSA-m578-w5vf-rfcm · GitHub Advisory Database · CC BY 4.0
- CVE-2026-54902 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences