CVE-2026-135138 in Mongoidinfo

Summary

by MITRE • 11/25/2026

Mongoid does not consistently apply its read-only attribute protection when attribute names are supplied dynamically by the caller. In an application that forwards caller-supplied attribute names into a document update, a user with basic application privileges may change values held inside a field the model declared immutable. This may result in unintended modification of data the application treats as trusted, such as flags used for its own access decisions.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 11/25/2026

The vulnerability identified within Mongoid represents a critical failure in attribute protection mechanisms, specifically concerning read-only fields when updates are processed through dynamic input channels. In typical Ruby on Rails applications utilizing Mongoid as an Object-Document Mapper, developers rely on the framework to enforce data integrity by marking certain attributes as immutable or read-only. These protections are designed to prevent accidental or malicious modification of sensitive model properties that govern application logic, such as user roles, account statuses, or internal flags. However, when attribute names are supplied dynamically by an external caller rather than being hardcoded in the update method, Mongoid fails to consistently apply its standard validation and protection checks. This inconsistency arises because the dynamic invocation bypasses the usual safeguards that inspect the model schema before allowing write operations on restricted fields.

From a technical perspective, this flaw allows for unauthorized attribute modification through what is effectively an incomplete object composition or mass assignment vulnerability. When an application forwards caller-supplied attribute names into a document update operation, it typically uses methods like save or update_attributes with a hash of parameters. If the parameter key corresponds to a field defined as read-only in the Mongoid model definition, the framework should reject the change and raise an error. Instead, due to the dynamic nature of the input, the protection logic is circumvented, allowing the value to be persisted directly into the MongoDB document. This behavior contradicts the explicit configuration set by the application developer, creating a discrepancy between intended security policy and actual runtime enforcement.

The operational impact of this vulnerability is severe for applications that rely on these protected fields for access control decisions or data integrity guarantees. An attacker with basic application privileges can exploit this flaw to modify values that are treated as trusted internal state variables. For instance, if an application uses a specific boolean flag to determine administrative rights and marks it as read-only to prevent users from elevating their own permissions, the dynamic update mechanism allows the user to flip this flag without authorization. This leads directly to privilege escalation, where low-privileged users gain elevated access levels, potentially compromising the confidentiality, integrity, and availability of the entire system. Furthermore, since MongoDB stores data in a schema-less format by default, once these values are written, they become part of the persistent state, making remediation difficult without manual database intervention or application-level fixes.

This vulnerability aligns with CWE-20 Improper Input Validation and CWE-915 Use of Incorrectly-Resolved Name or Reference, as it involves a failure to properly validate input against expected constraints before processing. In terms of the MITRE ATT&CK framework, this behavior facilitates Privilege Escalation via Tactic TA0004, specifically leveraging improper access control mechanisms to bypass intended restrictions. The attack vector is typically classified under Web Application Attack techniques where inputs are not sufficiently sanitized or validated against business logic constraints before being applied to data structures.

Mitigation strategies must focus on reinforcing input validation and restricting dynamic attribute updates at the application layer rather than relying solely on ORM-level protections which may have edge cases like this one. Developers should avoid passing user-supplied keys directly into update methods without rigorous whitelisting of allowed attributes. Implementing strict parameter filtering using tools such as Rails strong parameters or custom Mongoid callbacks can ensure that only explicitly permitted fields are modifiable by end-users. Additionally, auditing all code paths where dynamic attribute names are used for updates is essential to identify other potential instances of this flaw. Regular security testing and static analysis should be employed to detect patterns where model attributes are modified via unsanitized input streams, ensuring that read-only constraints remain enforced regardless of how the update request is constructed.

Responsible

Mongodb

Reservation

11/23/2026

Disclosure

11/25/2026

Moderation

accepted

CPE

ready

EPSS

0.00483

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!