You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, unsigned responses with an empty Destination were accepted
without any Destination validation. This allowed an attacker to replay
a captured response to a different SP, since the Destination was the
only non-cryptographic binding to the intended recipient.
Now Destination is always required and validated, regardless of whether
the response is signed. The SAML spec says Destination MUST be present
on signed responses and SHOULD be present otherwise — we upgrade the
SHOULD to a MUST for defense in depth.
Fixes#12
returnnil, fmt.Errorf("`Destination` does not match requested URL or AcsURL (destination %q, requested %q, acs %q)", response.Destination, currentURL.String(), sp.AcsURL.String())
1015
-
}
1004
+
// Per section 3.4.5.2 of the SAML spec, Destination MUST be present
1005
+
// when a signature is present, and SHOULD be present otherwise. We
1006
+
// require it always: for unsigned responses the Destination is the
1007
+
// only non-cryptographic binding to this SP, and omitting it would
1008
+
// let an attacker replay a response across service providers.
1009
+
ifresponse.Destination=="" {
1010
+
returnnil, fmt.Errorf("`Destination` is required but missing")
1011
+
}
1012
+
// Historically, we checked against the SP's ACS URL instead of currentURL, which is usually the same but may differ in query params.
1013
+
// To mitigate the risk of switching to comparing against currentURL, we still allow it if the ACS URL matches, even if the current URL doesn't.
returnnil, fmt.Errorf("`Destination` does not match requested URL or AcsURL (destination %q, requested %q, acs %q)", response.Destination, currentURL.String(), sp.AcsURL.String())
"`Destination` does not match requested URL or AcsURL (destination \"\", requested \"https://15661444.ngrok.io/saml2/acs\", acs \"https://15661444.ngrok.io/saml2/acs\")"))
"`Destination` does not match requested URL or AcsURL (destination \"\", requested \"https://15661444.ngrok.io/saml2/acs\", acs \"https://15661444.ngrok.io/saml2/acs\")"))
0 commit comments