Skip to content

Independent cybersecurity briefing

Latest

RSS
Breaches, bounties, zero-days, and AI.

Bug Bounty Write Ups

Sign in with Apple JWT Bug: Account Takeover Case

Sign in with Apple issued a signed login token from an email address alone. Apps that trusted the signature could open the wrong account. Reported in 2020.

Adam Hale, ZeroDay Times editorBy Adam Hale3 min read

Still life for “Sign in with Apple JWT Bug: Account Takeover Case”: a magnifier and a sealed envelope, walnut desk, Apple mark, signal CASE. [ BUG BOUNTY ] badge.

Sign in with Apple JWT Bug: Any Email, Any Account

AI-generated illustration

How a $100,000 bug bounty finding let an identity provider sign tokens for email addresses nobody had proven they owned

AI-assisted: drafted with AI help from public sources, then reviewed and edited. This is an analytical case study of a public disclosure, not my own discovery.

An email address was the only thing an attacker needed. In April 2020, Bhavuk Jain found a Sign in with Apple JWT bug that made Apple’s servers hand out validly signed identity tokens for whatever email was asked for. Any third-party app that trusted those tokens without extra checks was open to full account takeover, and Apple paid $100,000 for the report.

Disclaimer: * Educational and defensive use only. Apple fixed this in 2020. Endpoints, request bodies and reproduction details are intentionally omitted.*

Vulnerability Overview

  • Type: Authentication bypass at the identity provider: identity token issued for an unverified, caller-chosen email claim
  • CWE (analytical mapping, not from the source): CWE-287 (Improper Authentication), CWE-639 (Authorization Bypass Through User-Controlled Key)
  • CVE: Not reported
  • Severity/CVSS: Not reported. Bounty: $100,000 (Apple Security Bounty), source-reported

How the Sign in with Apple JWT Bug Worked (high level)

Sign in with Apple behaves much like OpenID Connect. The user authenticates with Apple, chooses whether to share their real address or a private relay address, and Apple returns a signed JWT. The relying app checks the signature against Apple’s public keys and logs in whoever the email claim names.

The flaw sat in the step where Apple minted that token. According to the researcher, the email that ended up in the JWT could be supplied by the requester, and Apple did not confirm it belonged to the person who had just signed in. The token was genuine: correct issuer, correct signature, and a claim saying the email was verified. Only the identity inside it was wrong.

That is what makes this case uncomfortable. Every app that “validated the JWT properly” still accepted it, because the lie came from the trusted signer itself.

Impact

Jain wrote that the bug could lead to full takeover of accounts on third-party apps using Sign in with Apple, even if the victim had no Apple ID, as long as the app had no additional safeguards. He named large adopters such as Dropbox, Spotify and Airbnb as examples of integrators, while noting they were not tested. Apple reviewed its logs and found no misuse or account compromise.

Defending Against Sign in with Apple JWT Abuse (my own analysis)

1. Key accounts on the stable subject, not the email. Link a social login to iss + sub. Treat email as a mutable contact attribute.

2. Never auto-merge on email alone. If a federated email matches an existing password account, require the user to prove control of that account before linking.

3. Validate every claim you depend on. Check aud, exp, nonce and issuer, and bind the nonce to the browser session that started the login.

4. Plan for a compromised provider. Alert on new federated links and offer step-up checks for sensitive actions.

# Pseudocode: federated login keyed on (issuer, subject)
def federated_login(id_token, session):
    claims = verify_jwt(id_token, keys=apple_jwks(),
                        issuer=APPLE_ISS, audience=MY_CLIENT_ID)
    if claims.nonce != session.pop("login_nonce"):
        raise AuthFailed("nonce mismatch")
    link = links.find(issuer=claims.iss, subject=claims.sub)
    if link:
        return create_session(link.user)
    existing = users.find_by_email(claims.email)
    if existing:                       # do not merge silently
        return require_proof_of_existing_account(existing, claims)
    return create_session(users.create_federated(claims.iss, claims.sub,
                                                 contact_email=claims.email))

Key Takeaways

  • A valid signature proves who issued a token, not that its claims are true.
  • Identify federated users by issuer and subject; email-based account merging is a takeover path.
  • Build relying-party checks that still hold when the identity provider makes a mistake.

Credit & Sources

Research by Bhavuk Jain: Zero-day in Sign in with Apple (30 May 2020). Press context on the fix: Ars Technica, 1 June 2020. Facts come from those sources; analysis and code are original.

Next breakdown: the Facebook IDOR that could delete any photo album.

First published by Adam Hale on Medium.

Sources

Share

Corrections and tips:[email protected]