CVE-2026-142551: JWTKit: Missing aud validation in Apple/Google/Microsoft identity tokens can enable cross-client authentication bypass

Published Dec 2, 2026
·
Updated

Summary

AppleIdentityToken, GoogleIdentityToken, and MicrosoftIdentityToken validate a signed ID token's issuer and expiry, but do not validate that the aud claim is intended for the current application.

This allows cross-client ID token reuse when an application relies on JWTKit's built-in vendor token verification as complete authentication. An attacker can obtain a legitimate Apple/Google/Microsoft ID token for an attacker-controlled OAuth/OIDC client and submit it to a different application using the same provider keys. JWTKit accepts the token even though its aud identifies the attacker's client, not the victim application.

The exact account-level impact depends on how the application maps provider identities, but the security boundary is already broken once a token issued for another relying party is accepted as a verified login token.

Details

JWTSigner.verify() verifies the JWS signature and then automatically calls the payload's verify(using:) method:

- Sources/JWTKit/JWTSigner.swift:33-39

swift guard try algorithm.verify(signature, signs: data) else { throw JWTError.signatureVerificationFailed }

let (, payload, ) = try parser.parse(token, as: Payload.self) try await payload.verify(using: algorithm)

For the vendor ID token payload types, verify(using:) does not check audience:

- Sources/JWTKit/Vendor/AppleIdentityToken.swift:85-90 checks only iss and exp - Sources/JWTKit/Vendor/GoogleIdentityToken.swift:139-148 checks only iss, sub length, and exp - Sources/JWTKit/Vendor/MicrosoftIdentityToken.swift:149-158 checks only tid/iss consistency and exp

The audience fields are decoded and documented as security-relevant, but are never enforced:

- Apple: audience is documented as the application's clientid - Google: audience is documented as one of the application's OAuth client IDs - Microsoft: audience is documented as the app's Application ID, with a comment saying: "Your app should validate this value, and reject the token if the value does not match."

This is also inconsistent with the existing Firebase vendor token implementation. FirebaseAuthIdentityToken.verify(using:) derives the Firebase project ID from audience and requires issuer == "https://securetoken.google.com/<projectId>" (Sources/JWTKit/Vendor/FirebaseAuthIdentityToken.swift:122-136). That shows JWTKit already treats audience binding as part of safe vendor-token verification for at least one provider.

OpenID Connect Core ID Token validation requires the relying party to validate that the aud claim contains its own clientid. A valid provider signature only proves that the provider issued the token for some client. It does not prove that the token was issued for this application.

PoC

This PoC uses a local HMAC key only to avoid needing live Apple/Google/Microsoft credentials. The cryptographic signature is not the vulnerable part; the relevant behavior is that after a valid signature, JWTKit's real verify(using:) implementation accepts tokens with attacker-controlled aud values. JWTSigner.verify() invokes payload.verify(using:) after signature verification regardless of which JWT algorithm verified the signature.

Create a temporary SwiftPM executable depending on the local jwt-kit checkout and run this code:

swift import JWTKit import Foundation

@main struct PoC { static func main() async throws { let keys = JWTKeyCollection() await keys.add(hmac: "secret", digestAlgorithm: .sha256)

let apple = AppleIdentityToken( issuer: "https://appleid.apple.com", audience: "com.attacker.app", expires: .init(value: Date().addingTimeInterval(3600)), issuedAt: .init(value: Date()), subject: "victim-apple-sub" ) let appleJWT = try await keys.sign(apple) = try await keys.verify(appleJWT, as: AppleIdentityToken.self) print("Apple token accepted with aud=com.attacker.app")

let wrongIssuer = AppleIdentityToken( issuer: "https://attacker.example", audience: "com.attacker.app", expires: .init(value: Date().addingTimeInterval(3600)), issuedAt: .init(value: Date()), subject: "victim-apple-sub" ) let wrongIssuerJWT = try await keys.sign(wrongIssuer) do { = try await keys.verify(wrongIssuerJWT, as: AppleIdentityToken.self) fatalError("Apple token with wrong issuer was unexpectedly accepted") } catch { print("Apple wrong-issuer control was rejected") }

let google = GoogleIdentityToken( issuer: "https://accounts.google.com", subject: "victim-google-sub", audience: "attacker-client.apps.googleusercontent.com", authorizedPresenter: "attacker-client.apps.googleusercontent.com", issuedAt: .init(value: Date()), expires: .init(value: Date().addingTimeInterval(3600)) ) let googleJWT = try await keys.sign(google) = try await keys.verify(googleJWT, as: GoogleIdentityToken.self) print("Google token accepted with attacker client audience")

let tenant = "11111111-2222-3333-4444-555555555555" let microsoft = MicrosoftIdentityToken( audience: "00000000-1111-2222-3333-444444444444", issuer: .init(value: "https://login.microsoftonline.com/\(tenant)/v2.0"), issuedAt: .init(value: Date()), identityProvider: nil, notBefore: .init(value: Date()), expires: .init(value: Date().addingTimeInterval(3600)), codeHash: nil, accessTokenHash: nil, preferredUsername: "victim@example.com", email: nil, name: nil, nonce: nil, objectId: "victim-object-id", roles: nil, subject: "victim-ms-sub", tenantId: .init(value: tenant), uniqueName: nil, version: "2.0" ) let microsoftJWT = try await keys.sign(microsoft) = try await keys.verify(microsoftJWT, as: MicrosoftIdentityToken.self) print("Microsoft token accepted with attacker app audience") } }

Expected result: all three wrong-audience verify calls succeed, while the wrong-issuer control is rejected. This shows that vendor claim verification is running, but audience validation is missing. If the aud claim were enforced against the current application's configured client ID, each wrong-audience token should be rejected.

In a real attack, the attacker does not forge provider signatures. They register their own OAuth/OIDC client, get the real provider to issue a valid ID token with aud set to that attacker client, then submit that token to a different application that uses JWTKit's vendor token type for login.

Impact

Applications are impacted if they use JWTKeyCollection.verify(..., as: AppleIdentityToken.self), GoogleIdentityToken.self, or MicrosoftIdentityToken.self as the authentication decision and do not perform a separate manual audience.verifyIntendedAudience(...) check.

For those applications, a token issued for the attacker's client can be accepted by the victim application as long as issuer, signature, and expiry are valid. Depending on the provider and the application's account-linking logic, this can become authentication bypass or account takeover. Applications that already perform their own explicit audience check are not vulnerable through this issue.

Suggested fix

The vendor token verification APIs need an expected audience from the caller. Possible fixes:

1. Add provider-specific verifier/configuration APIs that require the expected client ID/application ID and validate aud before returning a verified payload. 2. Add tests asserting that Apple, Google, and Microsoft tokens with a valid signature but wrong aud are rejected by the recommended verification path. 3. For Google/OIDC multi-audience tokens, also follow the azp validation rules when applicable.

At minimum, the safe path should make it difficult to receive an AppleIdentityToken, GoogleIdentityToken, or MicrosoftIdentityToken from JWTKit verification without binding it to the caller's configured audience.

Other sources

JWTKit is a Swift library for signing and verifying JSON Web Tokens. From 4.0.0 until 5.8.0, JWTSigner.verify() in Sources/JWTKit/JWTSigner.swift invokes payload verification after validating the JWS signature, but AppleIdentityToken, GoogleIdentityToken, and MicrosoftIdentityToken in Sources/JWTKit/Vendor/AppleIdentityToken.swift, Sources/JWTKit/Vendor/GoogleIdentityToken.swift, and Sources/JWTKit/Vendor/MicrosoftIdentityToken.swift do not validate the aud claim against the application's intended audience. An attacker can obtain a legitimate provider-issued ID token for an attacker-controlled OAuth or OIDC client and submit it to a different application using the same provider keys. If that application relies on the built-in verification as its authentication decision without a separate audience.verifyIntendedAudience(...) check, the token can be accepted despite being intended for another client. Depending on the application's identity mapping, the resulting cross-client token reuse can enable authentication bypass or account takeover. Applications that independently validate the intended audience are not affected through this issue. This issue is fixed in 5.8.0.

— MITRE

Affected Software

3 affected componentsFixes available
swift/JWTKit>=4.0.0<5.8.0
swift/github.com/vapor/jwt-kit>=4.0.0<=5.7.1
5.8.0
swift/github.com/vapor/jwt-kit>=4.0.0<5.8.0
5.8.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade swift/github.com/vapor/jwt-kit to a version that resolves this vulnerability.

    Fixed in 5.8.0
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 5.8.0

Event History

Dec 2, 2026
CVE Published
via MITRE·08:54 PM
Data Sourced
via MITRE·08:54 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:18 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·09:55 PM
Data Sourced
via GitHub·09:55 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·09:55 PM
Affected Software

Frequently Asked Questions

1

Which applications are actually exposed to this issue?

Applications using JWTKit versions from 4.0.0 through before 5.8.0 are exposed if they use the built-in Apple, Google, or Microsoft identity-token verification as an authentication decision and do not separately validate the token's intended audience. Applications that independently call audience.verifyIntendedAudience(...) are not affected through this issue.

2

What does an attacker need to exploit the vulnerability?

An attacker needs a legitimate ID token issued by Apple, Google, or Microsoft for an OAuth or OIDC client they control. They can submit that token to another application that uses the same provider keys but fails to check that the aud claim matches its own client audience.

3

What should be done if upgrading cannot happen immediately?

Validate every accepted Apple, Google, and Microsoft ID token's aud claim against the application's intended audience using a separate audience.verifyIntendedAudience(...) check. Do not treat successful signature and built-in payload verification alone as sufficient for authentication.

4

How can teams determine whether they are affected?

Review JWTKit usage for AppleIdentityToken, GoogleIdentityToken, or MicrosoftIdentityToken and determine whether authentication accepts tokens after JWTSigner.verify() without an independent intended-audience check. Deployments running 5.8.0 include the fix; versions from 4.0.0 through before 5.8.0 require this review.

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