Skip to content

Commit

Permalink
Don't allow redirect to external website
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Apr 8, 2024
1 parent 7181b98 commit ef62b53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 0 additions & 6 deletions system/login.php
Expand Up @@ -42,12 +42,6 @@

$logged = false;
unset($account_logged);

if(isset($_REQUEST['redirect']))
{
header('Location: ' . urldecode($_REQUEST['redirect']));
exit;
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions system/pages/accountmanagement.php
Expand Up @@ -52,9 +52,16 @@
{
$redirect = urldecode($_REQUEST['redirect']);

// should never happen, unless hacker modify the URL
if (strpos($_REQUEST['redirect'], BASE_URL) === false) {
error('Fatal error: Cannot redirect outside the website.');
return;
}

$twig->display('account.redirect.html.twig', array(
'redirect' => $redirect
));

return;
}

Expand Down

0 comments on commit ef62b53

Please sign in to comment.