[JIRA] (IDP-1885) Use constant time algorithm for comparing CSRF tokens

Philip Smart (Jira) jira at shibboleth.atlassian.net
Fri Dec 3 10:39:11 UTC 2021


Philip Smart ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=5afecdc1eb3ffa0c596652c4 ) *created* an issue

Identity Provider ( https://shibboleth.atlassian.net/browse/IDP?atlOrigin=eyJpIjoiN2E1MWM3NTk1MjkwNDFlM2FlOTU4NTM2MGY2MzI0MzYiLCJwIjoiaiJ9 ) / Improvement ( https://shibboleth.atlassian.net/browse/IDP-1885?atlOrigin=eyJpIjoiN2E1MWM3NTk1MjkwNDFlM2FlOTU4NTM2MGY2MzI0MzYiLCJwIjoiaiJ9 ) IDP-1885 ( https://shibboleth.atlassian.net/browse/IDP-1885?atlOrigin=eyJpIjoiN2E1MWM3NTk1MjkwNDFlM2FlOTU4NTM2MGY2MzI0MzYiLCJwIjoiaiJ9 ) Use constant time algorithm for comparing CSRF tokens ( https://shibboleth.atlassian.net/browse/IDP-1885?atlOrigin=eyJpIjoiN2E1MWM3NTk1MjkwNDFlM2FlOTU4NTM2MGY2MzI0MzYiLCJwIjoiaiJ9 )

Issue Type: Improvement Affects Versions: 4.1.4 Assignee: Brent Putman ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A97de0981-adc3-4044-95ed-131622fad81e ) Components: Security and Cryptography Created: 03/Dec/21 5:39 AM Priority: Trivial Reporter: Philip Smart ( https://shibboleth.atlassian.net/secure/ViewProfile.jspa?accountId=5afecdc1eb3ffa0c596652c4 )

I recently noticed Spring moved (early 20201) their CSRF token matching algorithm from a simple string comparison to one which uses a constant-time algorithm - the help prevent timing attacks.

The IdP uses an injectable validation predicate to compare the tokens, but the default predicate uses a simple string comparison.

We could update the default to a constant-time algorithm. That said, I can not see this is of high importance, my understanding is this becomes an issue if the CSRF token is fixed for a period of time (Spring's default is one token per session) and the attacker attempts different tokens and times how long the response takes: longer times suggest more values are correct in the token. We generate new tokens per view-state, a failed attempt should change the view-state and hence change the token. I will check this, but I guess it would not be hard to change the default if we wanted to.

( https://shibboleth.atlassian.net/browse/IDP-1885#add-comment?atlOrigin=eyJpIjoiN2E1MWM3NTk1MjkwNDFlM2FlOTU4NTM2MGY2MzI0MzYiLCJwIjoiaiJ9 ) Add Comment ( https://shibboleth.atlassian.net/browse/IDP-1885#add-comment?atlOrigin=eyJpIjoiN2E1MWM3NTk1MjkwNDFlM2FlOTU4NTM2MGY2MzI0MzYiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100183- sha1:844c6ad )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/commits/attachments/20211203/0102fb95/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-comment-icon-7534281d-90c3-4bdf-8dd1-deff0cc17d91
Type: image/png
Size: 1084 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20211203/0102fb95/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-avatar-f09798e9-23a5-4dcb-9dd5-0340ddfd23f8
Type: image/png
Size: 457 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20211203/0102fb95/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-trivial-c9d5fe2b-2d41-4012-ae2c-f3466e9e511a
Type: image/png
Size: 563 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20211203/0102fb95/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jira-generated-image-static-footer-desktop-logo-0c8967fc-ceb2-4261-a9ba-b44a3c6cce34
Type: image/png
Size: 10805 bytes
Desc: not available
URL: <http://shibboleth.net/pipermail/commits/attachments/20211203/0102fb95/attachment-0007.png>


More information about the commits mailing list