# GHSA-44pg-c29v-hp6r: Laravel Guard bypass in Eloquent models

> Attackers can bypass mass assignment guards to modify protected database fields by using table-prefixed attribute names in Laravel applications.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 May 2024

## What is GHSA-44pg-c29v-hp6r?

GHSA-44pg-c29v-hp6r is a missing authorization vulnerability in laravel/framework, published on 15 May 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

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.

## Which versions are affected by GHSA-44pg-c29v-hp6r?

6 open source packages ship an affected version, including laravel/framework.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `laravel/framework` | Packagist | From 5.5.0 to 5.5.49 | None |
| `laravel/framework` | Packagist | From 5.5.0 to 5.5.49 | None |
| `laravel/framework` | Packagist | From 6.0.0 | 6.18.34 |
| `laravel/framework` | Packagist | From 6.0.0 | 6.18.34 |
| `laravel/framework` | Packagist | From 7.0.0 | 7.23.2 |
| `laravel/framework` | Packagist | From 7.0.0 | 7.23.2 |

## How do I fix GHSA-44pg-c29v-hp6r?

Upgrade laravel/framework to a fixed version for your release line: 6.18.34 or 7.23.2.

## Is GHSA-44pg-c29v-hp6r being exploited?

There is no known exploitation of GHSA-44pg-c29v-hp6r in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-44pg-c29v-hp6r and fix it if it is affected.

What it is: GHSA-44pg-c29v-hp6r is a missing authorization vulnerability in laravel/framework, published on 15 May 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-44pg-c29v-hp6r in the wild and no public exploit code.

Affected packages and fixed versions:
- laravel/framework (Packagist): affected from 5.5.0 up to 5.5.49; no fix listed
- laravel/framework (Packagist): affected from 5.5.0 up to 5.5.49; no fix listed
- laravel/framework (Packagist): affected from 6.0.0; fixed in 6.18.34
- laravel/framework (Packagist): affected from 6.0.0; fixed in 6.18.34
- laravel/framework (Packagist): affected from 7.0.0; fixed in 7.23.2
- laravel/framework (Packagist): affected from 7.0.0; fixed in 7.23.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-44pg-c29v-hp6r/ (Markdown: https://insights.sbomify.com/GHSA-44pg-c29v-hp6r/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-44pg-c29v-hp6r

---
From sbomify Insights: https://insights.sbomify.com/GHSA-44pg-c29v-hp6r/
Summaries are generated and may contain mistakes; the official description above is the record.
