CVE-2026-31822: Sylius/sylius Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-vgh8-c6fp-7gcg
CWE-79
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2026-31822
GHSA Identifier GHSA-vgh8-c6fp-7gcg
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Sylius/sylius
Package Ecosystem Packagist
Published Date
Last Updated

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.

sylius/sylius fixed: 2.0.16
Upgrade sylius/sylius to 2.0.16
sylius/sylius fixed: 2.1.12
Upgrade sylius/sylius to 2.1.12
sylius/sylius fixed: 2.2.3
Upgrade sylius/sylius to 2.2.3
Verify Direct and Transitive Dependencies

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

### Impact A cross-site scripting (XSS) vulnerability exists in the shop checkout login form handled by the ApiLoginController Stimulus controller. When 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. The 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: - 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 form without any privileged access. - Translation injection — if translation files are sourced from an untrusted database or CMS and contain HTML, the message could carry a malicious payload. - 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. - 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. Exploitation could lead to session hijacking, credential theft, cart/order manipulation, or phishing within the trusted shop domain. The vulnerability affects all Sylius installations that use the default shop checkout login form with the bundled ApiLoginController.js. ### Patches The issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3 and above. ### Workarounds Override the vulnerable JavaScript controller at the project level. > Note: Step 2 differs between Sylius 2.0 and up #### Step 1. Override JavaScript controller handling login ### Patch ApiLoginController.js Copy the original from `vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/assets/controllers/ApiLoginController.js` to `assets/shop/controllers/ApiLoginController.js` and apply: ```diff ... .then(response => { if (response.success) { window.location.reload(); } else { const errorElement = this.errorPrototypeTarget.cloneNode(true); - errorElement.innerHtml = response.message; + errorElement.textContent = response.message; this.errorTarget.innerHTML = errorElement.outerHTML; } }) ... ``` #### Step 2. Register the patched controller > Sylius 2.1+ (Stimulus Bridge with `controllers.json`) Disable the vendor controller in `assets/shop/controllers.json`: ```diff ... "api-login": { - "enabled": true, + "enabled": false, "fetch": "lazy" } ... ``` Register the overwritten controller in `assets/shop/bootstrap.js` ```js import ApiLoginController from './controllers/ApiLoginController' app.register('sylius--shop-bundle--api-login', ApiLoginController); ``` --- > Sylius 2.0 (explicit imports in vendor `app.js`) Use Webpack's `NormalModuleReplacementPlugin` to swap the controller at build time. In `webpack.config.js`, after `shopConfig` is created: ```diff + const webpack = require('webpack'); ... // Shop config const shopConfig = SyliusShop.getWebpackConfig(path.resolve(__dirname)); + shopConfig.plugins.push( + new webpack.NormalModuleReplacementPlugin( + /\/controllers\/ApiLoginController\.js$/, + path.resolve(__dirname, 'assets/shop/controllers/ApiLoginController.js') + ) + ); ... ``` #### Step 3. Rebuild assets ```bash yarn encore dev # or: yarn encore production ``` ### Reporters We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability: - Bartłomiej Nowiński (@bnBart) ### For more information If you have any questions or comments about this advisory: - Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen) - Email us at [security@sylius.com](mailto:security@sylius.com)

CVE-2026-31822 Affected Sylius/sylius Versions

3 component(s)
Fixed Versions:
2.0.162.1.122.2.3
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?
CVE-2026-31822 is a security vulnerability in Sylius/sylius involving Sylius has a XSS vulnerability in checkout login form under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Sylius/sylius versions are affected?
Affected versions include releases prior to 2.0.16, 2.1.12, 2.2.3 across affected packages: sylius/sylius.
What version fixes CVE-2026-31822?
Upgrading to 2.0.16, 2.1.12, 2.2.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sylius/sylius affected?
Yes, sylius/sylius is affected in releases prior to 2.0.16, 2.1.12, 2.2.3. Upgrade your dependency to 2.0.16, 2.1.12, 2.2.3 or later.
What CWE is associated with CVE-2026-31822?
CVE-2026-31822 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (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.).
How can I check Packagist dependencies for CVE-2026-31822?
Run the dependency tree command: 'inspect dependencies for sylius/sylius'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}