So a Sitecore site I’ve been working on recently underwent a penetration test, which turned up an interesting item. The ASP.NET_SessionId and SC_ANALYTICS_GLOBAL_COOKIE cookies aren’t set with the ‘Secure’ flag. Further, my own checking showed that the .ASPXAUTH token was also set without the ‘Secure’ flag.
As the entire site is only served over HTTPS, this seems to be a bit remiss.
Fortunately, there are a couple of easy fixes to this that can be set in the Web.config
<httpCookies> set requireSSL:
<httpCookies requireSSL="true" />
<forms> set requireSSL too.
<forms name=".ASPXAUTH" cookieless="UseCookies" requireSSL="true" />
This latter one is needed for the .ASPXAUTH cookie, but that seems to do it.
Don’t forget to set the HTTPOnly flag as appropriate for your cookies too!
2 thoughts on “Secure your Sitecore Cookies”
[…] Securing your Sitecore cookies for HTTPS Only – https://andrewwburns.com/2016/10/21/secure-your-sitecore-cookies/ […]
Also, this article might be of interest: https://briancaos.wordpress.com/2017/03/17/sitecore-how-to-configure-ssl-https-in-your-sitecore-config-files/