CVE-2026-54896

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

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

Analysis

AI-generated

Technical impact

The vulnerability affects Oj, an optimized JSON Ruby gem. In versions prior to 3.17.2, when run in object mode, Oj.dump can trigger a heap buffer overflow if it serializes a Ruby Exception object with a very large :indent argument. The serializer preallocates a buffer based solely on the object’s attributes and then appends repeatedly the :indent string. With an indent such as 5000, the cumulative 5,000-byte indent strings overflow the original 13,150-byte buffer and corrupt adjacent memory. Because this flaw is a classic heap-bounds overwrite (CWE-122) and also maps to CWE-787, an attacker who can provoke the dump may cause arbitrary memory corruption, typically resulting in a local denial-of-service for the Ruby process. The issue has been fixed in version 3.17.2.

Affected Systems

Any deployment using the ohler55 oj gem prior to version 3.17.2 that employs Oj.dump in object mode for Exception objects with a sizeable :indent argument. No additional vendor or product information is specified beyond the gem name and vulnerable version range.

Risk and Exploitability

The CVSS score of 2.1 classifies the issue as low severity. The EPSS is less than 1%, indicating a low likelihood of widespread exploitation at this time. The likely attack vector is an attacker who can influence the Oj.dump call and the :indent argument, typically through crafted application input. Because the vulnerability is limited to internal serialization logic, the immediate consequence is a local denial of service rather than remote code execution, and no public exploits have been reported.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the oj gem to version 3.17.2 or later, which addresses the buffer overflow bug.
  • If upgrade is not immediately feasible, avoid serializing Exception objects with Oj.dump or limit the :indent parameter to a modest size (for example, less than 100).
  • Deploy the application with these mitigations in place and monitor for abnormal crashes or memory corruption that could signal residual or accidental exploitation.

Generated by OpenCVE AI on July 9, 2026 at 14:28 UTC.

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-35w3-pjm6-wj95 Oj: Heap Buffer Overflow in Oj.dump Exception Serialization via Large Indent
History
Type Values Removed Values Added
Weaknesses CWE-787
References
Metrics threat_severity

None

cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

threat_severity

Important

Type Values Removed Values Added
Metrics ssvc

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

Type Values Removed Values Added
First Time appeared Ohler
Ohler oj
Vendors & Products Ohler
Ohler oj
Type Values Removed Values Added
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.
Title Oj: Heap Buffer Overflow in Oj.dump Exception Serialization via Large Indent
Weaknesses CWE-122
References
Metrics cvssV4_0

{'score': 2.1, 'vector': 'CVSS:4.0/AV:L/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:39 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
Important
Public date
Jun 30, 2026, 11:20 PM