Vulnerability GHSA-hv67-wfqj-w9xv
Summary
Laravel: XSS via unescaped Stringable values in Blade component attribute bag
Details
Impact
Blade component attribute bags did not HTML-escape non-Htmlable object values, such as Illuminate\Support\Stringable, passed to ComponentAttributeBag::merge() or prepends(). Applications that place user-controlled Stringable values (for example, the result of request()->string()) into component attributes could allow an attacker to break out of the attribute and inject arbitrary attributes, such as event handlers. This results in cross-site scripting that runs in the origin of the application.
Patches
The fix escapes all attribute values except null, booleans and Htmlable instances, and also escapes values wrapped with prepends(). It was merged to the 12.x branch in https://github.com/laravel/framework/pull/62503.
Workarounds
Cast user-controlled values to plain strings, for example request()->string('title')->toString(), before passing them to merge() or prepends().
Related Vulnerabilities
Other vulnerabilities affecting the same packages