-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Validate Host header to prevent Host header injection #208
base: master
Are you sure you want to change the base?
Conversation
What could an invalid Host header be injected into? A reverse proxy is going to not be able to route it to a back-end and a custom app isn't ever going to find any content to serve... Is this just incase your logging analysis platform is vulnerable to xss? |
I can definitely see the value of this for certain kinds of APIs, but I don't think it would be necessary for every kind of API out there, and I imagine, could potentially get in the way of normal operation in some cases. A bit contextual, I think. That would then also raise the question of whether we should include contextual checks in the checklist, or leave them be, just including the most standard, common checks in the checklist (and honestly, I have no idea there; it may be a bit more work, but may also be a bit more useful for people that way.. or may not; I don't know). Does anyone else have any thoughts regarding this that they'd be willing to share? For now, I'd rather just leave this pull request open and postpone any decision for whether to merge it or not until there's a bit more feedback from others. |
This could be added as part of the This way the recommendation isn't a vague "maybe regex match the header" and also pushes the "no thanks" response all the way out to any loadbalancing / cdn / ssl terminating devices. It also makes it less likely that a random intern from the appsec team won't come and bother the developers |
421 Misdirected Request is exactly what I was thinking of! There have been cases where it is possible to redirect the website to another domain by tampering with the Host header. (Would that come under Host header injection or header based redirection?) My reasoning behind this was if the Host header is validated on every request, it would prevent that class of vulnerability. If there is no host header validation, then the request will be forwarded as usual by thr reverse proxy right? |
@ayushmanchhabra I believe you're thinking of "fronting", where the bad guy puts their infra on a popular service, and then uses a random good guy's dns names/certs to talk to the hosting providers' border proxy and they then set
With this setup:
I think this is one of the main "reasons" sketchy enterprise security products love to MITM'ing https traffic when you're in the office. It's possible that mis-matched I'm sure somebody has written a howtos nginx/haproxy/caddie/træfic/etc to help prevent this kind of thing |
This makes sense to me |
No description provided.