GitHub Advisoryadvisory · Packagist
GHSA-6v8j-33hc-mv84 symfony/ux-icons: XSS via unsanitized SVG content in local files and Iconify on-demand responses
MEDIUM
Official page ↗
- Aliases
- CVE-2026-55877
- Ecosystem
- Packagist
- Packages
- symfony/ux-icons
- 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-79
- Reviewed
- 2026-06-19
Affected packages
• Packagist symfony/ux-icons: >= 2.17.0, < 2.36.1 → fixed in 2.36.1
• Packagist symfony/ux-icons: >= 3.0.0, < 3.2.0 → fixed in 3.2.0
Description
Description
The `ux_icon()` Twig function is marked `is_safe=['html']`, so Twig never escapes its output. `Icon::toHtml()` inlines the SVG source verbatim into the page. Browsers execute `` elements and `on*` event-handler attributes found inside inline SVG, making any unsanitized icon a vector for cross-site scripting.
Two code paths were affected. In the local file path, `Icon::fromFile()` only stripped `` elements that were direct children of ``, leaving nested scripts and all `on*` attributes untouched despite a code comment claiming broader protection. In the Iconify on-demand path (enabled by default), the remote JSON `body` field was wrapped into an `Icon` object with no sanitization at all. Concrete attack vectors include a malicious SVG icon pack from a third-party theme or downloaded icon set, or a controlled Iconify endpoint configured via `iconify.endpoint` (including a poisoned cache).
Resolution
Introducing an `IconFactory` that centralizes sanitization across every icon source before an `Icon` object is created. The sanitizer removes script-capable elements (`script`, `foreignObject`, `iframe`, `object`, `embed`), SMIL animations targeting `on*`, `href`, or `xlink:href` attributes, CDATA sections, processing instructions, all `on*` attributes, and `javascript:`, `vbscript:`, and `data:text/html` URL schemes.
`` elements are kept for theming but have any handlers stripped. Icons that contain none of these constructs are byte-for-byte identical after sanitization.
Credits
Symfony would like to thank Pascal Cescon for reporting the issue and Hugo Alliaume for providing the fix.
Related
Alias · CVE (1)
- CVE-2026-55877 Symfony UX is a JavaScript ecosystem for Symfony. vulnerability
Weakness · CWE (1)
- CWE-79 Improper Neutralization of Input During Web Page Generation weakness