Intel

AIKIDO-2026-28946

spiral/stempler is vulnerable to Cross-Site Scripting (XSS)

Cross-Site Scripting (XSS)GHSA-wpjr-ppfr-7m6v Published Yesterday

61

Medium Risk

This Affects:

PHPspiral/stempler
2.7.0 - 3.17.1
Fixed in 3.17.2
Are you affected? Scan for Free

TL;DR

Stempler is the framework's default template engine and applies context-aware escaping to values echoed with the auto-escaping output syntax. For JavaScript event-handler attributes such as onclick and other on* handlers, the finalizer HTML-entity-encodes the value and wraps it in quotes instead of encoding it as a JavaScript literal. Because the browser HTML-decodes an event-handler attribute before the JavaScript engine parses it, user-supplied quotes are decoded back and can break out of the JavaScript string, yielding reflected or stored cross-site scripting through the supported safe syntax. The fix serializes the value with json_encode using the JSON_HEX_* flags and HTML-encodes the resulting literal so it survives both HTML and JavaScript decoding.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your templates render user-controlled data into an on* event-handler attribute using the auto-escaping output syntax.

Background info

spiral/stempler is vulnerable to Cross-Site Scripting (XSS) in versions 2.7.0 - 3.17.1.

How to fix this

Upgrade the spiral/stempler and/or the spiral/framework library to the patch version.