Lucene search

K
githubGitHub Advisory DatabaseGHSA-44PG-C29V-HP6R
HistoryMay 15, 2024 - 10:18 p.m.

Laravel Guard bypass in Eloquent models

2024-05-1522:18:33
CWE-20
GitHub Advisory Database
github.com
5
laravel
guard bypass
eloquent
security
fix
mass assignment
attribute validation
table name stripping
breaking change

7.1 High

AI Score

Confidence

Low

In laravel releases before 6.18.34 and 7.23.2. It was possible to mass assign Eloquent attributes that included the model’s table name:

$model->fill(['users.name' => 'Taylor']);

When doing so, Eloquent would remove the table name from the attribute for you. This was a “convenience” feature of Eloquent and was not documented.

However, when paired with validation, this can lead to unexpected and unvalidated values being saved to the database. For this reason, we have removed the automatic stripping of table names from mass-asignment operations so that the attributes go through the typical “fillable” / “guarded” logic. Any attributes containing table names that are not explicitly declared as fillable will be discarded.

This security release will be a breaking change for applications that were relying on the undocumented table name stripping during mass assignment. Since this feature was relatively unknown and undocumented, we expect the vast majority of Laravel applications to be able to upgrade without issues.

7.1 High

AI Score

Confidence

Low