mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Fix open redirect in tag.php + language.php: reject protocol-relative URLs (//evil.com) by also checking for // prefix
This commit is contained in:
@@ -74,9 +74,10 @@ try {
|
||||
}
|
||||
|
||||
$redirect = '/admin/contenus.php';
|
||||
// Allow the caller to override the redirect
|
||||
if (!empty($_POST['return']) && str_starts_with($_POST['return'], '/')) {
|
||||
$redirect = $_POST['return'];
|
||||
// Allow the caller to override the redirect (same-origin only, no protocol-relative)
|
||||
$return = $_POST['return'] ?? '';
|
||||
if ($return !== '' && str_starts_with($return, '/') && !str_starts_with($return, '//')) {
|
||||
$redirect = $return;
|
||||
}
|
||||
header('Location: ' . $redirect);
|
||||
exit();
|
||||
|
||||
Reference in New Issue
Block a user