CVE-2026-54896 Oj: Heap Buffer Overflow in Oj.dump Exception Serialization via Large Indent
A heap buffer overflow in the Oj Ruby gem allows attackers to corrupt memory and potentially execute code when serializing exceptions with large indent values.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2026-54896?
CVE-2026-54896 is a low-severity memory corruption vulnerability in ohler55 oj, published on 30 Jun 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
Oj (Optimized JSON) is a JSON parser and Object marshaller packaged as a Ruby gem. In versions prior to 3.17.2, when in object mode, Oj.dump 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. This issue has been fixed in version 3.17.2.
Weakness: CWE-122
Which versions are affected by CVE-2026-54896?
2 open source packages ship an affected version, including oj.
| Package | Affected | Fixed in |
|---|---|---|
oj RubyGems | All versions | 3.17.3 |
oj RubyGems | All versions | 3.17.3 |
How do I fix CVE-2026-54896?
Upgrade oj to 3.17.3 or later.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is CVE-2026-54896 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-54896 exists.
Sources
Also known as DEBIAN-CVE-2026-54896, GHSA-35w3-pjm6-wj95, MINI-3r2g-q6gq-rx5r, MINI-52fw-7vwf-rj7r, MINI-63mw-777f-62vj, MINI-8h89-fr8q-3m29 and 7 more.