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.
Published: 2026-06-30
Score: 2.1 Low
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

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.

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

Remediation

No vendor fix or workaround currently provided.

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
Github GHSA Github GHSA GHSA-35w3-pjm6-wj95 Oj: Heap Buffer Overflow in Oj.dump Exception Serialization via Large Indent
History

Tue, 07 Jul 2026 12:15:00 +0000

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


Wed, 01 Jul 2026 14:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

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


Wed, 01 Jul 2026 10:30:00 +0000

Type Values Removed Values Added
First Time appeared Ohler
Ohler oj
Vendors & Products Ohler
Ohler oj

Tue, 30 Jun 2026 23:45:00 +0000

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'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-01T12:39:09.194Z

Reserved: 2026-06-16T13:49:33.555Z

Link: CVE-2026-54896

cve-icon Vulnrichment

Updated: 2026-07-01T12:38:50.266Z

cve-icon NVD

No data.

cve-icon Redhat

Severity : Important

Publid Date: 2026-06-30T23:20:27Z

Links: CVE-2026-54896 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-07-09T14:30:05Z

Weaknesses