CVE-2026-31822: Sylius/sylius Cross-Site Scripting Vulnerability
MODERATECVE-2026-31822 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Sylius/sylius libraries in the Packagist ecosystem. The issue involves sylius has a xss vulnerability in checkout login form. Remediation is available by upgrading affected packages to version 2.0.16, 2.1.12, 2.2.3.
CVE-2026-31822 at a Glance
How to Fix CVE-2026-31822
To remediate this vulnerability, upgrade all affected Sylius/sylius dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade sylius/sylius to 2.0.16
Upgrade sylius/sylius to 2.1.12
Upgrade sylius/sylius to 2.2.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for sylius/sylius
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-31822, inspect your project dependencies for Sylius/sylius:
inspect dependencies for sylius/sylius
Analyze the terminal output to locate any version of Sylius/sylius in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.16), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Sylius/sylius, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-31822 Affected Sylius/sylius Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
sylius/sylius
|
Packagist |
≥ 2.0.0
< 2.0.16
|
2.0.16
|
|
sylius/sylius
|
Packagist |
≥ 2.1.0
< 2.1.12
|
2.1.12
|
|
sylius/sylius
|
Packagist |
≥ 2.2.0
< 2.2.3
|
2.2.3
|
References
Frequently Asked Questions
What is CVE-2026-31822?
Which Sylius/sylius versions are affected?
What version fixes CVE-2026-31822?
Is sylius/sylius affected?
What CWE is associated with CVE-2026-31822?
How can I check Packagist dependencies for CVE-2026-31822?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vgh8-c6fp-7gcg",
"modified" : "2026-03-11T20:32:40Z",
"published" : "2026-03-11T00:13:02Z",
"aliases" : [ "CVE-2026-31822" ],
"summary" : "Sylius has a XSS vulnerability in checkout login form",
"details" : "### Impact\n\nA cross-site scripting (XSS) vulnerability exists in the shop checkout login form handled by the ApiLoginController Stimulus controller. \n\nWhen a login attempt fails, AuthenticationFailureHandler returns a JSON response whose message field is rendered into the DOM using innerHTML, allowing any HTML or JavaScript in that value to be parsed and executed by the browser.\n\nThe message value originates from `AuthenticationException::getMessageKey()` passed through Symfony's translator (security domain, using the request locale). In the default Sylius installation, this returns a hardcoded translation key (e.g. \"Invalid credentials.\"), which is not directly user-controlled. However, using innerHTML with server-derived data violates defense-in-depth principles, and the risk escalates significantly under realistic scenarios:\n - Customized authentication handlers — if a project overrides AuthenticationFailureHandler to include user-supplied data in the message (e.g. \"No account found for <username>\"), an attacker can inject arbitrary JavaScript directly via the login\n form without any privileged access.\n - Translation injection — if translation files are sourced from an untrusted database or CMS and contain HTML, the message could carry a malicious payload.\n - Man-in-the-Middle — if the response is intercepted (e.g. on HTTP or via a compromised proxy), an attacker can inject arbitrary HTML/JS into the message field.\n - Server-side injection — if any middleware, reverse proxy, or error handler modifies the JSON response body, malicious content could be injected into the message field.\n\nExploitation could lead to session hijacking, credential theft, cart/order manipulation, or phishing within the trusted shop domain.\n\nThe vulnerability affects all Sylius installations that use the default shop checkout login form with the bundled ApiLoginController.js.\n\n### Patches\nThe issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3 and above.\n\n### Workarounds\nOverride the vulnerable JavaScript controller at the project level.\n> Note: Step 2 differs between Sylius 2.0 and up\n\n#### Step 1. Override JavaScript controller handling login\n### Patch ApiLoginController.js\n\nCopy the original from `vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/assets/controllers/ApiLoginController.js` to `assets/shop/controllers/ApiLoginController.js` and apply:\n```diff\n...\n .then(response => {\n if (response.success) {\n window.location.reload();\n } else {\n const errorElement = this.errorPrototypeTarget.cloneNode(true);\n- errorElement.innerHtml = response.message;\n+ errorElement.textContent = response.message;\n this.errorTarget.innerHTML = errorElement.outerHTML;\n }\n })\n...\n```\n\n#### Step 2. Register the patched controller\n> Sylius 2.1+ (Stimulus Bridge with `controllers.json`)\n\nDisable the vendor controller in `assets/shop/controllers.json`:\n```diff\n...\n \"api-login\": {\n- \"enabled\": true,\n+ \"enabled\": false,\n \"fetch\": \"lazy\"\n }\n...\n```\nRegister the overwritten controller in `assets/shop/bootstrap.js`\n```js\nimport ApiLoginController from './controllers/ApiLoginController'\n\napp.register('sylius--shop-bundle--api-login', ApiLoginController);\n```\n---\n> Sylius 2.0 (explicit imports in vendor `app.js`)\n\nUse Webpack's `NormalModuleReplacementPlugin` to swap the controller at build time. In `webpack.config.js`, after `shopConfig` is created:\n\n```diff\n+ const webpack = require('webpack');\n...\n // Shop config\n const shopConfig = SyliusShop.getWebpackConfig(path.resolve(__dirname));\n+ shopConfig.plugins.push(\n+ new webpack.NormalModuleReplacementPlugin(\n+ /\\/controllers\\/ApiLoginController\\.js$/,\n+ path.resolve(__dirname, 'assets/shop/controllers/ApiLoginController.js')\n+ )\n+ );\n...\n```\n\n#### Step 3. Rebuild assets\n\n```bash\nyarn encore dev # or: yarn encore production\n```\n\n### Reporters\n\nWe would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability:\n- Bartłomiej Nowiński (@bnBart)\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n- Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen)\n- Email us at [security@sylius.com](mailto:security@sylius.com)",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "sylius/sylius"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.0.16"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.0.15"
}
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "sylius/sylius"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.1.0"
}, {
"fixed" : "2.1.12"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.1.11"
}
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "sylius/sylius"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.2.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.2.2"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/Sylius/Sylius/security/advisories/GHSA-vgh8-c6fp-7gcg"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-31822"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Sylius/Sylius"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-11T00:13:02Z",
"nvd_published_at" : "2026-03-10T22:16:19Z"
}
}