CVE-2026-135226 in Ruby Driver
Summary
by MITRE • 11/25/2026
A type-confusion weakness in the Extended JSON parsing component of BSON for Ruby allows a party who can supply parser input to influence how a serialized document is framed. Content placed in one value may be read back as additional or replacement document fields. An unauthenticated party supplying input to an application that parses untrusted Extended JSON and stores the result may cause unintended modification of stored data.
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 11/28/2026
The vulnerability identified involves a critical type-confusion weakness within the BSON parser for Ruby, specifically affecting its handling of Extended JSON formats. This flaw arises from improper validation or conversion logic when processing serialized documents, allowing an attacker to manipulate how fields are framed and interpreted by the application. In normal operation, BSON parsers strictly enforce data types and structural boundaries to ensure that a value placed in one field remains isolated within that specific context. However, due to this type-confusion error, content injected into one part of the input can be misinterpreted as additional or replacement document fields upon deserialization. This breakdown in boundary enforcement means that the internal representation of the data structure becomes corrupted, leading to unexpected behavior where user-supplied values overwrite existing keys or introduce new ones without proper authorization checks.
From a technical perspective, this issue is classified under CWE-843, which refers to Accessing Memory with Incorrect Type Specification, although in the context of high-level language parsers like Ruby's BSON implementation, it often manifests as a logical type confusion where string inputs are coerced into object structures incorrectly. The attack vector requires an unauthenticated party to supply maliciously crafted Extended JSON input to an application that parses this data and subsequently stores or processes the resulting document. Because the parser fails to distinguish between intended field values and structural delimiters, it allows for arbitrary key injection. This capability effectively bypasses standard access controls if those controls rely on specific field names or structures that can be manipulated through this parsing flaw.
The operational impact of this vulnerability is significant, particularly in applications where user input directly influences database entries or internal state management. An attacker who successfully exploits this type-confusion weakness can cause unintended modification of stored data. This could lead to privilege escalation if administrative fields are overwritten with non-administrative values or vice versa, integrity violations by altering critical business logic parameters, and potential denial of service through the introduction of malformed structures that crash subsequent processing steps. In web applications using MongoDB or similar BSON-based storage systems, this flaw allows for NoSQL injection-like effects even when traditional input validation is present, as the exploitation occurs at the serialization layer rather than during initial request parsing.
Mitigation strategies must focus on updating to patched versions of the BSON library that address the type-confusion logic in the Extended JSON parser. Developers should also implement strict allow-listing for expected fields before any deserialization or storage operations occur, ensuring that only predefined keys are accepted into data structures regardless of what the parser might infer from malformed input. Additionally, applying defense-in-depth measures such as output encoding and rigorous schema validation at the application layer can help detect anomalies in document structure before they persist in persistent storage. Regular security audits focusing on serialization libraries are essential to identify similar weaknesses where type boundaries are not strictly enforced during data transformation processes.