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 acs url #102
Validate acs url #102
Conversation
@ikkisoft @itstehkman does this make sense? I have to update docs before merging, but basically this would make it so ACS URLs are whitelisted based on the Host of the metadata URL or the list from |
My understanding of the Destination (saml 2 core lines 1477-1482) vs AssertionConsumerServiceURL (saml 2 core lines 1483-1488) is that they're the same value, but just used for different purposes:
So, I think you can simply use the value you already have in the config for the service_provide and not the metadata URL. some-issuer-url.com/saml --> some-issuer-url.com
If you allow override via config file (as implemented), I think is safe enough to enforce it since people can change the config after the new deployment. Especially, if it's clear in the README. Btw, reading the standard (http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf line 2063) they are actually saying that the IDP is required to perform validation on the AssertionConsumerServiceURL field:
|
ruby-saml (https://github.com/onelogin/ruby-saml) seems to have three separate fields for those items:
So, this is probably the safest / most flexible option. |
For this issue, you can use CVE-2018-18604 (in case you will send out security update notices, etc.) |
I agree with @ikkisoft. I think this PR is mostly good. The only issue I see is if you've configured the IdP with N acceptable_response_hosts, where one of these could maliciously accept a response meant for another host: EG: acceptable_response_hosts = [A, B] I make a SAMLRequest for host A, and it gets maliciously modified such that its Destination / ACS URL is sent to B instead. In the unlikely case that B would accept the assertion, this is an issue. I think it is simpler and more accurate to just have this on a per-service-provider configuration level without checking a set of acceptable hosts. |
lib/saml_idp/request.rb
Outdated
@@ -136,6 +141,20 @@ def session_index | |||
@_session_index ||= xpath("//samlp:SessionIndex", samlp: samlp).first.try(:content) | |||
end | |||
|
|||
def acceptable_reponse_hosts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also small nit: typo -> acceptable_response_hosts
@jphenow is this ready? I think this implementation should suffice. |
Updated to set on per-service-provider basis with a list just for flexibility. If that's a security hole I deem that a hole on their configuration, not the lib. Let me know what you think and I can make a minor version release later today or tomorrow |
@jphenow this looks great! Thanks for the updates. LGTM. |
Released as |
Matching standard (line 2063) so that IDP performs validation on the AssertionConsumerServiceURL field to match Metadata Host or some other configured Host to prevent MitM attacks