GitHub Advisoryadvisory · Packagist

GHSA-66hf-2p6w-jqfw Laravel Framework XSS in Blade templating engine

MEDIUM Published 2021-12-08 Modified 2022-08-11 Official page ↗
Aliases
CVE-2021-43808
Ecosystem
Packagist
Packages
laravel/framework, illuminate/view
Severity
Moderate
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weaknesses
CWE-327, CWE-79
Reviewed
2021-12-07

Affected packages

• Packagist laravel/framework: < 6.20.42 → fixed in 6.20.42 • Packagist laravel/framework: >= 7.0.0, < 7.30.6 → fixed in 7.30.6 • Packagist laravel/framework: >= 8.0.0, < 8.75.0 → fixed in 8.75.0 • Packagist illuminate/view: < 6.20.42 → fixed in 6.20.42 • Packagist illuminate/view: >= 7.0.0, < 7.30.6 → fixed in 7.30.6 • Packagist illuminate/view: >= 8.0.0, < 8.75.0 → fixed in 8.75.0

Description

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: ```html @section('content') @show ``` resources/views/child.blade.php: ```html @extends('parent') @section('content') @endsection ``` And a route like the following: ```php 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.

Related

Alias · CVE (1)

  • CVE-2021-43808 Laravel is a web application framework. vulnerability

Weakness · CWE (2)

  • CWE-327 Use of a Broken or Risky Cryptographic Algorithm weakness
  • CWE-79 Improper Neutralization of Input During Web Page Generation weakness

References