工具介绍:盲注可以通过人工去做,但是成本太高,Webgoat提供一个工具Simple JHijack(下载地址),通过与Tamper Data(使用方法)的结合使用,能够完成部分盲注。
界面介绍:
具体的实施
The form below allows a user to enter an account number and determine if it is valid or not. Use this form to develop a true / false test check other entries in the database.The goal is to find the value of the fieldpinin table pins for the row with the cc_number of 1111222233334444. The field is of type int, which is an integer.
题意:页面上存在一个查询框(如下),在查询框中输入员工编号,系统能够返回该编号是否有效。现要求通过盲注,查找出pins表中cc_number为1111222233334444的员工的pin值,提示pin值为整数。
解法:
(1)通过手动注入
代码:101 AND ((SELECT pin FROM pins WHERE cc_number='1111222233334444') > 10000 );
首先可以看到这个查询语句是由AND连接,AND的左侧是为true(上图中已经给以验证,101的员工编号是存在的),AND的右侧是一个判断语句判断cc_number='1111222233334444'的员工的pin值是否大于10000,若大于则返回真。我们可以通过变化pin值的范围,通过夹逼定理来推导出pin值。
(2)使用工具注入
代码:account_number=101and (select ascii(substr (pin,1,1))from pins where cc_number=1111222233334444)=$ --
........
account_number=101 and (select ascii(substr (pin,5,1))from pins where cc_number=1111222233334444)=$ --
配置好后,点击hijack,右侧的结果标注有==><==的就是我们的结果,第一次是50,第二次51,第三次是54,第四次是52,而第五次会出现如下图
result为空,说明pin值只有四位,分别为50,51,54,52即2364.验证结果正确。
The form below allows a user to enter an account number and determine if it is valid or not. Use this form to develop a true / false test check other entries in the database.Reference Ascii Values: 'A' = 65 'Z' = 90 'a' = 97 'z' = 122. The goal is to find the value of the field name in table pins for the row with the cc_number of 4321432143214321. The field is of type varchar, which is a string.Put the discovered name in the form to pass the lesson. Only the discovered name should be put into the form field, paying close attention to the spelling and capitalization.
题意:与上题类似,只是猜测cc_number为4321432143214321的name,name为varchar。
解题:猜测范围a~zA~Z,范围为65-122
代码:
account_number=101 and (select ascii(substr (name,1,1))from pins where cc_number=4321432143214321)=$ --
...
account_number=101 and (select ascii(substr (name,4,1))from pins where cc_number=4321432143214321)=$ --
配置hijack
猜测的第一个为74,其余依次类推105,108,108。即Jill。验证如下