RubySec

Providing security resources for the Ruby community

CVE-2026-54896 (oj): Oj - Heap Buffer Overflow in Oj.dump Exception Serialization via Large Indent

Oj - Heap Buffer Overflow in Oj.dump Exception Serialization via Large Indent

Published: June 19, 2026

SECURITY IDENTIFIERS

GEM

oj

PATCHED VERSIONS

>= 3.17.3

DESCRIPTION

Summary

Oj.dump in object mode is vulnerable to a heap buffer overflow when serializing Exception objects with a large :indent value. The serializer allocates a buffer sized for the object's attributes but does not account for the indent bytes added on each write. With indent: 5000, the accumulation of 5,000-byte indent strings overflows the 13,150-byte heap allocation, corrupting adjacent heap memory.

RELATED