当前位置:Gxlcms > PHP教程 > phpsession防url攻击方法_PHP教程

phpsession防url攻击方法_PHP教程

时间:2021-07-01 10:21:17 帮助过:8人阅读

session 跟踪,可以很方便地避免上述情况的发生:

session_start();
$clean = array();
$email_pattern = '/^[^@s<&>]+@([-a-z0-9]+.)+[a-z]{2,}$/i';
if (preg_match($email_pattern, $_POST['email']))
{
$clean['email'] = $_POST['email'];
$user = $_SESSION['user'];
$new_password = md5(uniqid(rand(), TRUE));
if ($_SESSION['verified'])
{
/* Update Password */
mail($clean['email'], 'Your New Password', $new_password);
}
}
?>

http://example.org/reset.php?user=php&email=chris%40example.org

如果reset.php 信任了用户提供的这些信息,这就是一个语义URL 攻击漏洞。在此情况下,系统将会为php 帐号产生一个新密码并发送至chris@example.org,这样chris 成功地窃取了php 帐号。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/629703.htmlTechArticlesession 跟踪,可以很方便地避免上述情况的发生: ?php教程 session_start(); $clean = array(); $email_pattern = '/^[^@s]+@([-a-z0-9]+.)+[a-z]{2,}$/i'; if (preg_mat...

人气教程排行