Skip to content
Laskyr

craftcms/cms security advisory

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

CVE-2026-31859 is a medium-severity XSS vulnerability in the PHP package craftcms/cms (CVSS 6.1), published 11 March 2026. The advisory does not name a fixed version. It can be exploited without an account.

medium 6.1 published 2026-03-11 · updated 2026-06-17

The advisory does not name a fixed version

This XSS issue affects craftcms/cms in 2 release lines: >= 4.15.3, <= 4.17.2; >= 5.7.5, <= 5.9.6. The newest release (5.12.0) is outside the affected range.

Affected versions
>= 4.15.3, <= 4.17.2
>= 5.7.5, <= 5.9.6
Fixed in
not stated
Newest release
5.12.0
Severity
Medium · CVSS 6.1
Type
Cross-site scripting (XSS)
CWE-79, CWE-116
Exploited in the wild
Not on the CISA KEV list
checked 2026-11-04

Is your craftcms/cms version affected?

Run composer show craftcms/cms in your project, then enter the version. We check it against this and every other known craftcms/cms advisory.

Who can exploit CVE-2026-31859

CVSS vector (scored by NVD): CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Your app is only exposed if it uses the affected part of craftcms/cms. The advisory below says which part that is. If you are not sure, upgrade anyway: it costs less than finding out.

How to fix CVE-2026-31859 in craftcms/cms

  1. Find the installed version: composer show craftcms/cms. If you never required it yourself, composer why craftcms/cms shows which package pulls it in.
  2. Update it: composer update craftcms/cms --with-all-dependencies.
  3. If Composer will not go that high, your composer.json constraint is holding it back. Widen it (for example "craftcms/cms": "^5.12.0" if you can take that version), or upgrade the package that requires it.
  4. Run composer audit. It reads the same advisory data and should no longer list CVE-2026-31859.
  5. Commit composer.lock and deploy it. On the server, run composer install --no-dev from the lock file, not composer update.

If you cannot upgrade yet

General hardening for XSS issues while the upgrade waits. None of it replaces the fix.

The CVE-2026-31859 advisory

Craft is a content management system (CMS). 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. This vulnerability is fixed in 5.9.7 and 4.17.3.

Description from the CVE record, published by GitHub (the CVE Numbering Authority), via the NVD entry for CVE-2026-31859. Advisory title: “CraftCMS vulnerable to reflective XSS via incomplete return URL sanitization”.

References

Other craftcms/cms advisories

Related

Need help patching or upgrading? Laskyr does PHP and Laravel security fixes and upgrades. Tell us what you run and we reply with a plan and a price.

Ask about a fix

Where this data comes from

First hour checklist

If the site was just hacked, read the emergency kit before you delete files. The page is free. Email is optional.

Read the emergency kit