CVE-2026-54900

Oj: Negative-Size memcpy in Oj::Parser create_id Attribute 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, when in usual mode with create_id enabled, Oj::Parser#parse is vulnerable to heap corruption via a negative-size memcpy. When a JSON object key is exactly 65,535 bytes long, an integer truncation in form_attr (usual.c:63) converts the length to -1 before passing it to memcpy. This causes memcpy to copy SIZE_MAX bytes (interpreted as a huge size_t), corrupting heap memory and crashing the process. The issue has been fixed in version 3.17.2.

Analysis

AI-generated

Technical impact

Oj (Optimized JSON) is a Ruby gem that provides JSON parsing and marshalling. Prior to version 3.17.2, when the parser runs in usual mode with the create_id option enabled, it can crash the process by corrupting heap memory. A JSON object key that is exactly 65,535 bytes long triggers integer truncation in form_attr, converting the length to –1 before it is passed to memcpy. Because the size is interpreted as the largest possible value, memcpy copies an enormous amount of data, overwriting adjacent heap structures and causing a crash as a result of the heap corruption.

Affected Systems

The vulnerable component is the Ruby Oj JSON parsing gem (ohler55:oj). Any installation using a version earlier than 3.17.2 that enables the create_id option in usual mode and processes untrusted JSON data is affected. Applications that load external JSON documents through this configuration route are at risk.

Risk and Exploitability

The CVSS score of 6.3 indicates a moderate severity vulnerability. The EPSS score is below 1%, suggesting a very low probability of exploitation at this time. This issue maps to CWE-131 (Incorrect Size Handling). The vulnerability is not listed in the CISA KEV catalog. Based on the description, it is inferred that an attacker could craft a JSON document containing a 65,535‑byte key and supply it to a vulnerable application, which would trigger the negative‑size memcpy, corrupt the heap, and crash the process.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the Oj gem to version 3.17.2 or later.
  • If an upgrade is not possible, disable the create_id option in all Oj parsers to remove the vulnerable code path.
  • Validate the length of JSON object keys before parsing, rejecting keys.

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-9cv6-qcjw-4grx Oj: Negative-Size memcpy in Oj::Parser create_id Attribute Handling
History
Type Values Removed Values Added
Weaknesses CWE-131
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': 'total'}, '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 usual mode with create_id enabled, Oj::Parser#parse is vulnerable to heap corruption via a negative-size memcpy. When a JSON object key is exactly 65,535 bytes long, an integer truncation in form_attr (usual.c:63) converts the length to -1 before passing it to memcpy. This causes memcpy to copy SIZE_MAX bytes (interpreted as a huge size_t), corrupting heap memory and crashing the process. The issue has been fixed in version 3.17.2.
Title Oj: Negative-Size memcpy in Oj::Parser create_id Attribute Handling
Weaknesses CWE-190
CWE-787
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
  • CWE-131

    Incorrect Calculation of Buffer Size

  • CWE-190

    Integer Overflow or Wraparound

  • CWE-787

    Out-of-bounds Write

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jul 1, 2026, 3:48 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:34 PM