Skip to content

crossOrigin field in clientDataJSON not validated #124

Open

Description

@ScottHelme

Problem

The library does not check the crossOrigin field in clientDataJSON during either processCreate() or processGet().

Per the proposed W3C WebAuthn Level 3 spec (§7.1 Step 10 for registration, §7.2 Step 13 for authentication), if clientDataJSON.crossOrigin is true, the ceremony should be rejected unless the Relying Party has explicitly opted into cross-origin behaviour.

Attack scenario

An attacker hosts evil-example.com which embeds the legitimate site's WebAuthn ceremony in a cross-origin iframe. The browser sets crossOrigin: true in clientDataJSON to signal this, but because the library doesn't check it, the ceremony succeeds. This could allow an attacker to trick a user into registering or authenticating a passkey from a context they didn't intend.

Suggested fix

Add a check in both processCreate() and processGet(), after the existing origin validation, that rejects requests where crossOrigin is explicitly true:

if (\property_exists($clientData, 'crossOrigin') && $clientData->crossOrigin === true) {
    throw new WebAuthnException('cross-origin request not allowed', WebAuthnException::INVALID_ORIGIN);
}

This is backwards-compatible — crossOrigin is optional in the spec, so existing clients that don't send it are unaffected. Only explicitly cross-origin requests are rejected.

Activity

  1. added a commit that references this issue on Mar 27, 2026
    0c537e0
  2. ScottHelme commented on May 20, 2026

    @ScottHelme
    Author

    Just a heads-up for anyone landing here: we've published a security-focused fork of this library as report-uri/passkeys-php

    It already includes this fix, along with several other hardening changes. Huge thanks to @lbuchs for the original work!

    This PR is still very much open for upstream consideration, but the fork is available in the meantime for anyone who needs the change today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions