Bug found: HS512 is used to sign OIDC JWT access token if OidcRegisteredService.idTokenSigningAlg is set

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug found: HS512 is used to sign OIDC JWT access token if OidcRegisteredService.idTokenSigningAlg is set

leeyc0
I am testing OIDC with ES256 to sign JWT. But I found that if I configured OidcRegisteredService.idTokenSigningAlg to use ES256, the access token is signed with HS512 using cas.authn.oauth.accessToken.crypto.signing.key instead. (The ID token is signed with ES256 as expected.) This causes access key introspection to fail.

If I removed OidcRegisteredService.idTokenSigningAlg, access token is signed with RS512 and ID token is signed with RS256. In this case access key introspection works as intended.

I am not sure how to fix this bug, so I am posting here for suggestion.

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-dev/c6385698-9be3-4594-83f5-bee3648af2a8%40apereo.org.
Reply | Threaded
Open this post in threaded view
|

Re: Bug found: HS512 is used to sign OIDC JWT access token if OidcRegisteredService.idTokenSigningAlg is set

leeyc0
I think I found the bug. core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/cipher/AbstractCipherExecutor.java and core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java simply do not support elliptic curve. What a shame...

leeyc0於 2020年5月1日星期五 UTC+8下午6時15分27秒寫道:
I am testing OIDC with ES256 to sign JWT. But I found that if I configured OidcRegisteredService.idTokenSigningAlg to use ES256, the access token is signed with HS512 using cas.authn.oauth.accessToken.crypto.signing.key instead. (The ID token is signed with ES256 as expected.) This causes access key introspection to fail.

If I removed OidcRegisteredService.idTokenSigningAlg, access token is signed with RS512 and ID token is signed with RS256. In this case access key introspection works as intended.

I am not sure how to fix this bug, so I am posting here for suggestion.

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-dev/fed170fa-7355-41a8-81c9-c8dc5661439f%40apereo.org.
Reply | Threaded
Open this post in threaded view
|

Re: Bug found: HS512 is used to sign OIDC JWT access token if OidcRegisteredService.idTokenSigningAlg is set

leeyc0
Just realized that this is only part of the reason, still do not explain how the key cas.authn.oauth.accessToken is injected.
crypto.signing.key


leeyc0於 2020年5月1日星期五 UTC+8下午6時26分04秒寫道:
I think I found the bug. core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/cipher/AbstractCipherExecutor.java and core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java simply do not support elliptic curve. What a shame...

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-dev/1c748519-ede1-4269-afc4-ce4acc76c5a9%40apereo.org.
Reply | Threaded
Open this post in threaded view
|

Re: Bug found: HS512 is used to sign OIDC JWT access token if OidcRegisteredService.idTokenSigningAlg is set

leeyc0
In reply to this post by leeyc0
Just realized that this is only part of the reason, still do not explain how the key cas.authn.oauth.accessToken.crypto.signing.key is injected.


leeyc0於 2020年5月1日星期五 UTC+8下午6時26分04秒寫道:
I think I found the bug. core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/cipher/AbstractCipherExecutor.java and core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java simply do not support elliptic curve. What a shame...

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-dev/d8301759-270c-4fcf-9872-2348f00dc23e%40apereo.org.
Reply | Threaded
Open this post in threaded view
|

Re: Bug found: HS512 is used to sign OIDC JWT access token if OidcRegisteredService.idTokenSigningAlg is set

leeyc0
In reply to this post by leeyc0
I have fixed AbstractCipherExecutor and EncodingUtils to support ECDSA. But now I am facing another problem.

Oauth2 access token is generated twice, first in OAuth20JwtAccessTokenEncoder and the second OidcIdTokenGeneratorService, and the second output is used to calculate at_hash in OIDC id_token
OidcIdTokenGeneratorService. Now the problem is for ECDSA, a noune is required to generates a signature. Therefore, even for identical input,
signature output is difference every time.

Therefore, to support ECDSA, the access token in OidcIdTokenGeneratorService must NOT be re-generated, but rather taken from the output of OAuth20JwtAccessTokenEncoder, otherwise at_hash would be broken. I really need help now, since the code flow seems do not support such operation.

--
You received this message because you are subscribed to the Google Groups "CAS Developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-dev/330de288-e840-4d51-9438-312e0ddf993a%40apereo.org.