Описание
Craft CMS vulnerable to Remote Code Execution via validatePath bypass
Summary
Bypassing the validatePath function can lead to potential Remote Code Execution (Post-authentication, ALLOW_ADMIN_CHANGES=true)
Details
In bootstrap.php, the SystemPaths path is set as below.
Because paths are validated based on the /path1/path2 format, this can be bypassed using a file URI scheme such as file:///path1/path2. File scheme is supported in mkdir()
ref. https://www.php.net/manual/en/wrappers.file.php
PoC
- Create a new filesystem. Base Path: file:///var/www/html/templates

- Create a new asset volume. Asset Filesystem: local_bypass

- Upload a ttml file with rce template code. Confirm poc.ttml file created in /var/www/html/templates

- Create a new route. URI: * , Template: poc.ttml

- Confirm RCE on arbitrary path ( /* )

PoC Env

Impact
Take control of vulnerable systems, Data exfiltrations, Malware execution, Pivoting, etc.
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)
Ссылки
Пакеты
craftcms/cms
>= 4.0.0-RC1, <= 4.4.14
4.4.15
craftcms/cms
>= 3.0.0, <= 3.8.14
3.8.15
Связанные уязвимости
Craft is a CMS for creating custom digital experiences on the web and beyond. Bypassing the validatePath function can lead to potential remote code execution. This vulnerability can lead to malicious control of vulnerable systems and data exfiltrations. 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). This issue has been patched in version 4.4.15 and version 3.8.15.