# CVE-2026-54900: Oj: Negative-Size memcpy in Oj::Parser create_id Attribute Handling

> An attacker can cause a denial of service via heap corruption in the Oj Ruby gem when parsing JSON with create_id enabled and long keys.

- **Severity:** Medium 6.3 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 30 Jun 2026
- **Updated:** 1 Jul 2026
- **Also known as:** DEBIAN-CVE-2026-54900, GHSA-9cv6-qcjw-4grx, MINI-384c-qxp5-2xcc, MINI-3f8r-g9gw-4vgc, MINI-5jfc-wp5r-9rh8, MINI-9pwc-4494-p948, MINI-ff73-8q53-hhw9, MINI-h3vj-2gw4-2wpv, MINI-q84x-4xwj-hx66, MINI-r5qp-gg8f-xvqf, MINI-whw7-xqp4-vfpp, MINI-xp23-hqv9-q7f8, UBUNTU-CVE-2026-54900

## What is CVE-2026-54900?

CVE-2026-54900 is a medium-severity vulnerability in ohler55 oj, published on 30 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official 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.

Weakness: CWE-787 (Out-of-bounds Write), CWE-190 (Integer Overflow or Wraparound)

## Which versions are affected by CVE-2026-54900?

2 open source packages ship an affected version, including oj.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `oj` | RubyGems | All versions | 3.17.3 |
| `oj` | RubyGems | All versions | 3.17.3 |

## How do I fix CVE-2026-54900?

Upgrade oj to 3.17.3 or later.

## Is CVE-2026-54900 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-54900 exists.

Public exploit code:

- CVE-2026-54900, CVE-2026-54902 - Draft (github_poc): https://github.com/HORKimhab/CVE-2026-54900

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-54900 and fix it if it is affected.

What it is: CVE-2026-54900 is a medium-severity vulnerability in ohler55 oj, published on 30 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-54900 exists.

Affected packages and fixed versions:
- oj (RubyGems): affected all versions; fixed in 3.17.3
- oj (RubyGems): affected all versions; fixed in 3.17.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-54900/ (Markdown: https://insights.sbomify.com/CVE-2026-54900/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-54900
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-54900
- OSV: https://osv.dev/vulnerability/CVE-2026-54900

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-54900/
Summaries are generated and may contain mistakes; the official description above is the record.
