Cookie spoof

Stopinski, Thomas Thaddäus thstopinski at
Thu Nov 7 10:32:36 EST 2019

Hey Folks,

first I want to describe our setup before I come to our problems. I will ask questions along the way, where Its seems suitable. 

We have an Apache webserver and a SP running on a VM on Ubuntu 18.04 At the beginning we want to protect a asp .net core Webapp, that runs on Azure Cloud service. Everything is up-to-date.

1. Is this kind off setup recommendable or even possible? 

We have configured the SP as a reverse proxy.

2. Is that even necessary?

We can successfully login at a test IP that our organization supplies for testing.

3. How can we make sure that the whole communication is actually SAML2 protected?

Now coming to our problem, we are not able to perform a route back to our Webapp.
We keep getting the following exception:
	"opensaml::SecurityPolicyException at (https://shibboletho
	Attempt to spoof header (Shib-Cookie-Name) was detected.

We already tried almost every configuration that we could find, but they lead us nowhere.

Our Virtual Hosts configuration looks like this:	

<VirtualHost *:80>
        UseCanonicalName On
        # :
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ErrorLog ${APACHE_LOG_DIR}/error.log
RewriteEngine on
RewriteCond %{SERVER_NAME}
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

<VirtualHost *:443>
        UseCanonicalName On
        ServerAdmin webmaster at localhost

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCACertificateFile /etc/shibboleth/sso-test.pem

<Location / >
        Order deny,allow
        Allow from all
        AuthType shibboleth
ShibRequestSetting requireSession 1
        ShibUseHeaders On
        Require shibboleth

    SSLProxyEngine on
    ProxyRequests off
    ProxyPass /
    ProxyPassReverse /
    ProxyPreserveHost On

        SSLCertificateFile /etc/letsencrypt/live/
  SSLCertificateKeyFile    /etc/letsencrypt/live/
Include /etc/letsencrypt/options-ssl-apache.conf

Our shibboleth2.xml looks like follows:

<SPConfig xmlns="urn:mace:shibboleth:3.0:native:sp:config"
    <OutOfProcess tranLogFormat="%u|%s|%IDP|%i|%ac|%t|%attr|%n|%b|%E|%S|%SS|%L|%UA|%a" />

    By default, in-memory StorageService, ReplayCache, ArtifactMap, and SessionCache
    are used. See example-shibboleth2.xml for samples of explicitly configuring them.

<RequestMapper type="Native">
        <RequestMap applicationId="default">
            The example requires a session for documents in /secure on the containing host with http and
            https on the default ports. Note that the name and port in the <Host> elements MUST match
            Apache's ServerName and Port directives or the IIS Site name in the <ISAPI> element above.
            <Host name="">
                <Path name="SShTestApp" authType="shibboleth" requireSession="true" applicationId="SShTestApp"/>
           <!-- Example of a second vhost mapped to a different applicationId. -->
            <Host name="" applicationId="admin" authType="shibboleth" requireSession="true"/>

    <!-- The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined. -->
    <!--    <ApplicationDefaults id="default" policyId="default" entityID="" -->
<ApplicationDefaults id="default" policyId="default" entityID=""
        REMOTE_USER="eppn subject-id pairwise-id persistent-id"

        Controls session lifetimes, address checks, cookie handling, and the protocol handlers.
        Each Application has an effectively unique handlerURL, which defaults to "/Shibboleth.sso"
        and should be a relative path, with the SP computing the full value based on the virtual
        host. Using handlerSSL="true" will force the protocol to be https. You should also set
        cookieProps to "https" for SSL-only sites. Note that while we default checkAddress to
        "false", this makes an assertion stolen in transit easier for attackers to misuse.
        <Sessions lifetime="28800" timeout="3600" relayState="ss:mem"
                  checkAddress="true" handlerSSL="true" cookieProps="https">

            Configures SSO for a default IdP. To properly allow for >1 IdP, remove
            entityID property and adjust discoveryURL to point to discovery service.
            You can also override entityID on /Login query string, or in RequestMap/htaccess.

              <SSO entityID="">
             <!-- SAML and local-only logout. -->
            <Logout>SAML2 Local</Logout>

            <!-- Administrative logout. -->
            <LogoutInitiator type="Admin" Location="/Logout/Admin" acl=" ::1" />

            <!-- Extension service that generates "approximate" metadata based on SP configuration. -->
            <Handler type="MetadataGenerator" Location="/Metadata" signing="true"/>

            <!-- Status reporting service. -->
            <Handler type="Status" Location="/Status" acl=" ::1"/>

            <!-- Session diagnostic service. -->
            <Handler type="Session" Location="/Session" showAttributeValues="true"/>

            <!-- JSON feed of discovery information. -->
            <Handler type="DiscoveryFeed" Location="/DiscoFeed"/>

        Allows overriding of error template information/filenames. You can
        also add your own attributes with values that can be plugged into the
        templates, e.g., helpLocation below.
        <Errors supportContact="root at localhost"

        <!-- Example of locally maintained metadata. -->
        <MetadataProvider type="XML" validate="true" path="partner-metadata.xml"/>

        <!-- Example of remotely supplied batch of signed metadata. -->
        <MetadataProvider type="XML" validate="true"
              backingFilePath="federation-metadata.xml" maxRefreshDelay="7200">
            <MetadataFilter type="RequireValidUntil" maxValidityInterval="2419200"/>
            <MetadataFilter type="Signature" certificate="fedsigner.pem" verifyBackup="false"/>
            <DiscoveryFilter type="Blacklist" matcher="EntityAttributes" trimTags="true"
              attributeValue="" />

        <!-- Example of remotely supplied "on-demand" signed metadata. -->
        <MetadataProvider type="MDQ" validate="true" cacheDirectory="mdq"
                    baseUrl="" ignoreTransport="true">
            <MetadataFilter type="RequireValidUntil" maxValidityInterval="2419200"/>
            <MetadataFilter type="Signature" certificate="mdqsigner.pem" />

<!-- RWTH Aachen Metadaten -->
        <MetadataProvider type="XML" url="" backingFilePath="/etc/shibboleth/rwth.metadata.xml" reloadInterval="7200">
           <MetadataFilter type="Signature" certificate="/etc/shibboleth/sso-test.pem"/>

        <!-- Map to extract attributes from SAML assertions. -->
        <AttributeExtractor type="XML" validate="true" reloadChanges="false" path="attribute-map.xml"/>
        <!-- Default filtering policy for recognized attributes, lets other data pass. -->
        <AttributeFilter type="XML" validate="true" path="attribute-policy.xml"/>

        <!-- Simple file-based resolvers for separate signing/encryption keys. -->
        <CredentialResolver type="File" key="/etc/shibboleth/sp-key.pem" certificate="/etc/shibboleth/sp-cert.pem"/>

<ApplicationOverride id="SShTestApp" entityID="">
    <Sessions lifetime="28800" timeout="3600"
        handlerURL="/LogIn/EditUser" handlerSSL="true"
        <SessionInitiator type="Chaining" Location="/Login" isDefault="true"
                        relayState="cookie" entityID="">
                        <SessionInitiator type="SAML2" acsIndex="1" template="bindingTemplate.html"/>
                        <SessionInitiator type="Shib1" acsIndex="5" />

    <!-- Policies that determine how to process and authenticate runtime messages. -->
    <SecurityPolicyProvider type="XML" validate="true" path="security-policy.xml"/>

    <!-- Low-level configuration about protocols and bindings available for use. -->
    <ProtocolProvider type="XML" validate="true" reloadChanges="false" path="protocols.xml"/>

As one can see we followed the rule:more is always better.
We  are not  even sure if we need the ApplicationOverride and the RequestMaper.

I know it's a lot, but we're have the feeling, we're stuck in a deadend.

So any kind of constructive suggestions are highly appreciated.

Thanks for your help in advance.


Thomas Stopinski

Medizinische Fakultät
RWTH Aachen University
Forckenbeckstraße 71
52057 Aachen
Tel.: Dipl.-Ing. (FH) Thomas Stopinski
Dekanat ... 
Gebäude CT², Etage 6,    Raum 05 
Forckenbeckstraße 71
52074 Aachen
Telefon: +49 241 80 89498
Email: thstopinski at
Büro: CT² Center for Teaching and Training, Etage 6, Raum 6.06

More information about the users mailing list