开放重定向
为什么危险
攻击者会发送你可信域名下的链接,把访客直接跳转到钓鱼页面。
header('Location: ' . $_GET['next']);
$next = $_GET['next'] ?? '/';
if (!str_starts_with($next, '/') || str_starts_with($next, '//')) {
$next = '/';
}
header('Location: ' . $next);
修复方法
仅重定向到本站路径或白名单地址。
扫描我的代码
扫描我的代码 →
粘贴文件,PHP Safe 会指出所有符合此规则的代码行。