CVE-2023-32679
highPriorität · verfolgen · 30EPSS 0.018 · 79. PerzentilEUUSEPSS · bewertet 2026-10-27
Craft CMS is an open source content management system. In affected versions of Craft CMS an unrestricted file extension may lead to Remote Code Execution. If the name parameter value is not empty string('') in the View.php's doesTemplateExist() -> resolveTemplate() -> _resolveTemplateInternal() -> _resolveTemplate() function, it returns directly without extension verification, so that arbitrary extension files are rendered as twig templates. When attacker with admin privileges on a DEV or an improperly configured STG or PROD environment, they can exploit this vulnerability to remote code execution. Code execution may grant the attacker access to the host operating system. This issue has been addressed in version 4.4.6. Users are advised to upgrade. There are no known workarounds for this vulnerability.
cvss
Technischer Schweregrad, 0–10. Eine Zeile je Quelle.
Basiswert 0–10 · höher = schwerwiegender · Vektor überfahren zum Auflösen⚠ Quellen uneinig · medium–high · 6.6–7.2
SSVC
Eine Handlungsentscheidung — aus Ausnutzung und Auswirkung.
schwächen
Die CWE-Schwächeklassen, zu denen dies gehört.
betroffene Produkte (3)
Betroffene Produkte und Versionsbereiche.
Advisories (1)
Hersteller- und Ökosystem-Meldungen dazu.
- GHSA-vqxf-r9ph-cc9cCraft CMS vulnerable to Remote Code Execution via unrestricted file extension 2023-05-22ghsa · osvUS
### Summary Unrestricted file extension lead to a potential Remote Code Execution (Authenticated, ALLOW_ADMIN_CHANGES=true) ### Details #### Vulnerability Cause : If the name parameter value is not empty string('') in the View.php's doesTemplateExist() -> resolveTemplate() -> _resolveTemplateInternal() -> _resolveTemplate() function, it returns directly without extension verification, so that arbitrary extension files are rendered as twig templates (even if they are not extensions set in defaultTemplateExtensions = ['html', 'twig']) ```php /** * Searches for a template files, and returns the first match if there is one. * * @param string $basePath The base path to be looking in. * @param string $name The name of the template to be looking for. * @param bool $publicOnly Whether to only look for public templates (template paths that don’t start with the private template trigger). * @return string|null The matching file path, or `null`. */ private function _resolveTemplate(string $basePath, string $name, bool $publicOnly): ?string { // Normalize the path and name $basePath = FileHelper::normalizePath($basePath); $name = trim(FileHelper::normalizePath($name), '/'); // $name could be an empty string (e.g. to load the homepage template) if ($name !== '') { if ($publicOnly && preg_match(sprintf('/(^|\/)%s/', preg_quote($this->_privateTemplateTrigger, '/')), $name)) { return null; } // Maybe $name is already the full file path $testPath = $basePath . DIRECTORY_SEPARATOR . $name; if (is_file($testPath)) { return $testPath; } foreach ($this->_defaultTemplateExtensions as $extension) { $testPath = $basePath . DIRECTORY_SEPARATOR . $name . '.' . $extension; if (is_file($testPath)) { return $testPath; } } } foreach ($this->_indexTemplateFilenames as $filename) { foreach ($this->_defaultTemplateExtensions as $extension) { $testPath = $basePath . ($name !== '' ? DIRECTORY_SEPARATOR . $name : '') . DIRECTORY_SEPARATOR . $filename . '.' . $extension; if (is_file($testPath)) { return $testPath; } } } return null; } ``` When attacker with admin privileges on the DEV or Misconfigured STG, PROD, they can exploit this vulnerability to remote code execution **(ALLOW_ADMIN_CHANGES=true)** ### PoC **Step 1)** Create a new filesystem. **Base Path: /var/www/html/templates**  **Step 2)** Create a new asset volume. **Asset Filesystem: template**  **Step 3)** Upload poc file( .txt , .js , .json , etc ) with twig template rce payload ```twig {{'<pre>'}} {{1337*1337}} {{['cat /etc/passwd']|map('passthru')|join}} {{['id;pwd;ls -altr /']|map('passthru')|join}} ```   **Step 4)** Create a new global set with template layout. The template filename is poc.js  **Step 5)** When access global menu or /admin/global/test, poc.js is rendered as a template file and RCE confirmed  **Step 6)** RCE can be confirmed on other menus(Entries, Categories) where the template file is loaded.   **Poc Environment)** ALLOW_ADMIN_CHANGES=true, defaultTemplateExtensions=['html','twig']    ### Impact Take control of vulnerable systems, Data exfiltrations, Malware execution, Pivoting, etc. Additionally, there are 371 domains using CraftCMS exposed on Shodan, and among them, 33 servers have "stage" or "dev" included in their hostnames. although the vulnerability is exploitable only in the authenticated users, configuration with ALLOW_ADMIN_CHANGES=true, there is still a potential security threat (Remote Code Execution)  ### Remediation Recommend taking measures by referring to https://github.com/craftcms/cms-ghsa-9f84-5wpf-3vcf/pull/1 ```php // Maybe $name is already the full file path $testPath = $basePath . DIRECTORY_SEPARATOR . $name; if (is_file($testPath)) { // Remedation: Verify template file extension, before return $fileExt = pathinfo($testPath, PATHINFO_EXTENSION); $isDisallowed = false; if (isset($fileExt)) { $isDisallowed = !in_array($fileExt, $this->_defaultTemplateExtensions); if($isDisallowed) { return null; } else { return $testPath; } } } ``` 
auch bekannt als (3)
Weitere Namen und Kennungen dieser Entität.
quellen
Welche Quellen diesen Datensatz belegen und wann.
Referenzen (4)
Externe Belege — Patches, Meldungen, Analysen.
- https://cxsecurity.com/cveshow/CVE-2023-32679/cnnvd
- https://github.com/craftcms/cms/security/advisories/GHSA-vqxf-r9ph-cc9ccnnvd
- https://github.com/craftcms/cms/security/advisories/GHSA-vqxf-r9ph-cc9cenisa_euvd
- https://github.com/craftcms/cms/security/advisories/GHSA-vqxf-r9ph-cc9cExploitVendor Advisorynvd
Angreifer nutzen Schwachstellen wie diese gegen im Internet exponierte Dienste aus. Sehen Sie mit einem kostenlosen Passiv-Scan, was exponiert ist.
Kostenloser Scan