phpsafe 𝕏 GitHub
官方 CA 421DTkQ3TSG3n7F9SkNZj9NxvdFGbypwkctPd2uupump 仅此地址为官方地址。

开放重定向

严重程度: 中 CWE-601 OWASP A01:2021 Broken Access Control rule: redirect

为什么危险

攻击者会发送你可信域名下的链接,把访客直接跳转到钓鱼页面。

✕ 有漏洞的写法
header('Location: ' . $_GET['next']);
✓ 安全的写法
$next = $_GET['next'] ?? '/';
if (!str_starts_with($next, '/') || str_starts_with($next, '//')) {
    $next = '/';
}
header('Location: ' . $next);

修复方法

仅重定向到本站路径或白名单地址。

扫描我的代码

粘贴文件,PHP Safe 会指出所有符合此规则的代码行。

扫描我的代码 →