This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: webauthn-device-bound-passkey-escalation-boundary

Hardware-Attested Device-Bound Passkey Enforcement for Step-Up Authorization

Enforces cryptographic isolation between multi-device cloud-synced passkeys and high-risk step-up authorization flows. Mandates verification of WebAuthn Level 3 authenticator data flags (Backup Eligibility and Backup State) and hardware-backed Secure Enclave attestation before authorizing privileged operations such as wire transfers and administrative role escalations.

Prohibited Anti-Pattern: Permitting Multi-Device Synced Passkeys to Sign High-Risk Step-Up Actions Without Hardware Boundary Attestation

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Hardware-Attested Device-Bound Passkey Enforcement for Step-Up Authorization - Enforces cryptographic isolation between multi-device cloud-synced passkeys and high-risk step-up authorization flows. Mandates verification of WebAuthn Level 3 authenticator data flags (Backup Eligibility and Backup State) and hardware-backed Secure Enclave attestation before authorizing privileged operations such as wire transfers and administrative role escalations.
globs: src/auth/**/*.{ts,tsx}, src/services/security/**/*.{ts,tsx}, src/api/v1/transactions/**/*.{ts,tsx}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/webauthn-device-bound-passkey-escalation-boundary"
---

# Hardware-Attested Device-Bound Passkey Enforcement for Step-Up Authorization

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Permitting Multi-Device Synced Passkeys to Sign High-Risk Step-Up Actions Without Hardware Boundary Attestation

## System Constraints
You are a Principal Security Architect enforcing zero-trust WebAuthn boundaries. You must reject any authorization logic that treats multi-device synced credentials as equivalent to hardware-bound credentials for privileged transactions. Mandate strict inspection of authenticator data flags (BE/BS) and hardware attestation verification.

## Strict Guidelines
- Engineers MUST ALWAYS verify authenticator data bit flags (BE = Backup Eligibility, BS = Backup State) during step-up assertion verification, enforcing BE === 0 and BS === 0 for privileged operations.
- Engineers MUST NOT allow multi-device synced credentials (e.g., iCloud Keychain or Google Password Manager passkeys) to satisfy step-up authorization for critical or financial transactions.
- Code SHOULD inspect the Authenticator Attestation GUID (AAGUID) against an enterprise allowlist or the FIDO Alliance Metadata Service (MDS) to ensure credentials reside in a certified hardware Secure Enclave or TPM.
- Services MUST enforce 'userVerification: required' and reject any WebAuthn response where the User Verified (UV) flag (bit 2) is not explicitly set in the authData buffer.
- Components NEVER store or trust client-side claims regarding device-bound status; validation MUST occur exclusively on the server against the cryptographically signed authData buffer.

## Bad vs Good Implementations
### WebAuthn Step-Up Authorization Assertion Verification

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The implementation verifies only signature validity and replay counters. It fails to inspect the authenticator data flags (BE and BS) or attestations, allowing any multi-device synced passkey synced across untrusted end-user devices to authorize high-risk transactions.
```typescript
import { verifyAuthenticationResponse } from '@simplewebauthn/server';

interface StepUpPayload {
  response: any;
  expectedChallenge: string;
  credentialPublicKey: Uint8Array;
  counter: number;
}

export async function verifyStepUpAuthorization(payload: StepUpPayload) {
  const verification = await verifyAuthenticationResponse({
    response: payload.response,
    expectedChallenge: payload.expectedChallenge,
    expectedOrigin: 'https://bank.example.com',
    expectedRPID: 'bank.example.com',
    credential: {
      id: payload.response.id,
      publicKey: payload.credentialPublicKey,
      counter: payload.counter,
    },
  });

  // VULNERABILITY: Blindly trusts the signature without inspecting backup flags
  // Synced passkeys (iCloud/Google) can sign financial wire transfers
  if (!verification.verified) {
    throw new Error('Verification failed');
  }

  return { authorized: true };
}
```

#### Production Standard (Correct)
> **Standard**: The implementation enforces the escalation boundary by parsing byte 32 of authData, guaranteeing user verification (UV=1), and rejecting any credential with Backup Eligibility (BE=1) or Backup State (BS=1). It optionally checks the AAGUID against an approved hardware baseline.
```typescript
import { verifyAuthenticationResponse } from '@simplewebauthn/server';

interface StepUpPayload {
  response: any;
  expectedChallenge: string;
  credentialPublicKey: Uint8Array;
  counter: number;
  allowedHardwareAaguids: Set<string>;
}

export async function verifyStepUpAuthorization(payload: StepUpPayload) {
  const verification = await verifyAuthenticationResponse({
    response: payload.response,
    expectedChallenge: payload.expectedChallenge,
    expectedOrigin: 'https://bank.example.com',
    expectedRPID: 'bank.example.com',
    credential: {
      id: payload.response.id,
      publicKey: payload.credentialPublicKey,
      counter: payload.counter,
    },
    requireUserVerification: true,
  });

  if (!verification.verified || !verification.authenticationInfo) {
    throw new Error('Cryptographic signature verification failed');
  }

  const { authData } = verification.authenticationInfo;
  // Extract flags from the 33rd byte (index 32) of WebAuthn authData buffer
  const flags = authData[32];
  const userVerified = (flags & 0x04) !== 0; // Bit 2: UV
  const backupEligible = (flags & 0x08) !== 0; // Bit 3: BE
  const backedUp = (flags & 0x10) !== 0; // Bit 4: BS

  if (!userVerified) {
    throw new Error('Biometric/Hardware User Verification required');
  }

  // STRICT INVARIANT: Privileged boundary rejects cloud-synced passkeys
  if (backupEligible || backedUp) {
    throw new Error('Cloud-synced passkey prohibited. Hardware-bound credential required.');
  }

  const aaguid = verification.authenticationInfo.aaguid;
  if (aaguid && !payload.allowedHardwareAaguids.has(aaguid)) {
    throw new Error('Authenticator hardware model not permitted for step-up escalation.');
  }

  return { authorized: true, credentialId: payload.response.id };
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Hardware-Attested Device-Bound Passkey Enforcement for Step-Up Authorization

Hardware-Attested Device-Bound Passkey Enforcement for Step-Up Authorization defines an industrial-grade behavioral standard for security engineering. Enforces cryptographic isolation between multi-device cloud-synced passkeys and high-risk step-up authorization flows. Mandates verification of WebAuthn Level 3 authenticator data flags (Backup Eligibility and Backup State) and hardware-backed Secure Enclave attestation before authorizing privileged operations such as wire transfers and administrative role escalations. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Permitting Multi-Device Synced Passkeys to Sign High-Risk Step-Up Actions Without Hardware Boundary Attestation Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftPermitting Multi-Device Synced Passkeys to Sign High-Risk Step-Up Actions Without Hardware Boundary AttestationCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS verify authenticator data bit flags (BE = Backup Eligibility, BS = Backup State) during step-up assertion verification, enforcing BE === 0 and BS === 0 for privileged operations.

Engineers MUST ALWAYS verify authenticator data bit flags (BE = Backup Eligibility, BS = Backup State) during step-up assertion verification, enforcing BE === 0 and BS === 0 for privileged operations.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT allow multi-device synced credentials (e.g., iCloud Keychain or Google Password Manager passkeys) to satisfy step-up authorization for critical or financial transactions.

Engineers MUST NOT allow multi-device synced credentials (e.g., iCloud Keychain or Google Password Manager passkeys) to satisfy step-up authorization for critical or financial transactions.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Code SHOULD inspect the Authenticator Attestation GUID (AAGUID) against an enterprise allowlist or the FIDO Alliance Metadata Service (MDS) to ensure credentials reside in a certified hardware Secure Enclave or TPM.

Code SHOULD inspect the Authenticator Attestation GUID (AAGUID) against an enterprise allowlist or the FIDO Alliance Metadata Service (MDS) to ensure credentials reside in a certified hardware Secure Enclave or TPM.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Services MUST enforce 'userVerification

Services MUST enforce 'userVerification: required' and reject any WebAuthn response where the User Verified (UV) flag (bit 2) is not explicitly set in the authData buffer.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Components NEVER store or trust client-side claims regarding device-bound status

Components NEVER store or trust client-side claims regarding device-bound status; validation MUST occur exclusively on the server against the cryptographically signed authData buffer.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Hardware-Attested Device-Bound Passkey Enforcement for Step-Up Authorization critical for AI coding assistants?

Enforces cryptographic isolation between multi-device cloud-synced passkeys and high-risk step-up authorization flows. Mandates verification of WebAuthn Level 3 authenticator data flags (Backup Eligibility and Backup State) and hardware-backed Secure Enclave attestation before authorizing privileged operations such as wire transfers and administrative role escalations. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Permitting Multi-Device Synced Passkeys to Sign High-Risk Step-Up Actions Without Hardware Boundary Attestation) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Hardware-Attested