Summary
A logic flaw in the query-building layer of the Mongoid object-document mapper (MongoDB Ruby) causes a model-level default restriction (default scope) that is meant to return no records to be silently discarded when combined into a query. This is an incorrect authorization issue (CWE-863). Versions 4.0.0 up to, but not including, 9.1.3 are affected.
Per the CVSS vector (8.1, High), the attack is carried out over the network with low complexity. It requires only basic application privileges and no interaction from another user. An ordinary request is enough.
An attacker may read, change or remove records the restriction was intended to withhold. Confidentiality and integrity impact is high, with no availability impact. The vulnerability is not listed in CISA KEV and no EPSS data is available.
Who is affected
Organizations building or running Ruby/Rails applications with Mongoid 4.0.0 up to, but not including, 9.1.3, especially those that rely on default scopes to restrict data access.
What to do
- Upgrade Mongoid to version 9.1.3 or later.
- Check the installed version in Gemfile.lock, e.g. with bundle list | grep mongoid.
- Review models that use default scopes for access restriction, especially those returning no records. Also add explicit authorization checks in the application layer.
- Review data access and change logs for unauthorized reading, modification or deletion of protected records.
- See the official ticket MONGOID-6025 (jira.mongodb.org) for details.
Affected products and versions
CVSS vector, explained
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
- Attack vector
- Network (from the internet)
- Attack complexity
- Low
- Privileges required
- Regular user
- User interaction
- Not required
- Scope
- Vulnerable component only
- Confidentiality
- High impact
- Integrity
- High impact
- Availability
- None
Weakness type (CWE)
- CWE-863 Incorrect Authorization
References
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.