XSS Is Deadly for Passkeys: The Hidden Risk of Attestation None
When a relying party sets attestation to none, malicious JavaScript running on the page can generate its own key pair and register an attacker-controlled passkey against the victim's account without any user interaction. The attacker then holds a persistent authentication backdoor, and by hooking the WebAuthn API they can also substitute their own key during a legitimate registration so the victim's saved passkey never works.
scotthelme.co.uk
Published on scotthelme.co.uk
A single XSS vulnerability can turn passkeys from a phishing-resistant login mechanism into a persistent account takeover backdoor. If malicious JavaScript can run on your page, it may be able to register an attacker-controlled passkey against the victim’s account.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the relying party requests attestation of none and does not require a fresh step-up authentication before registration, so the registration finish endpoint accepts any client-generated public key without proof it came from a genuine authenticator.
Impact
An attacker with script execution could silently add a persistent passkey backdoor to the victim's account, or substitute their key during a legitimate registration so the victim's passkey never works; a strong Content Security Policy and step-up authentication before registration limit this.
What the attacker needed
Script execution on the target page; attestation set to none; no step-up auth before registration
The fix
Registration should require step-up authentication such as the current password or another second factor, and a strong Content Security Policy plus Permissions Policy should restrict where the WebAuthn APIs can be called.
How it was found
- Load the page that begins the passkey registration flow and fetch the registration options from the relying party.
- Instead of calling the WebAuthn create API, generate a new key pair in JavaScript.
- Build the registration payload using the generated public key, with no attestation data.
- Send the payload to the registration finish endpoint, which stores the attacker's public key against the victim's account.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A passkey is a login credential where a private key stays on your device and the website only stores the matching public key. Normally your device creates that key pair, but if a website does not ask the device to prove it is genuine hardware (a check called attestation), a script on the page can make its own key pair instead. The site then stores the attacker's public key, so the attacker can log in as you later, and you would see nothing happen.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.