Skip to content

Reject cross-origin requests in processCreate and processGet#125

Open
ScottHelme wants to merge 1 commit intolbuchs:masterfrom
ScottHelme:reject-cross-origin
Open

Reject cross-origin requests in processCreate and processGet#125
ScottHelme wants to merge 1 commit intolbuchs:masterfrom
ScottHelme:reject-cross-origin

Conversation

@ScottHelme
Copy link
Copy Markdown

Per the proposed 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.

Currently the library does not check this field at all, which means a cross-origin iframe embedding a legitimate site's WebAuthn ceremony would succeed.

This adds a check in both processCreate() and processGet(), after the existing origin validation:

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

The check 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.

Fixes #124

Per the proposed Level 3 spec (§7.1 Step 10, §7.2 Step 13), reject
ceremonies where clientDataJSON.crossOrigin is true. This prevents
an attacker from embedding a legitimate site's WebAuthn ceremony in
a cross-origin iframe on a malicious domain.

The check is backwards-compatible: crossOrigin is optional in the
spec, so clients that don't send it are unaffected.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crossOrigin field in clientDataJSON not validated

1 participant