A critical authentication bypass vulnerability exists in the Nextcloud TwoFactor WebAuthn app that allows attackers to overwrite other users' WebAuthn credentials. The PublicKeyCredentialEntityMapper::insertOrUpdate() method searches for existing credentials using only the public_key_credential_id without validating the user_handle, enabling cross-user credential hijacking.
Steps To Reproduce:
- Setup victim account (Alice):
- User "alice" registers a WebAuthn device
- System stores credential with public_key_credential_id = "ABC123"
- Alice can successfully authenticate using her WebAuthn device
- Attacker exploitation:
- Attacker obtains or guesses Alice's public_key_credential_id (e.g., "ABC123")
- Attacker registers their own WebAuthn device using the same credential ID
- The insertOrUpdate() method finds Alice's record (line 139-142 in PublicKeyCredentialEntityMapper.php)
- System overwrites Alice's credential data with attacker's WebAuthn device
- Attack completion:
- Attacker can now login to Alice's account using Alice's username/password + attacker's WebAuthn device
- Alice can no longer login with her legitimate WebAuthn device
- No notification is sent to Alice about the credential change
- File: lib/Db/PublicKeyCredentialEntityMapper.php
- Lines 111-123: findPublicKeyCredential() - missing user_handle validation
- Lines 138-146: insertOrUpdate() - allows cross-user overwritesThe findPublicKeyCredential() method only searches by public_key_credential_id:$qb->select('*') ->from('twofactor_webauthn_regs') ->where($qb->expr()->eq('public_key_credential_id', $qb->createNamedParameter($publicKeyCredentialId))); // Missing: ->andWhere($qb->expr()->eq('user_handle', $user_handle))
- Root Cause:
- WebAuthn specification requires user verification for credential management
- Similar pattern in findById() correctly validates user_handle (lines 94-98)
- Call chain: WebauthnPublicKeyCredentialSourceRepository::saveCredentialSource() → insertOrUpdate()
Impact
Complete 2FA Bypass & Account Takeover
- Authentication Bypass: Attacker gains full access to victim's account using victim's password + attacker's WebAuthn device
- Credential Hijacking: Victim's legitimate WebAuthn device becomes unusable
- Stealth Attack: No notifications sent to victim about credential changes
- Persistent Access: Attacker maintains access until victim manually re-registers WebAuthn
- Data Exposure: Full access to victim's files, emails, and sensitive data in Nextcloud
- This vulnerability completely undermines the security purpose of WebAuthn 2FA and enables account takeover attacks against any user with WebAuthn enabled.
'0-day' 카테고리의 다른 글
| CVE-2026-27966 (langflow / cvss 9.8) (0) | 2026.02.28 |
|---|---|
| CVE-2026-28227(discourse / cvss 5.1) (0) | 2026.02.28 |
| CVE-2026-22922(airflow / cvss 6.5) (1) | 2026.02.25 |
| CVE-2026-21721(grafana / cvss 8.1) (1) | 2026.01.31 |
| CVE-2025-66514(Nextcloud Mail / cvss 5.4) (0) | 2025.12.27 |