CVE-2026-54903

Oj: Integer Overflow in Oj.load 2GB String Handling

Published Jun 30, 2026 CVSS 4.0 · 6.3 Medium 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, Oj.load is vulnerable to heap corruption when parsing a JSON string longer than 2 GB. An integer overflow in buf_append_string (buf.h:61) converts the string length to a large negative size_t, causing memcpy to copy an astronomically large amount of data out of bounds. This crashes the process and can corrupt adjacent heap memory. The issue has been fixed in version 3.17.2.

Analysis

AI-generated

Technical impact

Oj.load, a JSON parsing function of the Ruby gem Oj, is vulnerable in versions before 3.17.2 to an integer overflow when handling a JSON string longer than 2 GB. The overflow occurs during a buffer append operation, converting the length to a large negative size_t and causing memcpy to copy an astronomically large amount of data out of bounds, which corrupts adjacent heap memory. The resulting heap corruption can crash the process and potentially modify other objects. The flaw is classified as integer overflow (CWE-190) and buffer overflow (CWE-787).

Affected Systems

Ruby applications that depend on the ohler55:oj gem, specifically any similar version earlier than 3.17.2 that uses Oj.load to parse untrusted or large JSON payloads.

Risk and Exploitability

The CVSS score of 6.3 indicates a medium severity vulnerability. The EPSS score of less than 1% suggests a very low probability of exploitation. Since the vulnerability is not listed in the CISA KEV catalog, the risk is primarily related to service disruption if JSON payloads are processed. Based on the description, it is inferred that the likely attack vector is supplying a JSON document larger than 2 GB to any application that uses Oj.load, which may be remotely reachable if the application accepts JSON over a network interface. The flaw is classified as integer overflow (CWE-190) and buffer overflow (CWE-787), and it may lead to denial of service or potentially corrupt adjacent memory, affecting application integrity.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the Oj gem to version 3.17.2 or newer, which contains a safeguard against processing strings larger than 2 GB.
  • If a quick upgrade is not possible, restrict the size of JSON input that is fed to Oj.load to less than 2 GB and add explicit validation before parsing.
  • Consider replacing Oj.load with a safer JSON parser such as Ruby's built-in JSON.parse for untrusted data or adding a wrapper that checks input length before parsing.

Generated by OpenCVE AI on August 1, 2026 at 23:54 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-475m-ph3x-64gp Oj: Integer Overflow in Oj.load 2GB String Handling
History
Type Values Removed Values Added
Weaknesses CWE-787
References
Metrics threat_severity

None

cvssV3_1

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

threat_severity

Important

Type Values Removed Values Added
Metrics ssvc

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

Type Values Removed Values Added
First Time appeared Ohler
Ohler oj
Ohler55
Ohler55 oj
Vendors & Products Ohler
Ohler oj
Ohler55
Ohler55 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, Oj.load is vulnerable to heap corruption when parsing a JSON string longer than 2 GB. An integer overflow in buf_append_string (buf.h:61) converts the string length to a large negative size_t, causing memcpy to copy an astronomically large amount of data out of bounds. This crashes the process and can corrupt adjacent heap memory. The issue has been fixed in version 3.17.2.
Title Oj: Integer Overflow in Oj.load 2GB String Handling
Weaknesses CWE-190
References
Metrics cvssV4_0

{'score': 6.3, 'vector': 'CVSS:4.0/AV:N/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:43 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:42 PM