Cookie spoof
Stopinski, Thomas Thaddäus
thstopinski at ukaachen.de
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 urserver.com/)
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
ServerName shibboleth-ourserver.com
# https://serverfault.com/questions/743411/only-one-shibboleth-sp-on-reverse-proxy-for-different-sites :
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorLog ${APACHE_LOG_DIR}/error.log
RewriteEngine on
RewriteCond %{SERVER_NAME} =shibboleth-ourserver.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
UseCanonicalName On
ServerName shibboleth-ourserver.com
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
</Location>
SSLProxyEngine on
ProxyRequests off
ProxyPass / https://shibboleth-ourserver.com
ProxyPassReverse / https://shibboleth-ourserver.com
ProxyPreserveHost On
SSLCertificateFile /etc/letsencrypt/live/shibboleth-ourserver.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/shibboleth-ourserver.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
Our shibboleth2.xml looks like follows:
<SPConfig xmlns="urn:mace:shibboleth:3.0:native:sp:config"
xmlns:conf="urn:mace:shibboleth:3.0:native:sp:config"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui"
clockSkew="180">
<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="https://ourwebapp.net">
<Path name="SShTestApp" authType="shibboleth" requireSession="true" applicationId="SShTestApp"/>
</Host>
<!-- Example of a second vhost mapped to a different applicationId. -->
<!--
<Host name="admin.example.org" applicationId="admin" authType="shibboleth" requireSession="true"/>
-->
</RequestMap>
</RequestMapper>
<!-- The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined. -->
<!-- <ApplicationDefaults id="default" policyId="default" entityID="https://onlineportalmedizinischefakultaet.azurewebsites.net/" -->
<ApplicationDefaults id="default" policyId="default" entityID="https://shibboleth-ourserver.com/shibboleth"
homeURL="https://shibboleth-ourserver.com"
REMOTE_USER="eppn subject-id pairwise-id persistent-id"
cipherSuites="DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1">
<!--
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="https://login-test.rz.rwth-aachen.de/shibboleth">
SAML2
</SSO>
<!-- SAML and local-only logout. -->
<Logout>SAML2 Local</Logout>
<!-- Administrative logout. -->
<LogoutInitiator type="Admin" Location="/Logout/Admin" acl="127.0.0.1 ::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="127.0.0.1 ::1"/>
<!-- Session diagnostic service. -->
<Handler type="Session" Location="/Session" showAttributeValues="true"/>
<!-- JSON feed of discovery information. -->
<Handler type="DiscoveryFeed" Location="/DiscoFeed"/>
</Sessions>
<!--
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"
helpLocation="/about.html"
styleSheet="/shibboleth-sp/main.css"/>
<!-- 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"
url="http://federation.org/federation-metadata.xml"
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"
attributeName="http://macedir.org/entity-category"
attributeNameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
attributeValue="http://refeds.org/category/hide-from-discovery" />
</MetadataProvider>
-->
<!-- Example of remotely supplied "on-demand" signed metadata. -->
<!--
<MetadataProvider type="MDQ" validate="true" cacheDirectory="mdq"
baseUrl="http://mdq.federation.org" ignoreTransport="true">
<MetadataFilter type="RequireValidUntil" maxValidityInterval="2419200"/>
<MetadataFilter type="Signature" certificate="mdqsigner.pem" />
</MetadataProvider>
-->
<!-- RWTH Aachen Metadaten -->
<MetadataProvider type="XML" url="https://sso-test.rwth-aachen.de/metadata/rwth.metadata.xml" backingFilePath="/etc/shibboleth/rwth.metadata.xml" reloadInterval="7200">
<MetadataFilter type="Signature" certificate="/etc/shibboleth/sso-test.pem"/>
</MetadataProvider>
<!-- 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="https://ourwebapp.net/LogIn">
<Sessions lifetime="28800" timeout="3600"
handlerURL="/LogIn/EditUser" handlerSSL="true"
cookieProps="https">
<SessionInitiator type="Chaining" Location="/Login" isDefault="true"
relayState="cookie" entityID="https://login.rz.rwth-aachen.de/shibboleth">
<SessionInitiator type="SAML2" acsIndex="1" template="bindingTemplate.html"/>
<SessionInitiator type="Shib1" acsIndex="5" />
</SessionInitiator>
</Sessions>
</ApplicationOverride>
</ApplicationDefaults>
<!-- 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"/>
</SPConfig>
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.
Greetings,
Thomas Stopinski
Medizinische Fakultät
Studiendekanat
RWTH Aachen University
Forckenbeckstraße 71
52057 Aachen
Tel.: Dipl.-Ing. (FH) Thomas Stopinski
Dekanat ...
Dienstort
Gebäude CT², Etage 6, Raum 05
Forckenbeckstraße 71
52074 Aachen
Telefon: +49 241 80 89498
Email: thstopinski at ukaachen.dewww.medizin.rwth-aachen.de
Büro: CT² Center for Teaching and Training, Etage 6, Raum 6.06
More information about the users
mailing list