Skip to main content

Oj gem CVE-2026-54900

MEDIUM
Use After Free (CWE-416)
2026-06-19 https://github.com/ohler55/oj GHSA-9cv6-qcjw-4grx
6.3
CVSS 4.0 · Vendor: https://github.com/ohler55/oj
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Identify endpoint parsing untrusted JSON with Oj usual+create_id
  2. Delivery
    Craft JSON body containing 65,535-byte key
  3. Exploit
    Submit body to target endpoint
  4. Install
    form_attr computes negative blen via int overflow
  5. C2
    memcpy issued with SIZE_MAX length
  6. Execute
    Heap slab corrupted
  7. Impact
    Worker process crashes (denial of service)

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Memory lifecycle management
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Privilege Escalation

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the target application to invoke Oj::Parser in :usual parsing mode with the create_id option set (e.g., create_id: 'json_class') and to feed it attacker-controlled JSON; the trigger itself is a single object key of exactly 65,535 bytes, which is reachable by any unauthenticated remote attacker who can submit a JSON body to that parser. Limiting factors: the default Oj entry points (Oj.load, Oj.safe_load, strict/compat modes without create_id) are NOT vulnerable, so applications that rely on those - the majority of Oj deployments - are not exposed; exploitation also requires the upstream stack to permit request bodies large enough to carry a ~65 KB key.

Impact

No CVSS vector was published, so impact must be inferred from the advisory. The vulnerable path requires the application to call Oj::Parser.new(:usual, create_id: …) - not the default Oj.load path - which materially narrows the exposed population, but for any service that does use that configuration the trigger is a single oversized JSON key with no authentication or user interaction required. Confirmed impact is heap corruption and process crash (availability loss); the maintainer-provided PoC reliably reproduces under ASAN. Memory-disclosure or code-execution impact is plausible given the controlled large-memcpy primitive but is not demonstrated in the advisory, so any C/I rating beyond None is speculative. EPSS and CISA KEV status are not present in the input, and the tag set incorrectly lists 'Python' and 'Use After Free' - those appear to be auto-classification noise and should not drive triage.

Exploit ScenarioDerived

An attacker identifies a public HTTP endpoint that deserializes user-controlled JSON with Oj::Parser.new(:usual, create_id: 'json_class') - a configuration common in Ruby services that round-trip Ruby objects through JSON. They POST a body of the form {"json_class":"Oj::Bag","AAAA…(65535 A's)":1} as shown in the maintainer's PoC, triggering the negative-size memcpy and crashing the worker process; repeated requests cause sustained denial of service across the application pool.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 19, 2026

Heap corruption in the Oj Ruby JSON parser allows remote attackers to crash or potentially corrupt memory in applications that parse untrusted JSON with Oj::Parser in :usual mode when the create_id option is enabled. A 65,535-byte object key triggers an integer truncation in form_attr (ext/oj/usual.c:63) that turns the buffer length into (size_t)-1, causing memcpy to write SIZE_MAX bytes onto a fixed 65,536-byte cache slab. No public exploit identified at time of analysis beyond the maintainer-supplied reproduction script in GHSA-9cv6-qcjw-4grx.

RemediationAI

Upgrade to oj 3.17.3 or later (vendor-released patch: 3.17.3) - update your Gemfile to gem 'oj', '>= 3.17.3' and run bundle update oj, then redeploy. Until you can upgrade, the most reliable workaround is to stop using Oj::Parser in :usual mode with create_id and instead use Oj.load or Oj.safe_load (side effect: applications relying on json_class-based object reconstitution will need to handle hashes manually). A second compensating control is to enforce a strict maximum JSON-key length at an upstream layer (reverse proxy, Rack middleware, schema validator) - anything well under 65,535 bytes blocks the trigger, with the trade-off that legitimate large keys are rejected. See the GitHub advisory at https://github.com/ohler55/oj/security/advisories/GHSA-9cv6-qcjw-4grx for the upstream fix commit.

Affected Packages

rubygems oj fix: 3.17.3

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in rubygems

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Oj is a widely used high-performance C-extension JSON parser for Ruby that, in :usual mode, supports a create_id directive (commonly json_class) to instantiate Ruby objects from JSON. The vulnerable function form_attr prefixes an @ to a key to build a Ruby instance-variable identifier, but computes the buffer length as int blen = (int)slen + 1. When slen equals 65,535 the +1 overflows the signed int to a negative value, which is then implicitly cast to size_t, producing SIZE_MAX. The cache (cache_intern at cache.c:326) operates on 65,536-byte slabs, so the over-long memcpy runs straight off the slab into adjacent heap, classic CWE-680 / CWE-190 territory (the CVE entry tags it CWE-416 Use-After-Free, which appears to be a mis-classification - the ASAN trace is negative-size-param, not UAF).

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/ohler55/oj) PRIMARY 6.3 MEDIUM
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
vuln.today AI 7.5 HIGH

Reachable over the network through any JSON endpoint using the affected parser config, no auth or interaction, trivial trigger; confirmed impact is process crash (A:H), C/I impact not demonstrated.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Red Hat 7.5 HIGH

Primary rating from Vendor (https://github.com/ohler55/oj).

CVSS VectorVendor: https://github.com/ohler55/oj

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
Low
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
CVSS changed
Jul 01, 2026 - 00:22 NVD
6.3 (MEDIUM)

DescriptionCVE.org

Summary

Oj::Parser#parse in usual mode with create_id enabled 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.

Version

  • Software: oj gem
  • Affected: all versions with ext/oj/usual.c
  • Latest tested: 3.17.1 (confirmed present)

Details

ext/oj/usual.c, form_attr:

c
// usual.c:55-64
static ID form_attr(const char *str, size_t slen) {
    char        buf[4096];
    // ...
    int  blen = (int)slen + 1;    // ← truncates: 65535 + 1 = 65536 → wraps to 0
                                  //   or: 65535 cast to int = 65535 (fits),
                                  //   but blen = 65536 → INT overflow on +1 if slen=INT_MAX
    // ...
    memcpy(buf, "@", 1);
    memcpy(buf + 1, str, (size_t)blen);  // ← size_t(-1) = SIZE_MAX
}

The cache (cache_intern) uses a fixed 65,536-byte slab. When slen = 65535, the arithmetic wraps and memcpy is called with (size_t)-1.

ASAN report:

==80452==ERROR: AddressSanitizer: negative-size-param: (size=-1)
    #0 memcpy
    #1 form_attr          /ext/oj/usual.c:63
    #2 cache_intern       /ext/oj/cache.c:326
    #3 get_attr_id        /ext/oj/usual.c:186
    #4 close_object_create  /ext/oj/usual.c:374
    #5 parse              /ext/oj/parser.c:693
    #6 parser_parse       /ext/oj/parser.c:1408
0x531000528800 is located 0 bytes inside of 65536-byte region [0x531000528800, 0x531000538800)

Reproduce

Generate the payload:

python
key = 'A' * 65535
with open('poc.json', 'w') as f:
    f.write('{"json_class":"Oj::Bag","' + key + '":1}')

Trigger:

ruby
require 'oj'
Oj::Parser.new(:usual, create_id: 'json_class').parse(STDIN.read)

Executive ViewAI

Why It Matters

The Oj Ruby JSON parser contains a heap corruption vulnerability (CVE-2026-54900) that allows remote attackers to crash or corrupt memory in applications using the library with specific configuration settings. Organizations running Ruby applications that parse untrusted JSON data face risks to service availability and data integrity. No vendor patch is currently available, requiring immediate implementation of compensating controls.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: (1) Disable create_id option if not required for application functionality; (2) Validate and reject JSON with object keys exceeding 65,535 bytes at application entry point; (3) Implement strict request size limits and rate limiting at network boundary; (4) Run vulnerable applications in resource-constrained containers to contain memory corruption; (5) Enable memory usage monitoring and alerting for unexpected process behavior; (6) Migrate to alternative JSON parsers unaffected by this vulnerability where operationally feasible.

Threat Intelligence Overview

EPSS Score
0.3%
Top 83% exploitable
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS GHSA Vendor GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

32
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +32
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Use-after-free vulnerabilities occur when a program continues to access memory through a pointer after that memory has been deallocated.

Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Affected Products (CPE)CVE.org

pkg:rubygems/oj

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy