Summary
A polymorphic relationship query helper in the MongoDB Eloquent integration for Laravel resolves a record's type identifier inconsistently. The code that stores relationship links and the code that searches for them do not use the same identifier. As a result, restrictions based on relationship-absence queries (whereDoesntHave) can silently fail (CWE-863: Incorrect Authorization).
Per the CVSS vector (8.1, high), the attack is carried out over the network with low complexity. The attacker needs only basic application privileges, and no user interaction is required.
Successful exploitation lets the user read, modify or delete records the restriction was meant to protect. Confidentiality and integrity impact is high, with no availability impact. The vulnerability is not listed in CISA KEV.
Who is affected
Organizations running Laravel applications with the MongoDB Eloquent integration (PHP Driver) from 4.1.0 up to before 5.12.2, especially those relying on whereDoesntHave over morph-mapped polymorphic relations for access control.
What to do
- Upgrade the package to version 5.12.2 or later.
- Inventory applications and check whether a version between 4.1.0 and 5.12.2 is in use (e.g. composer show).
- Review code that uses whereDoesntHave on morph-mapped polymorphic relations to restrict access. Until you upgrade, add independent authorization checks.
- Review data access and change logs for unauthorized modifications or deletions.
- Follow the vendor advisory (https://jira.mongodb.org/browse/PHPLARA-320) for further guidance.
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.