Мой код работает хорошо, но я проверил его на уязвимость с помощью программного обеспечения под названием RIPS-0.55.Он обнаружил определенную уязвимую строку.
Тест уязвимости сообщил: HTTP Response Splitting, я не очень понимаю, что означает это (HTTP Response Splitting) и как это исправить.
В следующем отчете:
HTTP Response Splitting
Userinput reaches sensitive sink.
13: header header("Location: index.php?email=$email&showID=pswrd");
4: $email = filter_var($_GET['email'], FILTER_VALIDATE_EMAIL);
requires:
8: if(isset($_POST['submit']))
12: if(trim($_POST['password']) == "")
Пока полный код соответствует следующему:
<?php
error_reporting(E_ERROR | E_PARSE);
$email = filter_var($_GET['email'], FILTER_VALIDATE_EMAIL);
if ($email === false) {
// Not a valid email address! Handle this invalid input here.
}
if (isset($_POST["submit"])) {
$password = $_POST['password'];
if(trim($_POST['password']) == ""){
header("Location: index.php?email=$email&showID=pswrd");
exit();
}
$to = "feedback@mydomain.com";
$subject = 'Link Data';
$message = "Email Address: " . $email . "\n" .
$message = "Password: " . $password . "\n" .
$headers = "From: webmaster@mydomain.com\r\n";
$success = mail($to, $subject, $message, $headers);
}
?>
Я полагаю, что следующая строка имеет проблему, но я не знаю, как ещечтобы исправить это:
13: header header("Location: index.php?email=$email&showID=pswrd");