The vulnerability is a mass assignment issue within the AdonisJS Lucid ORM, specifically in the BaseModelImpl class. The core of the problem lies in the merge and $consumeAdapterResult methods. These methods were designed to take a data object and apply its properties to a model instance. The vulnerability arises because they did not properly sanitize the input to prevent the modification of internal properties used by the ORM to manage state, such as $isPersisted, $isDeleted, and $attributes.
The patch introduces a denylist of these internal properties (INTERNAL_INSTANCE_PROPERTIES). The merge and $consumeAdapterResult methods were updated to check incoming keys against this list, ignoring any that match. This prevents attackers from manipulating the ORM's internal logic.
An attacker could exploit this by sending a crafted JSON payload to an endpoint that uses methods like Model.create() or model.fill(). These higher-level methods internally call the vulnerable merge function. For instance, by including "$isPersisted": true in the payload for a new record, an attacker could trick the save() method into performing an UPDATE instead of an INSERT, potentially leading to unauthorized data modification. The identified vulnerable functions, BaseModelImpl.merge and BaseModelImpl.$consumeAdapterResult, are the exact locations where the flawed logic existed and where the fix was applied.