# CVE-2026-54896: Oj: Heap Buffer Overflow in Oj.dump Exception Serialization via Large Indent

> A heap buffer overflow in the Oj Ruby gem allows attackers to corrupt memory and potentially execute code when serializing exceptions with large indent values.

- **Severity:** Low 2.1 (`CVSS:4.0/AV:L/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:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 30 Jun 2026
- **Updated:** 1 Jul 2026
- **Also known as:** DEBIAN-CVE-2026-54896, GHSA-35w3-pjm6-wj95, MINI-3r2g-q6gq-rx5r, MINI-52fw-7vwf-rj7r, MINI-63mw-777f-62vj, MINI-8h89-fr8q-3m29, MINI-8qr3-f4w3-r78w, MINI-j662-pvcj-gxpm, MINI-j8fg-x7r2-p3vq, MINI-p3fp-xq77-grpf, MINI-ppmw-vc27-38pv, MINI-x33r-65pf-4cgv, UBUNTU-CVE-2026-54896

## What is CVE-2026-54896?

CVE-2026-54896 is a low-severity memory corruption vulnerability in ohler55 oj, published on 30 Jun 2026. It can only be exploited from the same machine or local network, 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 object mode, Oj.dump is vulnerable to a heap buffer overflow when serializing Exception objects with a large :indent value. The serializer allocates a buffer sized for the object's attributes but does not account for the indent bytes added on each write. With indent: 5000, the accumulation of 5,000-byte indent strings overflows the 13,150-byte heap allocation, corrupting adjacent heap memory. This issue has been fixed in version 3.17.2.

Weakness: CWE-122 (Heap-based Buffer Overflow)

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

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-54896?

Upgrade oj to 3.17.3 or later.

## Is CVE-2026-54896 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2026-54896 is a low-severity memory corruption vulnerability in ohler55 oj, published on 30 Jun 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-54896 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-54896/ (Markdown: https://insights.sbomify.com/CVE-2026-54896/index.md)
```

## Sources

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

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