Open Redirects
1. Введение:
2. Типичный уязвимый код:
<?php
...
$redirect_url = $_GET['url'];
header("Location: " . $redirect_url);
...
?>...
response.sendRedirect(request.getParameter("url"));
...3. Смягчение последствий
<?php
/* Redirect the browser. */
header("Location: http://www.bobi.io");
/* Exit to prevent the rest of the code from executing. */
exit;
?>
// build the redirectURL based on the hostname lookup
StringBuilder redirectUrl = new StringBuilder()
.append(request.getScheme())
.append("://")
.append(InetAddress.getLoopbackAddress().getHostName())
.append(request.getContextPath()
);
//
response.sendRedirect(redirectUrl);4. Выводы:
Last updated