CVE-2026-49216: Symfony UX: XSS in symfony/ux-autocomplete via unescaped AJAX response data
Description
The Stimulus controller shipped with symfony/ux-autocomplete renders AJAX response items into the dropdown by interpolating the text field directly into HTML template literals (<div>${item[labelField]}</div>) inside createAutocompleteWithRemoteData(). The value is parsed as HTML rather than text, so any markup contained in the AJAX response is executed by the browser.
When the dropdown values are derived from user-supplied content, an attacker can craft a string that triggers stored XSS in the browser of any other user who later opens a page containing an autocomplete widget backed by the same data.
Resolution
The option and item renderers used in createAutocompleteWithRemoteData() now use TomSelect's escape helper to HTML-escape the value by default. Endpoints that legitimately return HTML (for example, to highlight the search term) can opt back in to the previous behavior by setting optionsashtml: true. The AutocompleteChoiceTypeExtension normalizer that previously forced optionsashtml=false when autocompleteurl was set has been dropped so the opt-in is reachable from the form layer.
The patch for this issue is available here for branch 2.x (and forward-ported to 3.x).
Credits
Symfony would like to thank Alex Ashkov for reporting the issue and Hugo Alliaume for providing the fix.
Other sources
Symfony UX is a JavaScript ecosystem for Symfony. From 2.2.0 until 2.36.0 and 3.1.0, the Stimulus controller in symfony/ux-autocomplete renders AJAX response items in createAutocompleteWithRemoteData() by interpolating the text field into HTML template literals (<div>${item[labelField]}</div>) rather than text, allowing attacker-controlled markup from user-supplied dropdown values to execute in the browser of any user who opens an autocomplete widget backed by the same data. This issue is fixed in versions 2.36.0 and 3.1.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/symfony/ux-autocompleteto a version that resolves this vulnerability.Fixed in 3.1.0 - Upgrade
Upgrade
composer/symfony/ux-autocompleteto a version that resolves this vulnerability.Fixed in 2.36.0 - Upgrade
Upgrade
symfony/ux-autocompleteto a version that resolves this vulnerability.Fixed in 2.36.0 - Upgrade
Upgrade
symfony/ux-autocompleteto a version that resolves this vulnerability.Fixed in 3.1.0 - Configuration
Ensure `options_as_html` is not set to `true` for `symfony/ux-autocomplete`; default behavior escapes item values, while opting back in to `options_as_html: true` restores rendering AJAX response items as HTML via `<div>${item[labelField]}</div>`.
symfony/ux-autocomplete Stimulus controller options_as_html = false
Event History
Frequently Asked Questions
What is the severity of CVE-2026-49216?
CVE-2026-49216 has a medium severity rating of 5.1 according to the CVSS.
How do I fix CVE-2026-49216?
To fix CVE-2026-49216, ensure that AJAX response data is properly sanitized before rendering it to prevent XSS vulnerabilities.
What type of vulnerability is CVE-2026-49216?
CVE-2026-49216 is classified as a Cross-Site Scripting (XSS) vulnerability.
Which software is affected by CVE-2026-49216?
CVE-2026-49216 affects the Symfony UX component, specifically the symfony/ux-autocomplete package.
When was CVE-2026-49216 published?
CVE-2026-49216 was published on June 19, 2026.