CVE-2026-54902

Oj: Use-After-Free in Oj::Parser SAJ Long Key Callback

Published Jun 30, 2026 CVSS 4.0 · 6.3 Medium EPSS < 1% KEV · Not listed
Description
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-4803-1 ruby-oj security update
Debian DSA Debian DSA DSA-6521-1 ruby-oj security update
Github GHSA Github GHSA GHSA-m578-w5vf-rfcm Oj: Use-After-Free in Oj::Parser SAJ Long Key Callback
History
Type Values Removed Values Added
First Time appeared Ohler
Ohler oj
Vendors & Products Ohler
Ohler oj
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description 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.
Title Oj: Use-After-Free in Oj::Parser SAJ Long Key Callback
Weaknesses CWE-416
References
Metrics cvssV4_0

{'score': 6.3, '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'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jul 1, 2026, 12:37 PM
Reserved
Jun 16, 2026, 1:49 PM
Status
Deferred
Published
Jul 1, 2026, 12:16 AM
Modified
Oct 25, 2026, 5:10 PM
Severity
Moderate
Public date
Jun 30, 2026, 11:40 PM