{"description":"Trending threats, MITRE ATT\u0026CK coverage, and detection metadata. Fed continuously.","feed_url":"https://feed.craftedsignal.io/products/oj-gem/feed.json","home_page_url":"https://feed.craftedsignal.io/","items":[{"_cs_actors":[],"_cs_cpes":[],"_cs_cves":[],"_cs_exploited":false,"_cs_has_poc":false,"_cs_poc_references":[],"_cs_products":["oj gem"],"_cs_severities":["high"],"_cs_tags":["ruby","vulnerability","heap-overflow"],"_cs_type":"advisory","_cs_vendors":["Oj"],"content_html":"\u003cp\u003eThe \u003ccode\u003eoj\u003c/code\u003e Ruby gem, specifically its \u003ccode\u003eOj.dump\u003c/code\u003e function in object serialization mode, is affected by a heap buffer overflow vulnerability, identified as CVE-2026-54896. This flaw impacts all versions of the gem that include the \u003ccode\u003eext/oj/dump.h\u003c/code\u003e component, up to and including version 3.17.1. The vulnerability occurs when an application attempts to serialize an \u003ccode\u003eException\u003c/code\u003e object using \u003ccode\u003eOj.dump\u003c/code\u003e with a particularly large \u003ccode\u003e:indent\u003c/code\u003e value (e.g., 5000). The underlying C implementation pre-allocates a buffer based on the object's attributes but fails to account for the substantial additional memory required by the indent string, leading to repeated writes beyond the buffer's boundary. This memory corruption can result in application crashes, denial of service, or potentially enable arbitrary code execution. Defenders should prioritize patching and validating \u003ccode\u003eoj\u003c/code\u003e gem versions in their Ruby applications.\u003c/p\u003e\n\u003ch2 id=\"attack-chain\"\u003eAttack Chain\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003e\u003cstrong\u003eInitial Input\u003c/strong\u003e: An attacker sends crafted JSON input to a vulnerable application that utilizes the \u003ccode\u003eoj\u003c/code\u003e gem.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eObject Deserialization\u003c/strong\u003e: The application processes the attacker's input using \u003ccode\u003eOj.load\u003c/code\u003e in object mode, which creates a Ruby \u003ccode\u003eException\u003c/code\u003e object (e.g., \u003ccode\u003eRuntimeError\u003c/code\u003e) from the JSON.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eVulnerable Serialization Call\u003c/strong\u003e: A legitimate application component subsequently attempts to serialize this \u003ccode\u003eException\u003c/code\u003e object back to JSON using \u003ccode\u003eOj.dump\u003c/code\u003e, with an excessively large \u003ccode\u003e:indent\u003c/code\u003e value (e.g., 5000), which might be attacker-controlled or a misconfigured application setting.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eInsufficient Buffer Allocation\u003c/strong\u003e: Internally, \u003ccode\u003eOj.dump\u003c/code\u003e (specifically \u003ccode\u003edump_obj_attrs\u003c/code\u003e) allocates a memory buffer for the serialization output, but this buffer's size is based on the object's attributes and does not adequately account for the combined size of the large indentation strings.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eHeap Buffer Overflow\u003c/strong\u003e: The \u003ccode\u003efill_indent\u003c/code\u003e function is repeatedly called during serialization to add indentation. When writing the large indent string (e.g., 5000 bytes) into the pre-allocated buffer, it exceeds the available space.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMemory Corruption and Impact\u003c/strong\u003e: This repeated out-of-bounds writing causes a heap buffer overflow, corrupting adjacent memory. This typically leads to a denial of service through an application crash or, in more advanced scenarios, could be leveraged for arbitrary code execution.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"impact\"\u003eImpact\u003c/h2\u003e\n\u003cp\u003eThe primary impact of CVE-2026-54896 is memory corruption, leading to the affected Ruby application crashing and resulting in a denial of service. If an attacker can reliably control the execution flow after the overflow, it could potentially be escalated to remote code execution. Although no specific victim counts or targeted sectors have been disclosed, any Ruby application utilizing the \u003ccode\u003eoj\u003c/code\u003e gem in a manner that deserializes untrusted input and subsequently reserializes \u003ccode\u003eException\u003c/code\u003e objects with large indent values is at risk.\u003c/p\u003e\n\u003ch2 id=\"recommendation\"\u003eRecommendation\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003ePatch CVE-2026-54896\u003c/strong\u003e: Immediately upgrade the \u003ccode\u003eoj\u003c/code\u003e gem to version \u003ccode\u003e3.17.2\u003c/code\u003e or later to mitigate CVE-2026-54896.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eImplement Application-Level Controls\u003c/strong\u003e: Developers should ensure that user-controlled input does not dictate the \u003ccode\u003e:indent\u003c/code\u003e parameter for \u003ccode\u003eOj.dump\u003c/code\u003e calls and avoid using excessively large hardcoded indent values.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eDeploy Sigma Rules\u003c/strong\u003e: Deploy the provided Sigma rules to your SIEM solution to detect abnormal \u003ccode\u003eruby\u003c/code\u003e process terminations or crash dump creations, which may indicate exploitation attempts.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eEnable Process Monitoring\u003c/strong\u003e: Ensure robust process creation and termination logging is enabled for Ruby applications (e.g., Sysmon on Windows, Auditd on Linux) to capture potential crash-related events.\u003c/li\u003e\n\u003c/ul\u003e\n","date_modified":"2026-06-19T19:57:25Z","date_published":"2026-06-19T19:57:25Z","id":"https://feed.craftedsignal.io/briefs/2026-06-oj-heap-buffer-overflow/","summary":"The `Oj.dump` function in the Ruby `oj` gem, when operating in object mode, is vulnerable to a heap buffer overflow (CVE-2026-54896) when serializing `Exception` objects with an excessively large `:indent` value, leading to memory corruption and potential denial of service or remote code execution.","title":"Heap Buffer Overflow in Oj.dump Exception Serialization via Large Indent (CVE-2026-54896)","url":"https://feed.craftedsignal.io/briefs/2026-06-oj-heap-buffer-overflow/"}],"language":"en","title":"CraftedSignal Threat Feed - Oj Gem","version":"https://jsonfeed.org/version/1.1"}