Craft CMS stores user-provided content in session files
Description
Craft CMS stores arbitrary content provided by unauthenticated users in session files. This content could be accessed and executed, possibly using an independent vulnerability. Craft CMS redirects requests that require authentication to the login page and generates a session file on the server at '/var/lib/php/sessions'. Such session files are named 'sess_[session_value]', where '[session_value]' is provided to the client in a 'Set-Cookie' response header. Craft CMS stores the return URL requested by the client without sanitizing parameters. Consequently, an unauthenticated client can introduce arbitrary values, such as PHP code, to a known local file location on the server. Craft CMS versions 5.7.5 and 4.15.3 have been released to address this issue.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
craftcms/cmsPackagist | >= 5.0.0-alpha.1, < 5.7.5 | 5.7.5 |
craftcms/cmsPackagist | < 4.15.3 | 4.15.3 |
Affected products
1- Craft/CMSv5Range: 0
Patches
1e4c7bac8f310Merge pull request #17220 from craftcms/bugfix/clean-session-return-url
2 files changed · +9 −0
CHANGELOG.md+1 −0 modified@@ -6,6 +6,7 @@ - Fixed a SQL error that could occur when running garbage collection. ([#17197](https://github.com/craftcms/cms/issues/17197)) - Fixed a PHP error that could occur if malformed UTF-8 data was passed to `craft\helpers\StringHepler::replaceMb4()`. ([#17202](https://github.com/craftcms/cms/issues/17202)) - Fixed a bug where “Applying new propagation method” jobs weren’t propagating elements to newly-supported sites. ([#17207](https://github.com/craftcms/cms/issues/17207)) +- Return URLs are now sanitized before being saved to the PHP session. - Fixed a styling issue. ## 4.15.2 - 2025-04-23
src/web/User.php+8 −0 modified@@ -466,6 +466,14 @@ public function generateToken(int $userId): void SessionHelper::set($this->tokenParam, $token); } + /** + * @inheritdoc + */ + public function setReturnUrl($url): void + { + parent::setReturnUrl(strip_tags($url)); + } + /** * @inheritdoc */
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- github.com/advisories/GHSA-7vrx-9684-xrf2ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-35939ghsaADVISORY
- github.com/craftcms/cms/commit/e4c7bac8f31010aee048409f9ef6f744a83146b2ghsaWEB
- github.com/craftcms/cms/pull/17220ghsaWEB
- github.com/craftcms/cms/releases/tag/4.15.3ghsaWEB
- github.com/craftcms/cms/releases/tag/5.7.5ghsaWEB
- raw.githubusercontent.com/cisagov/CSAF/develop/csaf_files/IT/white/2025/va-25-147-01.jsonghsaWEB
- www.cisa.gov/known-exploited-vulnerabilities-catalogghsaWEB
- www.cve.org/CVERecordghsaWEB
News mentions
0No linked articles in our index yet.