CVE-2026-142551: CVE-2026-142551: Cross-Client Authentication Bypass via Missing Audience Validation in Vapor JWTKit
CVE-2026-142551: Cross-Client Authentication Bypass via Missing Audience Validation in Vapor JWTKit Vulnerability ID: CVE-2026-142551 CVSS Score: 8.1 Published: 2026-12-02 Vapor JWTKit versions 4.0.0 prior to 5.8.0
CVE-2026-142551: Cross-Client Authentication Bypass via Missing Audience Validation in Vapor JWTKit
Vulnerability ID: CVE-2026-142551
CVSS Score: 8.1
Published: 2026-12-02
Vapor JWTKit versions 4.0.0 prior to 5.8.0 fail to validate the audience (aud) claim in built-in vendor identity token payload types for Apple, Google, and Microsoft. This improper authentication flaw allows an attacker to obtain a legitimately signed ID token for a third-party client application and replay it against a relying party application using JWTKit, resulting in cross-client authentication bypass and account takeover.
TL;DR
Vapor JWTKit prior to 5.8.0 verifies cryptographic signatures, issuer claims, and expiration timestamps for Apple, Google, and Microsoft identity tokens, but omits audience (aud) validation by default. Attackers can replay valid identity tokens issued for arbitrary third-party OAuth/OIDC clients to authenticate to vulnerable applications.
⚠️ Exploit Status: POC
Technical Details
- CVE ID: CVE-2026-142551 (GHSA-gxx9-vxm7-hgrq)
- CWE Classification: CWE-287 (Improper Authentication) / CWE-345
- CVSS v3.1 Score: 8.1 High (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N)
- Attack Vector: Network (Cross-Client OIDC ID Token Replay)
- Affected Component: Vapor JWTKit (AppleIdentityToken, GoogleIdentityToken, MicrosoftIdentityToken)
- Affected Versions: >= 4.0.0, < 5.8.0
- Patched Versions: vapor/jwt-kit 5.8.0, vapor/jwt 5.2.0
- Exploit & KEV Status: PoC Published / Not in CISA KEV
Affected Systems
- vapor/jwt-kit
- vapor/jwt
-
jwt-kit: >= 4.0.0, < 5.8.0 (Fixed in:
5.8.0) -
jwt: < 5.2.0 (Fixed in:
5.2.0)
Code Analysis
Commit: a155109
Introduce JWTIdentityToken protocol and require expectedAudience validation for vendor identity tokens
public protocol JWTIdentityToken: JWTPayload {
var audience: AudienceClaim { get }
}
struct JWTIdentityTokenValidation: Sendable {
let expectedAudiences: Set<String>
let trustedAdditionalAudiences: Set<String>
let trustedAuthorizedPresenters: Set<String>?
func validate(_ token: any JWTIdentityToken) throws {
guard !self.expectedAudiences.isEmpty, !self.expectedAudiences.contains("") else {
throw JWTError.generic(identifier: "Audience", reason: "Expected audience must not be empty")
}
guard token.audience.value.contains(where: self.expectedAudiences.contains) else {
throw JWTError.claimVerificationFailure(
failedClaim: token.audience,
reason: "Token was not issued for an expected audience"
)
}
let allowedAudiences = self.trustedAdditionalAudiences.union(self.expectedAudiences)
guard token.audience.value.allSatisfy(allowedAudiences.contains) else {
throw JWTError.claimVerificationFailure(
failedClaim: token.audience,
reason: "Token includes an untrusted audience"
)
}
}
}
Exploit Details
- GitHub Security Advisory: Official Proof of Concept demonstrating acceptance of Apple, Google, and Microsoft identity tokens with foreign attacker-controlled audience claims.
Mitigation Strategies
- Enforce strict OpenID Connect audience (aud) claim validation on all incoming identity tokens against the relying party's configured client_id.
- Enforce authorized presenter (azp) claim validation when accepting Google identity tokens minted for mobile or web clients acting on behalf of a backend audience.
- Reject multi-audience JWTs that include any untrusted or unrecognized audience identifiers alongside the expected client ID.
- Treat compiler deprecation warnings on security verification APIs as build errors in CI/CD pipelines to prevent usage of unvalidated overloads.
Remediation Steps:
- Upgrade github.com/vapor/jwt-kit to version 5.8.0 or later in Package.swift.
- If using the Vapor framework wrapper github.com/vapor/jwt, upgrade to version 5.2.0 or later.
- Refactor all JWTKeyCollection.verify(_:as:) and req.jwt.verify(as:) calls for AppleIdentityToken, GoogleIdentityToken, MicrosoftIdentityToken, and FirebaseAuthIdentityToken to use the new expectedAudience or expectedAudiences parameter.
- For Google OAuth deployments utilizing separate client IDs for mobile apps and backend servers, provide the mobile client IDs via the trustedAuthorizedPresenters parameter.
- For legacy deployments on JWTKit 4.x that cannot immediately upgrade, manually invoke try token.audience.verifyIntendedAudience(includes: expectedClientID) immediately after verify().
References
- GitHub Security Advisory GHSA-gxx9-vxm7-hgrq
- National Vulnerability Database (NVD) - CVE-2026-142551
- CVE.org Record - CVE-2026-142551
- Official Fix Commit a1551090db2a3bd86f0482622e2d201c199e75ad
- Official Fix Patch Diff
- Vapor JWTKit Release 5.8.0
- Vapor JWTKit GitHub Repository
- OpenID Connect Core 1.0 Specification - Section 3.1.3.7 ID Token Validation
Read the full report for CVE-2026-142551 on our website for more details including interactive diagrams and full exploit analysis.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.