Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. craftcms/cms
  4. ›
  5. CVE-2026-31859

CVE-2026-31859: CraftCMS vulnerable to reflective XSS via incomplete return URL sanitization

March 11, 2026

The fix for CVE-2025-35939 in craftcms/cms introduced a strip_tags() call in src/web/User.php to sanitize return URLs before they are stored in the session. However, strip_tags() only removes HTML tags (angle brackets) – it does not inspect or filter URL schemes. Payloads like javascript:alert(document.cookie) contain no HTML tags and pass through strip_tags() completely unmodified, enabling reflected XSS when the return URL is rendered in an href attribute.

References

  • github.com/advisories/GHSA-fvwq-45qv-xvhv
  • github.com/craftcms/cms
  • github.com/craftcms/cms/commit/cc9921c14897ee2b592a431c2356af8a04ce4cfe
  • github.com/craftcms/cms/security/advisories/GHSA-fvwq-45qv-xvhv
  • nvd.nist.gov/vuln/detail/CVE-2026-31859

Code Behaviors & Features

Detect and mitigate CVE-2026-31859 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 4.15.3 before 4.17.3, all versions starting from 5.7.5 before 5.9.7

Fixed versions

  • 4.17.3
  • 5.9.7

Solution

Upgrade to versions 4.17.3, 5.9.7 or above.

Weakness

  • CWE-116: Improper Encoding or Escaping of Output
  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Source file

packagist/craftcms/cms/CVE-2026-31859.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 24 Mar 2026 12:17:35 +0000.