Laravel Framework XSS in Blade templating engine
Published 8 Dec 2021 · Updated 8 Jul 2026
Affected packages
- Affected
- <6.20.42
- Fixed in
- 6.20.42
composer require laravel/framework:^6.20.42- Affected
- >=7.0.0 <7.30.6
- Fixed in
- 7.30.6
composer require laravel/framework:^7.30.6- Affected
- >=8.0.0 <8.75.0
- Fixed in
- 8.75.0
composer require laravel/framework:^8.75.0- Affected
- <6.20.42
- Fixed in
- 6.20.42
composer require illuminate/view:^6.20.42- Affected
- >=7.0.0 <7.30.6
- Fixed in
- 7.30.6
composer require illuminate/view:^7.30.6- Affected
- >=8.0.0 <8.75.0
- Fixed in
- 8.75.0
composer require illuminate/view:^8.75.0Details
A security researcher has disclosed a possible XSS vulnerability in the Blade templating engine.
Given the following two Blade templates:
resources/views/parent.blade.php:
@section('content')
<input value="{{ $value }}">
@showresources/views/child.blade.php:
@extends('parent')
@section('content')
<input value="{{ $value }}">
@endsectionAnd a route like the following:
Route::get('/example', function() {
$value = '//localhost/###parent-placeholder-040f06fd774092478d450774f5ba30c5da78acc8## onclick=location.assign(this.value);//';
return view('child', ['value' => $value]);
});The broken HTML element may be clicked and the user is taken to another location in their browser due to XSS. This is due to the user being able to guess the parent placeholder SHA-1 hash by trying common names of sections. If the parent template contains an exploitable HTML structure an XSS vulnerability can be exposed.
This vulnerability has been patched by determining the parent placeholder at runtime and using a random hash that is unique to each request.
Is GHSA-66hf-2p6w-jqfw in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected laravel/framework, and gives you the command that fixes it.
References
- Linkgithub.com/laravel/framework/security/advisories/GHSA-66hf-2p6w-jqfw
- Advisorynvd.nist.gov/vuln/detail/CVE-2021-43808
- Linkgithub.com/laravel/framework/pull/39906
- Linkgithub.com/laravel/framework/pull/39908
- Linkgithub.com/laravel/framework/pull/39909
- Linkgithub.com/laravel/framework/commit/b8174169b1807f36de1837751599e2828ceddb9b
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/illuminate/view/CVE-2021-43808.yaml
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/laravel/framework/CVE-2021-43808.yaml
- Packagegithub.com/laravel/framework
- Linkgithub.com/laravel/framework/releases/tag/v6.20.42
- Linkgithub.com/laravel/framework/releases/tag/v7.30.6
- Linkgithub.com/laravel/framework/releases/tag/v8.75.0
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.