Every CVE Search/ Get API key

CVE-2026-31859

Craft has Reflective XSS via incomplete return URL sanitization

6.9 MediumFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
None

Exploit likelihood

0.22%Up 0.2 points since Mar 12, 2026
90%50%10%1%

What each source reports

CVE List Score used 6.9

Craft has Reflective XSS via incomplete return URL sanitization

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.

Record
CVE-2026-31859
CVSS 4.0
6.9 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Weakness
CWE-79, CWE-116
Updated
2026-11-02
EUVDEUVD-2026-11261 6.9

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.

Record
EUVD-2026-11261
CVSS 4.0
6.9 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Updated
2026-11-02
GitHub AdvisoriesGHSA-fvwq-45qv-xvhv 6.9

CraftCMS vulnerable to reflective XSS via incomplete return URL sanitization

Summary

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.

Details

The patched code in is:

public function setReturnUrl($url): void
{
    parent::setReturnUrl(strip_tags($url));
}

strip_tags() removes HTML tags (e.g., <script>, <img>) from a string, but it is not a URL sanitizer. When the sanitized return URL is subsequently rendered in an href attribute context (e.g., <a href="{{ returnUrl }}">), the following dangerous payloads survive strip_tags() completely unmodified:

  1. javascript: protocol URLs -- javascript:alert(document.cookie) contains no HTML tags, so strip_tags() returns it verbatim. When placed in an href, clicking the link executes the JavaScript.

  2. data: URIs -- data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg== uses Base64 encoding and contains no tags at all, bypassing strip_tags() entirely.

  3. Protocol-relative URLs -- //evil.com/steal contains no tags and is passed through unchanged. When rendered as an href, the browser resolves it relative to the current page’s protocol, redirecting the user to an attacker-controlled domain.

The core issue is that strip_tags() operates on HTML syntax (angle brackets) while the threat model here requires URL scheme validation. These are fundamentally different security concerns.

Impact

Reflected XSS via crafted return URL. An attacker constructs a malicious link such as https://target.example.com/craft/?returnUrl=javascript:alert(document.cookie) and sends it to a victim. The attack flow is:

  1. Victim clicks the link, visiting the Craft CMS site.
  2. The application calls setReturnUrl() with the attacker-controlled value.
  3. strip_tags() processes the URL but finds no HTML tags -- it passes through unchanged.
  4. The URL is stored in the session and later rendered in an href attribute (e.g., a "Return" or "Continue" link).
  5. When the victim clicks that link, javascript:alert(document.cookie) executes in the context of the Craft CMS origin.

This enables:

  • Session hijacking via cookie theft (document.cookie)
  • Data exfiltration via fetch() to an attacker-controlled server
  • Phishing by redirecting to a lookalike domain (protocol-relative URL)
  • CSRF by performing actions on behalf of the authenticated user
Record
GHSA-fvwq-45qv-xvhv
CVSS 4.0
6.9 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Weakness
CWE-79, CWE-116
Updated
2026-11-02
NVD 6.9

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.

Record
CVE-2026-31859
CVSS 4.0
6.9 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
CVSS 3.1
6.1 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness
CWE-79, CWE-116
Updated
2026-11-02
OSV 6.9

Craft has Reflective XSS via incomplete return URL sanitization

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.

Record
CVE-2026-31859
CVSS 4.0
6.9 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Weakness
CWE-116, CWE-79
Updated
2026-11-02
OSVGHSA-fvwq-45qv-xvhv 6.9

CraftCMS vulnerable to reflective XSS via incomplete return URL sanitization

Summary

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.

Details

The patched code in is:

public function setReturnUrl($url): void
{
    parent::setReturnUrl(strip_tags($url));
}

strip_tags() removes HTML tags (e.g., <script>, <img>) from a string, but it is not a URL sanitizer. When the sanitized return URL is subsequently rendered in an href attribute context (e.g., <a href="{{ returnUrl }}">), the following dangerous payloads survive strip_tags() completely unmodified:

  1. javascript: protocol URLs -- javascript:alert(document.cookie) contains no HTML tags, so strip_tags() returns it verbatim. When placed in an href, clicking the link executes the JavaScript.

  2. data: URIs -- data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg== uses Base64 encoding and contains no tags at all, bypassing strip_tags() entirely.

  3. Protocol-relative URLs -- //evil.com/steal contains no tags and is passed through unchanged. When rendered as an href, the browser resolves it relative to the current page’s protocol, redirecting the user to an attacker-controlled domain.

The core issue is that strip_tags() operates on HTML syntax (angle brackets) while the threat model here requires URL scheme validation. These are fundamentally different security concerns.

Impact

Reflected XSS via crafted return URL. An attacker constructs a malicious link such as https://target.example.com/craft/?returnUrl=javascript:alert(document.cookie) and sends it to a victim. The attack flow is:

  1. Victim clicks the link, visiting the Craft CMS site.
  2. The application calls setReturnUrl() with the attacker-controlled value.
  3. strip_tags() processes the URL but finds no HTML tags -- it passes through unchanged.
  4. The URL is stored in the session and later rendered in an href attribute (e.g., a "Return" or "Continue" link).
  5. When the victim clicks that link, javascript:alert(document.cookie) executes in the context of the Craft CMS origin.

This enables:

  • Session hijacking via cookie theft (document.cookie)
  • Data exfiltration via fetch() to an attacker-controlled server
  • Phishing by redirecting to a lookalike domain (protocol-relative URL)
  • CSRF by performing actions on behalf of the authenticated user
Record
GHSA-fvwq-45qv-xvhv
CVSS 4.0
6.9 MediumCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Weakness
CWE-116, CWE-79
Updated
2026-11-02
OSVCLSA-2026-1784682948 No score

TuxCare security update for craftcms/cms (14 CVEs)

TuxCare rebuilt craftcms/cms to address 14 CVEs. Fixed in 3.9.15-p7+tuxcare.

Record
CLSA-2026-1784682948
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
craftcms/cms
Packagist
4.15.3 to 4.17.2
4.17.3
craftcms/cms
Packagist
5.7.5 to 5.9.6
5.9.7
craftcms/cms
TuxCare:Packagist
From an advisory covering 12 CVEs
3.9.15 up to 3.9.15-p7+tuxcare, plus listed versions
3.9.15-p1+tuxcare3.9.15-p2+tuxcare3.9.15-p3+tuxcare3.9.15-p4+tuxcare3.9.15-p5+tuxcare3.9.15-p6+tuxcare
3.9.15-p7+tuxcare
craftcms/cms
Packagist
4.15.3 up to 4.17.3, plus listed versions
4.15.44.15.54.15.64.15.6.14.15.6.2
Show 28 moreShow less
4.15.74.16.04.16.14.16.104.16.114.16.124.16.134.16.144.16.154.16.164.16.174.16.184.16.194.16.24.16.34.16.44.16.54.16.64.16.6.14.16.74.16.84.16.94.16.9.14.17.04.17.0-beta.14.17.0-beta.24.17.14.17.2
4.17.3
craftcms/cms
Packagist
5.7.5 up to 5.9.7, plus listed versions
5.7.105.7.115.7.65.7.75.7.8
Show 38 moreShow less
5.7.8.15.7.8.25.7.95.8.05.8.15.8.105.8.115.8.125.8.135.8.13.15.8.13.25.8.145.8.155.8.165.8.175.8.185.8.195.8.25.8.205.8.215.8.225.8.235.8.35.8.45.8.55.8.65.8.75.8.85.8.95.9.05.9.0-beta.15.9.0-beta.25.9.15.9.25.9.35.9.45.9.55.9.6
5.9.7

History

History
RecordedChangedSources
affected, facts
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2026-31859 is a medium vulnerability (CVSS 6.9) in Craftcms Cms, published March 11, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.22%, the 12th percentile. Fixed in craftcms/cms 4.17.3.

References

MoveEnter Open