CVE-2026-48157
JSON

6.1medium

Slim has Reflected XSS in the HtmlErrorRenderer

Severity
6.1medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.26% (higher than 11% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-53h4-8rc4-f539

Description

Slim is a PHP micro framework that enables users to write simple web applications and APIs. In versions 4.4.0 through 4.15, if an application uses HttpException::setTitle() and/or setDescription() to include untrusted/request-derived data in the error title or description (e.g. "No products found matching '{$query}'."), an attacker could inject arbitrary HTML/JavaScript that executes in the victim's browser when they encounter an HTML error page generated by Slim. The vulnerability is present even with displayErrorDetails = false as the unescaped title and description are rendered on this error path. Built-in exceptions (HttpNotFoundException, HttpBadRequestException, etc.) ship plain-text defaults, so a vanilla Slim app with no user code is not exploitable. Only applications that feed untrusted data into setTitle() and/or setDescription() are affected. The issue has been fixed in 4.15.2. If developers are unable to immediately update their applications, they can work around this issue by avoiding passing untrusted/request-derived data into HttpException::setTitle() and setDescription() and using static, plain-text error copy instead. They should also register a custom error renderer (an ErrorRendererInterface implementation, or a subclass of HtmlErrorRenderer that escapes the title and description) for the HTML media type.

Affected

Product or packageVersionsReported by
slimphp Slim>= 4.4.0, < 4.15.2CVE List
slim/slim (Packagist)from 4.4.0 before 4.15.2GitHub Advisory Database

All scores

GitHub_M6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/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

Classification

CWE-79

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Slim is a PHP micro framework that enables users to write simple web applications and APIs. In versions 4.4.0 through 4.15, if an application uses HttpException::setTitle() and/or setDescription() to include untrusted/request-derived data in the error title or description (e.g. "No products found matching '{$query}'."), an attacker could inject arbitrary HTML/JavaScript that executes in the victim's browser when they encounter an HTML error page generated by Slim. The vulnerability is present even with displayErrorDetails = false as the unescaped title and description are rendered on this error path. Built-in exceptions (HttpNotFoundException, HttpBadRequestException, etc.) ship plain-text defaults, so a vanilla Slim app with no user code is not exploitable. Only applications that feed untrusted data into setTitle() and/or setDescription() are affected. The issue has been fixed in 4.15.2. If developers are unable to immediately update their applications, they can work around this issue by avoiding passing untrusted/request-derived data into HttpException::setTitle() and setDescription() and using static, plain-text error copy instead. They should also register a custom error renderer (an ErrorRendererInterface implementation, or a subclass of HtmlErrorRenderer that escapes the title and description) for the HTML media type.

GitHub Advisory Database
Impact

If an application uses HttpException::setTitle() and/or setDescription() to include untrusted/request-derived data in the error title or description (e.g. "No products found matching '{$query}'."), an attacker could inject arbitrary HTML/JavaScript that executes in the victim's browser when they encounter an HTML error page generated by Slim.

The vulnerability is present even with displayErrorDetails = false as the unescaped title and description are rendered on this error path.

Built-in exceptions (HttpNotFoundException, HttpBadRequestException, etc.) ship plain-text defaults, so a vanilla Slim app with no user code is not exploitable. Only applications that feed untrusted data into setTitle() and/or setDescription() are affected.

Patches

The issue is fixed in 4.15.2.

Workarounds

Without upgrading, applications can:

  • Avoid passing untrusted/request-derived data into HttpException::setTitle() and setDescription(). Use static, plain-text error copy instead.
  • Register a custom error renderer (an ErrorRendererInterface implementation, or a subclass of HtmlErrorRenderer that escapes the title and description) for the HTML media type.
Acknowledgments

Slim is grateful to and thanks GitHub user 0xEr3n for reporting this issue.

Resources
NVD (es)

Slim es un micro framework de PHP que permite a los usuarios escribir aplicaciones web y APIs sencillas. En las versiones 4.4.0 a 4.15, si una aplicación utiliza HttpException::setTitle() y/o setDescription() para incluir datos no confiables/derivados de la solicitud en el título o la descripción del error (por ejemplo, ’No se encontraron productos que coincidan con ’{$query}’.’), un atacante podría inyectar HTML/JavaScript arbitrario que se ejecuta en el navegador de la víctima cuando esta encuentra una página de error HTML generada por Slim. La vulnerabilidad está presente incluso con displayErrorDetails = false, ya que el título y la descripción sin escapar se renderizan en esta ruta de error. Las excepciones integradas (HttpNotFoundException, HttpBadRequestException, etc.) vienen con valores predeterminados de texto plano, por lo que una aplicación Slim ’vainilla’ sin código de usuario no es explotable. Solo las aplicaciones que introducen datos no confiables en setTitle() y/o setDescription() se ven afectadas. El problema ha sido solucionado en la versión 4.15.2. Si los desarrolladores no pueden actualizar sus aplicaciones de inmediato, pueden solucionar este problema evitando pasar datos no confiables/derivados de la solicitud a HttpException::setTitle() y setDescription() y utilizando en su lugar una copia de error estática de texto plano. También deberían registrar un renderizador de errores personalizado (una implementación de ErrorRendererInterface, o una subclase de HtmlErrorRenderer que escape el título y la descripción) para el tipo de medio HTML.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-48157 changed 2026-06-16CVE Terms of Use
GitHub Advisory DatabaseGHSA-53h4-8rc4-f539 changed 2026-09-10CC-BY-4.0
NVDCVE-2026-48157 changed 2026-10-25Public domain