RubySec

Providing security resources for the Ruby community

CVE-2026-54500 (oj): Oj - intern.c form_attr (uninitialized stack read)

Oj - intern.c form_attr (uninitialized stack read)

Published: June 19, 2026

SECURITY IDENTIFIERS

GEM

oj

SEVERITY

CVSS v3.x: 5.3 (Medium)

PATCHED VERSIONS

>= 3.17.3

DESCRIPTION

Summary

Oj.load in :object mode reads uninitialized stack memory (and, for long keys, reads out of bounds) when parsing a JSON object whose key is 254 bytes or longer. The interned bytes can surface to the caller, disclosing process stack memory.

Impact

Information disclosure of process stack memory to a caller that parses untrusted JSON with Oj.load(..., mode: :object). For keys >= 256 bytes it is also an out-of-bounds read (CWE-125).

Severity is bounded by several preconditions: it requires :object mode (which is already discouraged for untrusted input), the leaked bytes are uncontrolled (the attacker cannot choose what is disclosed), and the data only reaches an attacker if the application surfaces the resulting Symbol or EncodingError back to them. Scored CVSS 5.3 (Medium) on that basis.

Patches

Fixed in 3.17.3: form_attr() now passes b to rb_intern3 (a one-character change mirroring the earlier usual.c fix). Verified on the fixed build: the same payload returns cleanly with no leak across repeated runs.

Credit

Reported by Zac Wang (@7a6163).

RELATED