-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support for the X-Forwarded-Host #2891
Support for the X-Forwarded-Host #2891
Conversation
7e1a645
to
1b8c3ac
Compare
Is user-control of the |
We are filtering hostname for illegal letters. We are using host internally to load the correct site configuration and checking against referrer if it's coming from the same site. Maybe something else as well? |
Sorry, to worry. I'm maybe a bit over-reactive, but I'm trying to figure-out an adversary use of There are quite a lot of references to Just one situation as an example (significant or not?): // system/src/Grav/Common/Page/Markdown/Excerpts.php : processImageExcerpt()
$local_file = isset($url_parts['path'])
&& (empty($url_parts['scheme']) || in_array($url_parts['scheme'], ['http', 'https'], true))
&& (empty($url_parts['host']) || $url_parts['host'] === $grav['uri']->host()); With X-Forwarded-Host, an attacker could easily trick this function to make it think the media within a given markdown input is Here there is no subsequent |
@rhukster I think this is a valid concern and can be used for attacks. We cannot trust X_FORWARDED_HOST which means that it should not be used for anything. https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html Looks like this feature is disabled by default in most CMSes. |
I concur with you guys. I should of done more research before approving. It will be removed in next release. |
@rhukster Can we make it configurable and optional instead? I think that in the configurations where it is used, it will be always set by a nearby server/firewall. |
I've added configuration options for all of these in system.yaml but only 'host' is disabled by default so it maintains backwards compatibility:
|
Fixes #2877