The vulnerability is a classic mass assignment issue in Craft CMS, where the application allows a user to control the authorId attribute when creating or editing an entry, without proper authorization checks. The root cause is that controller actions were using a generic setAttributes method to populate element properties from the HTTP request.
My analysis of the provided patches (c6dcbdffaf6ab3ffe77d317336684d83699f4542 and 830b403870cd784b47ae42a3f5a16e7ac2d7f5a8) reveals the following:
-
Vulnerable Logic: The EntriesController::_populateEntryModel method explicitly shows the vulnerable logic where the author parameter is retrieved from the request and directly assigned to the entry's authorId. This is the primary function where the authorship spoofing occurs during entry creation.
-
Insecure Sink: The Entry::setAuthorId method acted as the insecure sink, as it would accept and set any authorId passed to it without question.
-
Introduction of a Secure Method: The fix introduces a new method, setAttributesFromRequest, which is specifically designed to handle attribute assignment from user requests. In the context of the Entry element, this new method overrides the parent implementation to add a crucial permission check (viewPeerEntries) before allowing a change to the authorId.
-
Widespread Pattern: The vulnerability was not isolated to a single controller. The patches show that other controllers like ElementsController and ElementIndexesController were also using the insecure setAttributes pattern. The fix involves replacing these calls with the new, more secure setAttributesFromRequest method.
Therefore, any function that would appear in a runtime profile during an exploit would involve the controller action that receives the request (e.g., EntriesController::_populateEntryModel, ElementIndexesController::actionSaveElements), which then leads to the insecure assignment via Entry::setAuthorId in the vulnerable versions.