Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to other Domain possible #3

Open
revoltek-daniel opened this issue Mar 21, 2024 · 0 comments
Open

Redirect to other Domain possible #3

revoltek-daniel opened this issue Mar 21, 2024 · 0 comments

Comments

@revoltek-daniel
Copy link

Hello,

the ?_redirect= Parameter supports "https:///evil.host" as parameter and redirects to this host.

This could be a possible security issue. https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html

I would suggest to add an check if the hostname (if one is available) in the redirect url matches the current one or add an possible allow list for users who needed different domains.

Something like

$host = \parse_url($redirect->getTargetUrl(), \PHP_URL_HOST);

if ($host === null || $host === $request->getHost()) {
    return new RedirectResponse($redirect);
}

throw new \InvalidArgumentException('Redirect target host must be the same as the request host.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant