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

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), CWE-190 (Integer Overflow) and CWE-787 (Out-of-Bounds Write). 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.

Generated by OpenCVE AI on July 21, 2026 at 15:15 UTC.

Remediation

No vendor fix or workaround currently provided.

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 July 21, 2026 at 15:15 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-9cv6-qcjw-4grx Oj: Negative-Size memcpy in Oj::Parser create_id Attribute Handling
History

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

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


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

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'total'}, '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 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'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-01T15:48:35.112Z

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

Link: CVE-2026-54900

cve-icon Vulnrichment

Updated: 2026-07-01T15:47:34.142Z

cve-icon NVD

No data.

cve-icon Redhat

Severity : Important

Publid Date: 2026-06-30T23:34:05Z

Links: CVE-2026-54900 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-07-21T15:30:07Z

Weaknesses
  • CWE-131

    Incorrect Calculation of Buffer Size

  • CWE-190

    Integer Overflow or Wraparound

  • CWE-787

    Out-of-bounds Write