Skip to content

Add WebAuthn (PRF Extension) Support for Data Encryption/Decryption in Browser Vault #4

Description

@davidloiret

Summary:
Implement an optional feature in Hoddor that utilizes the WebAuthn PRF extension to derive encryption keys from FIDO2 Security Keys and biometric authenticators (such as Apple's Touch ID and Face ID). This enhancement will provide users with a hardware-backed and biometric method for encrypting and decrypting their vault data, complementing the existing password-based approach.

Background & Motivation:

  • WebAuthn PRF Extension: The WebAuthn Level 3 specification introduces the PRF (Pseudo-Random Function) extension, allowing authenticators to produce high-entropy outputs during authentication ceremonies. These outputs can be leveraged as key material for cryptographic operations.

  • Biometric Authentication: Modern devices, including Apple's Touch ID and Face ID, as well as biometric security keys like the YubiKey Bio Series, support biometric authentication methods. These methods enhance security and user convenience by utilizing unique physiological traits for authentication.

  • Security Enhancement: Deriving encryption keys from an origin-bound WebAuthn credential, combined with biometric verification, enhances security by ensuring that only individuals with physical access to the registered security key or biometric trait can decrypt the vault data.

  • Browser Support: As of December 2024, the PRF extension is supported in Chromium-based browsers (e.g., Chrome, Edge) and Safari 18 and later. Firefox should also be supported but need to be confirmed https://bugzilla.mozilla.org/show_bug.cgi?id=1807856.

Proposed Changes:

  1. Integration of WebAuthn-Based Encryption Flow:

    • Registration Flow:

      • Invoke navigator.credentials.create() with the PRF extension to register a new credential.
      • Store the credential ID and associated metadata in the vault.
    • Encryption Flow:

      • Use navigator.credentials.get() with the PRF extension to retrieve high-entropy bytes.
      • Derive an encryption key using Argon2id with the retrieved bytes as input.
      • Encrypt user data using the derived key.
    • Decryption Flow:

      • Retrieve the PRF-derived key as in the encryption flow.
      • Decrypt data using the derived key.
    • Backward Compatibility:

      • Maintain existing password-based encryption methods to ensure users can choose their preferred method.
  2. Security Considerations:

    • Physical Security: Emphasize that access to the security key is required for decryption, enhancing protection against remote attackers.
    • Local Threats: Implement measures to mitigate risks from local threats, such as ensuring that derived keys are not exposed in memory longer than necessary.

Implementation Sketch:

  • WebAuthn Integration:

    • Extend the vault's authentication module to handle WebAuthn registration and authentication ceremonies, incorporating the PRF extension.
  • Feature Flag Implementation:

    • Introduce configuration options to enable or disable WebAuthn-based encryption, ensuring that the feature can be toggled without affecting existing functionality.

Benefits & Considerations:

  • Enhanced Security: Combining hardware-backed credentials with a robust key derivation function like Argon2id significantly strengthens the security of encrypted data.

  • User Convenience: Allows for a seamless "tap-to-unlock" experience, reducing reliance on passwords.

  • Browser Compatibility: While support for the PRF extension is growing, it's essential to handle cases where the user's browser or platform does not support the extension, gracefully falling back to password-based methods.

By implementing this feature, the Browser Vault will offer users a more secure and convenient method for encrypting and decrypting their data, leveraging the latest advancements in web authentication and cryptography.

Caveats:

While integrating WebAuthn with the PRF extension enhances security and user experience, several considerations should be taken into account:

  1. Limited Support Across Browsers and Authenticators:

    • Browser Compatibility: As of December 2024, support for the WebAuthn PRF extension varies across browsers. While Chromium-based browsers and Safari 18 have implemented this feature, others like Firefox may not yet support it. This inconsistency can affect the availability of the feature for some users.
    • Authenticator Support: Not all authenticators, currently support the PRF extension. This limitation may restrict the use of this feature on some devices.
  2. Security Implications:

    • Local Threats: Despite the enhanced security provided by hardware-backed keys and biometric authentication, vulnerabilities such as JavaScript injection attacks could potentially expose derived keys during their use in the browser. Implementing strict Content Security Policies (CSP) and minimizing the use of third-party scripts can help mitigate these risks.
    • Physical Security of Authenticators: The security of this system heavily relies on the physical security of the authenticators. Loss or theft of devices like security keys or biometric-enabled devices could pose a risk if not properly managed with recovery mechanisms.
  3. User Experience Challenges:

    • Complexity in Recovery Processes: Implementing robust account recovery mechanisms is essential to prevent user lockout in cases of device loss. However, these processes can introduce complexity and may require users to manage additional credentials or recovery codes, potentially affecting usability.
    • User Education: Users need to be adequately informed about the importance of registering multiple authenticators and securely storing recovery information. Lack of awareness can lead to situations where users are unable to access their data due to lost or unavailable authenticators.
  4. Standardization and Future Changes:

    • Evolving Specifications: The WebAuthn PRF extension is a relatively new addition to the Web Authentication specification. As the standard evolves, there may be changes that could impact the implementation and functionality of this feature. Staying informed about updates to the specification is crucial for maintaining compatibility and security.

Considering these caveats is essential for a successful implementation that balances security, performance, and user experience. Continuous monitoring of browser and authenticator support, along with user education and robust security practices, will help mitigate potential challenges associated with this integration.


Enhanced Security: WebAuthn + Password Hybrid Approach

While the proposed WebAuthn-based encryption flow offers significant security and usability improvements, combining it with password-based authentication can provide additional layers of security, enabling a more flexible and robust system. This hybrid approach allows users to tailor their security measures based on the sensitivity of the data they wish to protect.

  1. Four Levels of Security:

    • Level 1: Token-Based Authentication for Caching
      • For operations requiring temporary access or non-sensitive data, use tokens derived from Secure Single Sign-On (SSO) attributes or existing authentication methods.
      • Example: Caching of application data.
    • Level 2: Password-Only for Sensitive Data
      • Use Password alone + derivation for encrypting and decrypting sensitive data.
      • Example: Protecting financial records or health information.
    • Level 3: WebAuthn-Only for Sensitive Data
      • Use WebAuthn (with the PRF extension) alone + derivation for encrypting and decrypting sensitive data.
      • Example: Protecting financial records or health information.
    • Level 4: WebAuthn + Password for Extreme Sensitive Data
      • Use WebAuthn (with the PRF extension) + password + derivation for encrypting and decrypting sensitive data.
      • Example: Health information.
  2. User Workflow Enhancements:

    • Password Strengthening:
      • Ensure passwords are combined with WebAuthn PRF-derived keys using a robust key derivation function (Argon2id).
    • Flexible Authentication Policies:
      • Allow users to configure the required security level for different vault sections or operations.
      • Example: Enforcing Level 3 for Vault 1 but Level 2 for Vault 2 or enforcing Level 3 for export.
  3. Recovery Mechanisms:

    • Redundant Authenticators ?:
  4. Usability Considerations:

    • For routine operations, use WebAuthn credentials for a fast, passwordless experience.
    • For extremely sensitive operations, prompt users for both WebAuthn authentication and their password to ensure robust protection.

Conclusion

By integrating the WebAuthn PRF extension with optional password authentication, Hoddor Vaults will provide a versatile and highly secure platform for data encryption and access control. The proposed hybrid model offers a balanced approach to user convenience, security, and flexibility, ensuring that both individual and organizational needs are met effectively.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions