Description
Oj (Optimized JSON) is a JSON parser and Object marshaller packaged as a Ruby gem. Prior to version 3.17.2, disabling symbol_keys on a reused Oj::Parser instance triggers a heap use-after-free. When symbol_keys is toggled from true to false, opt_symbol_keys_set frees the internal key cache (cache_free) but does not clear the pointer. The next parse call reads from the freed cache via cache_intern, producing a use-after-free. This 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

The vulnerability is a heap use‑after‑free that occurs when the symbol_keys option on a reused Oj::Parser instance is toggled from true to false. The internal key cache is freed but the pointer is not cleared, so the subsequent parse call reads from the freed memory, potentially corrupting heap data. This flaw corresponds to the classic use‑after‑free (CWE‑416) and improper memory management (CWE‑825). It can lead to unpredictable behavior, including crashes, data leakage, or arbitrary code execution, thereby compromising confidentiality, integrity, or availability of the application.

Affected Systems

The affected product is the Ruby gem oj supplied by ohler55. Any Ruby application that loads oj 3.17.1 or earlier and reuses an Oj::Parser instance while changing the symbol_keys setting is susceptible. The library is commonly embedded in web services, background workers, and command‑line tools that process JSON payloads.

Risk and Exploitability

The CVSS score of 6.3 indicates moderate severity, and the EPSS score of less than 1% shows a very low probability of exploitation. It is not listed in the CISA KEV catalog. Based on the description, the attack vector is most likely an attacker who can influence the Ruby code path that parses JSON, such as through a custom plug‑in, user‑supplied data, or a compromised dependency. If an attacker can force a parser instance to transition between symbol_keys settings, they can trigger the use‑after‑free and achieve memory corruption, potentially leading to further compromise.

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

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the oj gem to version 3.17.2 or later.
  • If your application must toggle symbol_keys, create a new Oj::Parser instance for each configuration instead of reusing one.
  • Review the code to locate any Oj::Parser reuse patterns, ensure the upgraded gem is in use, and refactor those paths accordingly.

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

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-2cw7-v8ff-p88r Oj: Use-After-Free in Oj::Parser Symbol Key Cache Toggle
History

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

Type Values Removed Values Added
Weaknesses CWE-825
References
Metrics threat_severity

None

cvssV3_1

{'score': 6.5, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:H'}

threat_severity

Moderate


Fri, 03 Jul 2026 02:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, '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. Prior to version 3.17.2, disabling symbol_keys on a reused Oj::Parser instance triggers a heap use-after-free. When symbol_keys is toggled from true to false, opt_symbol_keys_set frees the internal key cache (cache_free) but does not clear the pointer. The next parse call reads from the freed cache via cache_intern, producing a use-after-free. This issue has been fixed in version 3.17.2.
Title Oj: Use-After-Free in Oj::Parser Symbol Key Cache Toggle
Weaknesses CWE-416
References
Metrics cvssV4_0

{'score': 6.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-01T14:26:28.538Z

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

Link: CVE-2026-54899

cve-icon Vulnrichment

Updated: 2026-07-01T13:38:22.588Z

cve-icon NVD

No data.

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-06-30T23:03:15Z

Links: CVE-2026-54899 - Bugzilla

cve-icon OpenCVE Enrichment

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

Weaknesses