Sylius potentially vulnerable to Cross Site Scripting via "Name" field (Taxons, Products, Options, Variants) in Admin Panel
Date: 2024-05
Affected: composer/sylius/sylius, composer/sylius/sylius, composer/sylius/sylius
Attack vector: path-traversal
Category: vulnerability-disclosure
Severity: Medium
CVE: CVE-2024-34349
CWE: CWE-79
CVSS: 4.8 (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N)

### Impact There is a possibility to execute javascript code in the Admin panel. In order to perform an XSS attack input a script into `Name` field in which of the resources: Taxons, Products, Product Options or Product Variants. The code will be executed while using an autocomplete field with one of the listed entities in the Admin Panel. Also for the taxons in the category tree on the product form. ### Patches The issue is fixed in versions: 1.9.12, 1.10.16, 1.11.17, 1.12.16, 1.13.1 and above. ### Workarounds 1. Create a new file `assets/admin/sylius-lazy-choice-tree.js`: ```js // assets/admin/sylius-lazy-choice-tree.js function sanitizeInput(input) { const div = document.createElement('div'); div.textContent = input; return div.innerHTML; // Converts text content to plain HTML, stripping any scripts } const createRootContainer = function createRootContainer() { return $('<div class="ui list"></div>'); }; const createLeafContainerElement = function createLeafContainerElement() { return $('<div class="list"></div>'); }; const createLeafIconElement = function createLeafIconElement() { return $('<i class="folder icon"></i>'); }; const createLeafTitleElement = function createLeafTitleElement() { return $('<div class="header"></div>'); }; const createLeafTitleSpan = function createLeafTitleSpan(displayName) { return $(`<span style="margin-right: 5px; cursor: pointer;">${displayName}</span>`); }; const createLeafContentElement = function createLeafCont


Mitigations:

Architectural layers (MAESTRO):