CVE-2021-22573: Incorrect signature verification on Google-oauth-java-client

Published May 3, 2022
·
Updated

Summary The vulnerability impacts only users of the IdTokenVerifier class. The verify method in IdTokenVerifier does not validate the signature before verifying the claims (e.g., iss, aud, etc.). Signature verification makes sure that the token's payload comes from valid provider, not from someone else.

An attacker can provide a compromised token with modified payload like email or phone number. The token will pass the validation by the library. Once verified, modified payload can be used by the application.

If the application sends verified IdToken to other service as is like for auth - the risk is low, because the backend of the service is expected to check the signature and fail the request.

Reporter: Tamjid al Rahat, contributor

Patches The issue was fixed in the 1.33.3 version of the library

Proof of Concept To reproduce, one needs to call the verify function with an IdToken instance that contains a malformed signature to successfully bypass the checks inside the verify function.

/ A default http transport factory for testing / static class DefaultHttpTransportFactory implements HttpTransportFactory { public HttpTransport create() { return new NetHttpTransport(); } }

// The below token has some modified bits in the signature private static final String SERVICEACCOUNTRS256TOKENBADSIGNATURE = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjJlZjc3YjM4YTFiMDM3MDQ4NzA0MzkxNmFjYmYyN2Q3NG" + "VkZDA4YjEiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJodHRwczovL2V4YW1wbGUuY29tL2F1ZGllbm" + "NlIiwiZXhwIjoxNTg3NjMwNTQzLCJpYXQiOjE1ODc2MjY5NDMsImlzcyI6InNvbWUgaXNzdWVy" + "Iiwic3ViIjoic29tZSBzdWJqZWN0In0.gGOQW0qQgs4jGUmCsgRV83RqsJLaEy89-ZOG6p1u0Y26" + "FyY06b6Odgd7xXLsSTiiSnch62dl0Lfi9D0x2ByxvsGOCbovmBl2ZZ0zHr1wpc4N0XS9lMUq5RJ" + "QbonDibxXG4nC2zroDfvD0h7i-L8KMXeJb9pYwW7LkmrMYwYfJnWnZ4bpcsDjojmPeUBlACg7tjjOgBFby" + "QZvUtaERJwSRlaWibvNjof7eCVfZChE0PwBpZccGqSqKXv544L4ttqdCnm0NjqrTATXwC4gYx" + "ruevkjHfYI5ojcQmXoWDJJ0-jzfyPE4MFFdCFgzLgnfIOwe5ve0MtquKuv2O0pgvg";

IdTokenVerifier tokenVerifier = new IdTokenVerifier.Builder() .setClock(clock) .setCertificatesLocation("https://www.googleapis.com/robot/v1/metadata/x509/integration-tests%40chingor-test.iam.gserviceaccount.com") .setHttpTransportFactory(new DefaultHttpTransportFactory()) .build();

// verification will return true despite modified signature for versions <1.33.3 tokenVerifier.verify(IdToken.parse(GsonFactory.getDefaultInstance(), SERVICEACCOUNTRS256TOKENBADSIGNATURE));

Remediation and Mitigation Update to the version 1.33.3 or higher

If the library used indirectly or cannot be updated for any reason you can use similar IdToken verifiers provided by Google that already has signature verification. For example: google-auth-library-java google-api-java-client

Timeline Date reported: 12 Dec 2021 Date fixed: 13 Apr 2022 Date disclosed: 2 May 2022

For more information If you have any questions or comments about this advisory: Open an issue in the google-oauth-java-client repo

Other sources

A flaw was found in Google OAuth Java client's IDToken verifier, where it does not verify if the token is properly signed. This issue could allow an attacker to provide a compromised token with a custom payload that will pass the validation on the client side, allowing access to information outside of their prescribed permissions.

The vulnerability is that IDToken verifier does not verify if token is properly signed. Signature verification makes sure that the token's payload comes from valid provider, not from someone else. An attacker can provide a compromised token with custom payload. The token will pass the validation on the client side. We recommend upgrading to version 1.33.3 or above

Affected Software

3 affected componentsFixes available
redhat/google-oauth-java-client<1.33.3
1.33.3
maven/com.google.oauth-client:google-oauth-client>=1.16.0-rc<1.33.3
1.33.3
Google Oauth Client Library For Java<1.33.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade maven/com.google.oauth-client:google-oauth-client to a version that resolves this vulnerability.

    Fixed in 1.33.3
  2. Upgrade

    Upgrade redhat/google-oauth-java-client to a version that resolves this vulnerability.

    Fixed in 1.33.3
  3. Upgrade

    Upgrade google-oauth-java-client (IdTokenVerifier / GoogleIdTokenVerifier) to a version that resolves this vulnerability.

    Fixed in 1.33.3

Event History

May 3, 2022
CVE Published
12:00 AM
Data Sourced
12:00 AM
RemedyDescriptionSeverityWeaknessAffected Software
CVE Published
via MITRE·03:45 PM
Data Sourced
via MITRE·03:45 PM
DescriptionSeverityWeakness
May 4, 2022
Data Sourced
via Red Hat·10:31 PM
DescriptionSeverityAffected Software
Apr 9, 2024
Advisory Published
via GitHub·03:11 PM

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is the vulnerability ID of this flaw?

The vulnerability ID of this flaw is CVE-2021-22573.

2

What is the severity of CVE-2021-22573?

The severity of CVE-2021-22573 is high with a CVSS score of 7.3.

3

What is the affected software of CVE-2021-22573?

The affected software of CVE-2021-22573 is Google OAuth Java client version up to 1.33.3.

4

How does the vulnerability manifest?

The vulnerability manifests as the IDToken verifier in Google OAuth Java client not verifying if a token is properly signed.

5

What can an attacker do with this vulnerability?

An attacker can provide a compromised token with a custom payload, which will pass the validation and potentially lead to unauthorized access or other malicious activities.

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.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203