CVE-2021-43808
JSON

5.3medium

Blade `@parent` Exploitation Leading To Possible XSS in Laravel

Severity
5.3medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.83% (higher than 58% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-66hf-2p6w-jqfw

Description

Laravel is a web application framework. Laravel prior to versions 8.75.0, 7.30.6, and 6.20.42 contain a possible cross-site scripting (XSS) vulnerability in the Blade templating engine. A broken HTML element may be clicked and the user 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 in versions 8.75.0, 7.30.6, and 6.20.42 by determining the parent placeholder at runtime and using a random hash that is unique to each request.

Affected

Product or packageVersionsReported by
laravel framework>= 8.0.0, < 8.75.0, >= 7.0.0, < 7.30.6, < 6.20.42, before 6.20.42, from 7.0.0 before 7.30.6, from 8.0.0 before 8.75.0CVE List, NVD
laravel/framework (Packagist)before 6.20.42, from 7.0.0 before 7.30.6, from 8.0.0 before 8.75.0GitHub Advisory Database
illuminate/view (Packagist)before 6.20.42, from 7.0.0 before 7.30.6, from 8.0.0 before 8.75.0GitHub Advisory Database

All scores

GitHub_M5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
GitHub6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD4.3medium CVSS:2.0AV:N/AC:M/Au:N/C:N/I:P/A:N

Classification

What each source says

CVE List

Laravel is a web application framework. Laravel prior to versions 8.75.0, 7.30.6, and 6.20.42 contain a possible cross-site scripting (XSS) vulnerability in the Blade templating engine. A broken HTML element may be clicked and the user 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 in versions 8.75.0, 7.30.6, and 6.20.42 by determining the parent placeholder at runtime and using a random hash that is unique to each request.

GitHub Advisory Database

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 }}">
@show

resources/views/child.blade.php:

@extends('parent')

@section('content')
<input value="{{ $value }}">
@endsection

And 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.

NVD (es)

Laravel es un framework de aplicaciones web. Laravel versiones anteriores a 8.75.0, 7.30.6 y 6.20.42, contiene una posible vulnerabilidad de tipo cross-site scripting (XSS) en el motor de plantillas Blade. Puede hacerse clic en un elemento HTML roto y llevar al usuario a otra ubicación en su navegador debido a un ataque de tipo XSS. Esto es debido a que el usuario puede adivinar el hash SHA-1 del marcador de posición padre al probar los nombres comunes de las secciones. Si la plantilla padre contiene una estructura HTML explotable puede exponerse una vulnerabilidad de tipo XSS. Esta vulnerabilidad ha sido parcheada en las versiones 8.75.0, 7.30.6 y 6.20.42 determinando el marcador de posición padre en tiempo de ejecución y usando un hash aleatorio que es único para cada petición

References

https://github.com/laravel/framework/security/advisories/GHSA-66hf-2p6w-jqfwexploit, third-party-advisory, web
https://github.com/laravel/framework/pull/39906patch, third-party-advisory, web
https://github.com/laravel/framework/pull/39908patch, third-party-advisory, web
https://github.com/laravel/framework/pull/39909patch, third-party-advisory, web
https://github.com/laravel/framework/commit/b8174169b1807f36de1837751599e2828ceddb9bpatch, third-party-advisory, web
https://github.com/laravel/framework/releases/tag/v6.20.42release-notes, third-party-advisory, web
https://github.com/laravel/framework/releases/tag/v7.30.6release-notes, third-party-advisory, web
https://github.com/laravel/framework/releases/tag/v8.75.0release-notes, third-party-advisory, web
https://nvd.nist.gov/vuln/detail/CVE-2021-43808advisory
https://github.com/FriendsOfPHP/security-advisories/blob/master/illuminate/view/CVE-2021-43808.yamlweb
https://github.com/FriendsOfPHP/security-advisories/blob/master/laravel/framework/CVE-2021-43808.yamlweb
https://github.com/laravel/frameworkpackage

Sources

SourceRecordLicence
CVE ListCVE-2021-43808 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-66hf-2p6w-jqfw changed 2026-07-08CC-BY-4.0
NVDCVE-2021-43808 changed 2026-06-17Public domain