Summary
Rocket.Chat's Apple Sign-In handler validates JWT signatures but fails to enforce critical claims such as audience, expiry, and nonce.
As a result, any Apple-signed token with a non-empty issuer can be replayed to authenticate as a victim user whenever an attacker can obtain that user's Apple identity token.
Affected context
This vulnerability occurs in Rocket.Chat deployments that offer "Sign in with Apple" as an authentication option.
The risk arises when the application trusts Apple-signed JWTs solely on the basis of a valid signature and non-empty issuer, without validating time-bound and audience-related claims.
It is most relevant where Apple identity tokens can be accessed outside the Rocket.Chat instance, such as shared developer team integrations, logging systems, or intercepted sign-in flows.
Exploit preconditions
- Attack surface: Public Rocket.Chat login endpoint using Apple Sign-In.
- Required access: Ability to obtain a valid Apple identity token for the target user (e.g., from logs, another app using the same Apple developer team, or interception of an Apple sign-in flow).
- Trigger point: Submission of a previously issued Apple JWT to the Rocket.Chat Apple Sign-In endpoint.
- Why exploitation is possible: The handler verifies the cryptographic signature but does not enforce claims like
aud,exp,nbf, ornonce, allowing indefinite replay of any token with a non-empty issuer.
Why this happens
The underlying bug is insufficient validation of authentication tokens, mapping to CWE-287 (Improper Authentication) and CWE-294 (Authentication Bypass by Capture-Replay).
While the Apple JWT signature is correctly checked, the implementation treats a signed token as inherently trustworthy and does not enforce semantic constraints on its claims.
By skipping validation of audience, expiration, not-before, and nonce, the system fails to bind the token to a specific application, time window, and sign-in transaction, breaking the core assumptions of token-based authentication.
Potential impact
- An attacker may log in as the victim user by replaying a captured Apple identity token.
- Attackers could gain persistent access to user accounts with no effective expiry on the replay window.
- Compromised accounts can lead to exposure of private chats, files, and workspace configuration.
- Attackers could perform actions as the victim, such as sending messages, modifying channels, or exfiltrating data.
General mitigation guidance
Effective mitigation focuses on enforcing full JWT claim validation for external identity providers.
Implementations should confirm that tokens are:
- Issued for the correct audience / client identifier.
- Within a valid time window honoring
expandnbf. - Tied to a fresh, single-use nonce to prevent replay.
Systems can also reduce trust in external tokens by limiting token reuse, tightening logging hygiene around identity tokens, and adopting defense-in-depth controls such as step-up verification for sensitive operations.
How teams detect issues like this
Detection typically relies on reviewing authentication code paths to ensure that:
- JWT validation logic covers both signature checks and all relevant claims.
- Nonce values are generated, tracked, and invalidated after use.
- Audit logs record unusual sign-in patterns, such as repeated Apple sign-ins for a user from unexpected locations using identical token identifiers.
Static analysis and security-focused code review can flag authentication flows that treat signed tokens as fully trustworthy without claim checks, while policy-based CI checks can enforce use of standard, well-reviewed token validation libraries.

