VYPR
Medium severity6.1GHSA Advisory· Published Jun 19, 2026

symfony/ux-icons: XSS via unsanitized SVG content in local files and Iconify on-demand responses

CVE-2026-55877

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.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

1

Patches

Vulnerability mechanics

Root cause

"The `ux_icon()` Twig function is marked `is_safe=['html']` so Twig never escapes its output, and `Icon::toHtml()` inlines SVG source verbatim into the page without sanitization."

Attack vector

An attacker can inject XSS payloads into inline SVG rendered by the `ux_icon()` Twig function because the output is marked `is_safe=['html']` and never escaped [ref_id=1]. Browsers execute `<script>` elements and `on*` event-handler attributes found inside inline SVG, making any unsanitized icon a vector for cross-site scripting [ref_id=1]. 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) [ref_id=1].

Affected code

The `ux_icon()` Twig function is marked `is_safe=['html']`, so Twig never escapes its output, and `Icon::toHtml()` inlines the SVG source verbatim into the page [ref_id=1]. Two code paths were affected: `Icon::fromFile()` only stripped `<script>` elements that were direct children of `<svg>`, leaving nested scripts and all `on*` attributes untouched; the Iconify on-demand path (enabled by default) performed no sanitization at all on the remote JSON `body` field [ref_id=1].

What the fix does

The patch introduces an `IconFactory` class that centralizes sanitization across every icon source before an `Icon` object is created [patch_id=6640821]. 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 [ref_id=1]. `<style>` elements are kept for theming but have any handlers stripped, and icons that contain none of these constructs are byte-for-byte identical after sanitization [ref_id=1].

Preconditions

  • configThe application must use the `ux_icon()` Twig function to render SVG icons
  • inputThe attacker must supply a malicious SVG file (via a third-party theme, downloaded icon set, or controlled Iconify endpoint)
  • configThe Iconify on-demand path is enabled by default, so no special configuration is needed for that attack vector

Generated on Jun 19, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

3

News mentions

0

No linked articles in our index yet.