SAML LogOutRequest processing failed on ADFS server

14,447

Solution 1

Finlay I can do SLO :)

Previously I have worked with ForgeRock's IDP and it worked perfectly, but with ADFS did not. It is obvious that Microsoft has restricted rules related with SAML message formatting. Conclusions that I have found :

  1. LogoutRequest message MUST be signed (SAML 2.0 Profiles doc, Sect 4.4.3.1). Thank you Ian for this.

  2. Order of the XML elements and attributes is important. On the bottom of this message is final version of my log out request.

  3. NameId must be in the same format as one received from AuthenticationResponse. It should contains elements expected by ADFS. These links helped me : Name Identifier (Name ID) claim in the SAML subject and SAML LogoutRequest

  4. LogoutRequest signature must me transformed with XmlDsigExcC14NTransform, that should be added after XmlDsigEnvelopedSignatureTransform

  5. Canonization method for signing should be http://www.w3.org/2001/10/xml-exc-c14n#

  6. Issuer, NameID and SessionIndex are mandatory XML elements

  7. Namespaces are mandatory : xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" and xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"

Final LogoutRequest message that is working :

<samlp:LogoutRequest ID="f8a62847-92f2-4f0c-936a-df9efe0cc42f"
                 Version="2.0"
                 IssueInstant="2013-08-29T20:53:50Z"
                 Destination="https://server/adfs/ls/"
                 Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
                 xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                 >
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://sp.com/</saml:Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    <SignedInfo>
        <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
        <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
        <Reference URI="#f8a62847-92f2-4f0c-936a-df9efe0cc42f">
            <Transforms>
                <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <DigestValue>W7F1E2U1OAHRXn/ItbnsYZyXw/8=</DigestValue>
        </Reference>
    </SignedInfo>
    <SignatureValue></SignatureValue>
    <KeyInfo>
        <X509Data>
            <X509Certificate></X509Certificate>
        </X509Data>
    </KeyInfo>
</Signature>
<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
             Format="http://schemas.xmlsoap.org/claims/UPN"
             >user</saml:NameID>
<samlp:SessionIndex>_2537f94b-a150-415e-9a45-3c6fa2b6dd60</samlp:SessionIndex>

Solution 2

IIRC SAML 2.0 SP-Initiated SLO requires the use of Digital Signatures on the LogoutRequest? This ensures that no one spoofs the LogoutRequest and logs a user out of all their existing sessions.

Assuming you are using the POST binding and not Redirect since I can't see the Signature in the XML. With Redirect the Signature info is passed as a query parameter.

Share:
14,447
Rastko
Author by

Rastko

Updated on June 14, 2022

Comments

  • Rastko
    Rastko almost 2 years

    I have ADFS server as an IdP. I have separate SP application. These are defined in circle of trust. SSO over SAML protocol is working fine. When I try SP initated log out request I got error on ADFS side :

    MSIS7000: The sign in request is not compliant to the WS-Federation language for web browser clients or the SAML 2.0 protocol WebSSO profile.

    EDIT More detail message from ADFS Event Trace :

    MSIS7015: This request does not contain the expected protocol message or incorrect protocol parameters were found according to the HTTP SAML protocol bindings.

    I have reviewed mu log out SAML message and looks correct. Just to mention that same SP is loging out properly with ForgeRocks IdP (ex Sun OpenSSO).

    Saml loout request message :

    <samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                     ID="b00b3f55-f3e3-4935-9e91-da6bf8b62efd"
                     Version="2.0"
                     IssueInstant="2013-08-27T09:45:08Z"
                     Destination="https://00.00.00.00/adfs/ls/"
                     Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
                     NotOnOrAfter="2013-08-27T09:50:08Z"
                     >
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">SPEntityId/</saml:Issuer>                    
    <saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">[email protected]</saml:NameID>
    <samlp:SessionIndex>_ea853497-c58a-408a-bc23-c849752d9741</samlp:SessionIndex>
    

    EDIT

    Lan suggested to me that signing of the logout request messages is mandatory. He was right. In OASIS specification (http://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf) section 4.4.3.1. it is described. According with that I am sending now signed messages but I am having the same issue.

    Signed message :

    <samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                     ID="aed640c0-9455-49ea-9450-4ad7c08d98e7"
                     Version="2.0"
                     IssueInstant="2013-08-29T15:22:45Z"
                     Destination="https://server/adfs/ls/"
                     Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
                     NotOnOrAfter="2013-08-29T03:27:45Z"
                     >
    <saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                 Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient">user</saml:NameID>
    <samlp:SessionIndex>_677952a2-7fb3-4e7a-b439-326366e677db</samlp:SessionIndex>
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">SPIssuer</saml:Issuer>
    <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
            <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
            <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
            <Reference URI="#aed640c0-9455-49ea-9450-4ad7c08d98e7">
                <Transforms>
                    <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                </Transforms>
                <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                <DigestValue>53jjPvQ2Ty1Z+VikwrUwW4Erj3k=</DigestValue>
            </Reference>
        </SignedInfo>
        <SignatureValue>signed value</SignatureValue>
        <KeyInfo>
            <X509Data>
                <X509Certificate>certificate</X509Certificate>
            </X509Data>
        </KeyInfo>
    </Signature>
    

    What I am doing wrong ? Should be specified some other endpoint on ADFS ? As I got is should be used same as for sign on requests (that are working perfectly on my side).

    Thanks, Rastko

  • Rastko
    Rastko over 10 years
    Yes, I know that signature and encryption are integral part of SAML messages. I'm using this in testing environment and to simplify scenarios I am not using these security elements. I'm using POST binding here. I have removed signature on my RelayParty in ADFS configuration. If it is mandatory to be signed, I assume that also authentication request will result with failures, but it is working properly.
  • Rastko
    Rastko over 10 years
    Reflecting Microsoft.IdentityServer.Protocols.Saml.dll and HttpSamlMessageFactory that is in charge for SamlMessage creation found that signing is not mandatory. Take a look on following code part : string value = collection.Get("Signature"); string text2 = collection.Get("SigAlg"); if (!string.IsNullOrEmpty(value)) { if (string.IsNullOrEmpty(text2)) { throw new .. } // some code } return base.CreateFromNameValueCollection(baseUrl, collection);
  • Ian
    Ian over 10 years
    It is not mandatory to sign the AuthnRequest... that is optional regardless of Binding. However, per the spec, (SAML 2.0 Profiles doc, Sect 4.4.3.1) when using an Asynchronous Binding, (POST or Redirect) the LogoutRequest MUST be signed. I'm not an ADFS expert by any stretch but I would be surprised if you could intentionally make ADFS non-compliant...
  • mavis
    mavis almost 8 years
    AuthRequest worked for me with ADFS2.0 without signing. But LogoutRequest is not working. Why is this anomaly? Is it mandatory to sign LogoutRequest- certainly??