CWE
284
Advisory Published
CVE Published
Updated

CVE-2023-36820: micronaut security has invalid IdTokenClaimsValidator logic on aud

First published: Thu Oct 05 2023(Updated: )

### Summary IdTokenClaimsValidator skips `aud` claim validation if token is issued by same identity issuer/provider. ### Details See https://github.com/micronaut-projects/micronaut-security/blob/master/security-oauth2/src/main/java/io/micronaut/security/oauth2/client/IdTokenClaimsValidator.java#L202 This logic violates point 3 of https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation. Workaround exists by setting `micronaut.security.token.jwt.claims-validators.audience` with valid values. `micronaut.security.token.jwt.claims-validators.openid-idtoken` can be kept as default on. ### PoC Should probably be: ```java return issuer.equalsIgnoreCase(iss) && audiences.contains(clientId) && validateAzp(claims, clientId, audiences); ``` ### Impact Any OIDC setup using Micronaut where multiple OIDC applications exists for the same issuer but token auth are not meant to be shared. ### Mitigation Please upgrade to a patched `micronaut-security-oauth2` release as soon as possible. If you cannot upgrade, for example, if you are still using Micronaut Framework 2, you can patch your application by creating a replacement of `IdTokenClaimsValidatorReplacement` ```java package cve; import io.micronaut.context.annotation.Replaces; import io.micronaut.context.annotation.Requires; import io.micronaut.core.annotation.NonNull; import io.micronaut.core.util.StringUtils; import io.micronaut.security.config.SecurityConfigurationProperties; import io.micronaut.security.oauth2.client.IdTokenClaimsValidator; import io.micronaut.security.oauth2.configuration.OauthClientConfiguration; import io.micronaut.security.oauth2.configuration.OpenIdClientConfiguration; import io.micronaut.security.token.jwt.generator.claims.JwtClaims; import io.micronaut.security.token.jwt.validator.JwtClaimsValidatorConfigurationProperties; import javax.inject.Singleton; import java.net.URL; import java.util.Collection; import java.util.List; import java.util.Optional; @Requires(property = SecurityConfigurationProperties.PREFIX + ".authentication", value = "idtoken") @Requires(property = JwtClaimsValidatorConfigurationProperties.PREFIX + ".openid-idtoken", notEquals = StringUtils.FALSE) @Singleton @Replaces(IdTokenClaimsValidator.class) public class IdTokenClaimsValidatorReplacement extends IdTokenClaimsValidator { public IdTokenClaimsValidatorReplacement(Collection<OauthClientConfiguration> oauthClientConfigurations) { super(oauthClientConfigurations); } @Override protected boolean validateIssuerAudienceAndAzp(@NonNull JwtClaims claims, @NonNull String iss, @NonNull List<String> audiences, @NonNull String clientId, @NonNull OpenIdClientConfiguration openIdClientConfiguration) { if (openIdClientConfiguration.getIssuer().isPresent()) { Optional<URL> issuerOptional = openIdClientConfiguration.getIssuer(); if (issuerOptional.isPresent()) { String issuer = issuerOptional.get().toString(); return issuer.equalsIgnoreCase(iss) && audiences.contains(clientId) && validateAzp(claims, clientId, audiences); } } return false; } } ``

Credit: security-advisories@github.com security-advisories@github.com security-advisories@github.com

Affected SoftwareAffected VersionHow to fix
Objectcomputing Micronaut Security<3.1.2
Objectcomputing Micronaut Security>=3.2.0<3.2.4
Objectcomputing Micronaut Security>=3.4.0<3.4.3
Objectcomputing Micronaut Security>=3.5.0<3.5.3
Objectcomputing Micronaut Security>=3.6.0<3.6.6
Objectcomputing Micronaut Security>=3.7.0<3.7.4
Objectcomputing Micronaut Security>=3.8.0<3.8.4
Objectcomputing Micronaut Security>=3.9.0<3.9.6
Objectcomputing Micronaut Security>=3.10.0<3.10.2
Objectcomputing Micronaut Security=3.11.0

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Frequently Asked Questions

  • What is CVE-2023-36820?

    CVE-2023-36820 is a vulnerability in the IdTokenClaimsValidator component of Micronaut Security OAuth2, which skips the 'aud' claim validation if the token is issued by the same identity issuer/provider.

  • What is the severity of CVE-2023-36820?

    CVE-2023-36820 has a severity rating of 4.8 (medium).

  • How does CVE-2023-36820 affect Micronaut Security OAuth2?

    CVE-2023-36820 affects Micronaut Security OAuth2 by allowing tokens issued by the same identity issuer/provider to bypass the 'aud' claim validation.

  • How can I fix CVE-2023-36820?

    To fix CVE-2023-36820, update your Micronaut Security OAuth2 package to version 3.1.2 or later.

  • Where can I find more information about CVE-2023-36820?

    You can find more information about CVE-2023-36820 at the following references: - [GitHub Advisory](https://github.com/micronaut-projects/micronaut-security/security/advisories/GHSA-qw22-8w9r-864h) - [GitHub Commit](https://github.com/micronaut-projects/micronaut-security/commit/9728b925221a0d87798ccf250657a3c214b7e980) - [GitHub Source Code](https://github.com/micronaut-projects/micronaut-security/blob/master/security-oauth2/src/main/java/io/micronaut/security/oauth2/client/IdTokenClaimsValidator.java#L202)

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2024 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203