Winter CMS vulnerable to stored XSS through privileged upload of SVG file
Description
Winter is a free, open-source content management system (CMS) based on the Laravel PHP framework. Users with the backend.manage_branding permission can upload SVGs as the application logo. Prior to version 1.2.3, SVG uploads were not sanitized, which could have allowed a stored cross-site scripting (XSS) attack. To exploit the vulnerability, an attacker would already need to have developer or super user level permissions in Winter CMS. This means they would already have extensive access and control within the system. Additionally, to execute the XSS, the attacker would need to convince the victim to directly visit the URL of the maliciously uploaded SVG, and the application would have to be using local storage where uploaded files are served under the same domain as the application itself instead of a CDN. This is because all SVGs in Winter CMS are rendered through an img tag, which prevents any payloads from being executed directly. These two factors significantly limit the potential harm of this vulnerability. This issue has been patched in v1.2.3 through the inclusion of full support for SVG uploads and automatic sanitization of uploaded SVG files. As a workaround, one may apply the patches manually.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
wintercms/winterPackagist | < 1.2.3 | 1.2.3 |
Affected products
1Patches
2fa50b4c7489bAdd support for uploading SVGs
1 file changed · +10 −6
modules/backend/traits/UploadableWidget.php+10 −6 modified@@ -1,17 +1,16 @@ <?php namespace Backend\Traits; -use Str; +use ApplicationException; +use Event; use File; +use Illuminate\Filesystem\FilesystemAdapter; use Lang; -use Event; -use Config; -use Storage; use Request; use Response; -use ApplicationException; +use Str; use System\Classes\MediaLibrary; -use Illuminate\Filesystem\FilesystemAdapter; use Winter\Storm\Filesystem\Definitions as FileDefinitions; +use Winter\Storm\Support\Svg; /** * Uploadable Widget Trait @@ -124,6 +123,11 @@ protected function onUploadDirect(): \Illuminate\Http\Response $filePath = $this->uploadableGetUploadPath($fileName); + // Filter SVG files + if (pathinfo($filePath, PATHINFO_EXTENSION) === 'svg') { + file_put_contents($sourcePath, Svg::extract($sourcePath)); + } + $this->uploadableGetDisk()->put($filePath, File::get($sourcePath)); /**
186d85d8fea2Add support for uploading SVGs
2 files changed · +24 −11
src/Database/Attach/File.php+16 −6 modified@@ -11,6 +11,7 @@ use Winter\Storm\Exception\ApplicationException; use Winter\Storm\Network\Http; use Winter\Storm\Support\Facades\File as FileHelper; +use Winter\Storm\Support\Svg; /** * File attachment model @@ -834,31 +835,40 @@ protected function putFile($sourcePath, $destinationFileName = null) $destinationFileName = $this->disk_name; } - $destinationPath = $this->getStorageDirectory() . $this->getPartitionDirectory(); + $destinationFolder = $this->getStorageDirectory() . $this->getPartitionDirectory(); + $destinationPath = $destinationFolder . $destinationFileName; + + // Filter SVG files + if (pathinfo($destinationPath, PATHINFO_EXTENSION) === 'svg') { + file_put_contents($sourcePath, Svg::extract($sourcePath)); + } + + pathinfo($destinationPath, PATHINFO_EXTENSION); if (!$this->isLocalStorage()) { - return $this->copyLocalToStorage($sourcePath, $destinationPath . $destinationFileName); + return $this->copyLocalToStorage($sourcePath, $destinationPath); } /* * Using local storage, tack on the root path and work locally * this will ensure the correct permissions are used. */ - $destinationPath = $this->getLocalRootPath() . '/' . $destinationPath; + $destinationFolder = $this->getLocalRootPath() . '/' . $destinationFolder; + $destinationPath = $destinationFolder . $destinationFileName; /* * Verify the directory exists, if not try to create it. If creation fails * because the directory was created by a concurrent process then proceed, * otherwise trigger the error. */ if ( - !FileHelper::isDirectory($destinationPath) && - !FileHelper::makeDirectory($destinationPath, 0777, true, true) + !FileHelper::isDirectory($destinationFolder) && + !FileHelper::makeDirectory($destinationFolder, 0777, true, true) ) { trigger_error(error_get_last()['message'], E_USER_WARNING); } - return FileHelper::copy($sourcePath, $destinationPath . $destinationFileName); + return FileHelper::copy($sourcePath, $destinationPath); } /**
src/Filesystem/Definitions.php+8 −5 modified@@ -113,6 +113,7 @@ protected function defaultExtensions(): array 'png', 'webp', 'gif', + 'svg', 'js', 'map', 'ico', @@ -147,7 +148,7 @@ protected function defaultExtensions(): array 'webm', 'mkv', 'rar', - 'zip' + 'zip', ]; } @@ -167,6 +168,7 @@ protected function assetExtensions(): array 'png', 'webp', 'gif', + 'svg', 'ico', 'css', 'js', @@ -178,7 +180,7 @@ protected function assetExtensions(): array 'md', 'less', 'sass', - 'scss' + 'scss', ]; } @@ -197,7 +199,8 @@ protected function imageExtensions(): array 'bmp', 'png', 'webp', - 'gif' + 'gif', + 'svg', ]; } @@ -217,7 +220,7 @@ protected function videoExtensions(): array 'mpg', 'mpeg', 'mkv', - 'webm' + 'webm', ]; } @@ -235,7 +238,7 @@ protected function audioExtensions(): array 'wav', 'wma', 'm4a', - 'ogg' + 'ogg', ]; } }
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
7- github.com/advisories/GHSA-wjw2-4j7j-6gc3ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2023-37269ghsaADVISORY
- packetstormsecurity.com/files/173520/WinterCMS-1.2.2-Cross-Site-Scripting.htmlghsaWEB
- github.com/wintercms/storm/commit/186d85d8fea2cae43afc807d39f68553c24e56beghsax_refsource_MISCWEB
- github.com/wintercms/winter/commit/fa50b4c7489b67ea80072f8ac9fe5294fce1df1cghsax_refsource_MISCWEB
- github.com/wintercms/winter/releases/tag/v1.2.3ghsax_refsource_MISCWEB
- github.com/wintercms/winter/security/advisories/GHSA-wjw2-4j7j-6gc3ghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.