sqli第24关二次注入

注入点

# Validating the user input........
	$username= $_SESSION["username"];
	$curr_pass= mysql_real_escape_string($_POST['current_password']);
	$pass= mysql_real_escape_string($_POST['password']);
	$re_pass= mysql_real_escape_string($_POST['re_password']);
	
	if($pass==$re_pass)
	{	
		$sql = "UPDATE users SET PASSWORD='$pass' where username='$username' and password='$curr_pass' ";
		$res = mysql_query($sql) or die('You tried to be smart, Try harder!!!! :( ');
		$row = mysql_affected_rows();
		echo '<font size="3" color="#FFFF00">';
		echo '<center>';
		if($row==1)
		{
			echo "Password successfully updated";
	
		}
		else
		{
			header('Location: failed.php');
			//echo 'You tried to be smart, Try harder!!!! :( ';
		}
	}

$username= $_SESSION["username"];

$sql = "UPDATE users SET PASSWORD='$pass' where username='$username' and password='$curr_pass' ";

对已经注册的用户的username没有转义特殊字符

思路

1,注册一个新用户admin'#虽然转义了,但特殊字符一起写进了数据库

2,用该用户更换密码,你更换的密码就是admin用户的密码 

sql语句变为

$sql = "UPDATE users SET PASSWORD='$pass' where username='admin'#' and password='$curr_pass' ";

说以你去更新的是admin的密码

相关推荐

  1. SQL注入注入

    2024-03-31 01:32:05       8 阅读
  2. sqli报错注入

    2024-03-31 01:32:05       17 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-31 01:32:05       17 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-31 01:32:05       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-31 01:32:05       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-31 01:32:05       18 阅读

热门阅读

  1. C++:右值引用 && 和移动赋值std::move分析

    2024-03-31 01:32:05       16 阅读
  2. ResutBuilder 学习笔记二:增加新的输入数据类型

    2024-03-31 01:32:05       21 阅读
  3. 每日一题 --- 四数相加 II[力扣][Go]

    2024-03-31 01:32:05       23 阅读
  4. 什么是ac

    2024-03-31 01:32:05       19 阅读
  5. kubernetes(K8S)学习(八):K8S之常见部署方案

    2024-03-31 01:32:05       19 阅读
  6. PreparedStatement对象

    2024-03-31 01:32:05       16 阅读
  7. Acwing 1238.日志统计 双指针

    2024-03-31 01:32:05       17 阅读
  8. 对象数组与指针与引用

    2024-03-31 01:32:05       19 阅读