← Graph

Devise pitfalls and way to tighten security

talk 27 connections

Rafał Rothenberger's wroclove.rb 2022 talk about security edge cases in Devise. Covers: (1) bcrypt background — salt vs. pepper, and how bcrypt is a password-hashing function with a fixed 72-byte input that null-terminates C strings, meaning '72 A's' and '72 A's + X' produce the same hash; (2) how Devise's 128-char password length default plus appending a pepper at the end allows attackers to leak the pepper byte-by-byte by registering with 72-N-char passwords and brute-forcing the remaining pepper bytes via a simple login form; (3) fixes — switch to Argon2id (2015 PHC winner, ~4 GB input limit, native salt+pepper support, OWASP-recommended), enforce a 72-byte limit in Devise, or preprocess passwords with HMAC-SHA256 (never plain SHA, to avoid password-shucking) being careful about null bytes and 72-byte truncation after base64 encoding, or encrypt with AES (Dropbox-style, allows pepper rotation); (4) API authentication with devise_token_auth — opaque tokens, works alongside Devise views, now uses a standard Authorization header (released 10 September); (5) refresh tokens stored in HttpOnly, Secure, SameSite=Strict cookies to prevent JS leakage and MITM over HTTP, including Rails cookie syntax, refresh flow, CORS with credentials: true, and Ionic quirks; (6) tokens are passwords — hash them in the DB, set expiry, limit quantity; (7) enumeration attacks on registration, password-reset, confirmation and login forms — prevent by using neutral messages and moving the existence-check to a background Sidekiq job so responses take constant time, defeating timing-based enumeration; (8) rate-limit login forms by email (with an IP fallback to prevent lockout-based DoS). Q&A: using Auth0 vs. Devise, and why the speaker is talking publicly before upstreaming (emailed Devise 3 months ago, no reply; breaking security APIs is costly for users who only update packages).

type
talk
talk Devise pitfalls and way to tighten security
about
Devise tool
Entire talk documents security pitfalls in Devise.
talk Devise pitfalls and way to tighten security
about
bcrypt tool
Discusses bcrypt's 72-byte input limit and how Devise misuses it.
talk Devise pitfalls and way to tighten security
about
Argon2 tool
Recommends Argon2id as the modern replacement for bcrypt.
talk Devise pitfalls and way to tighten security
about
Recommended solution for API token authentication alongside Devise.
talk Devise pitfalls and way to tighten security
about
Salt concept
Background section explains salt in password hashing.
talk Devise pitfalls and way to tighten security
about
Pepper concept
Central to the Devise/bcrypt pepper-leak issue.
talk Devise pitfalls and way to tighten security
about
HMAC concept
Suggests HMAC-SHA256 as preprocessing when stuck with bcrypt plus pepper.
talk Devise pitfalls and way to tighten security
about
Explains why HMAC, not plain SHA, must be used to preprocess passwords.
talk Devise pitfalls and way to tighten security
about
Dedicated section on enumeration attacks on registration/reset/login forms.
talk Devise pitfalls and way to tighten security
about
Section on how timing leaks account existence even with neutralized messages.
talk Devise pitfalls and way to tighten security
about
Section argues for refresh tokens in HttpOnly Secure SameSite cookies.
talk Devise pitfalls and way to tighten security
about
AES tool
Mentions encrypting passwords with AES (Dropbox-style) as pepper-rotation alternative.
talk Devise pitfalls and way to tighten security
about
OWASP resource
Cites OWASP cheat sheets as a recommendation source for password hashing.
talk Devise pitfalls and way to tighten security
about
Sidekiq tool
Recommends moving existence checks into Sidekiq jobs to prevent timing enumeration.
talk Devise pitfalls and way to tighten security
about
Jokingly invokes Galileo's unit of time when introducing timing attacks.
asked_at
Devise pitfalls and way to tighten security talk
Asked during Q&A after the talk.
asked_at
Devise pitfalls and way to tighten security talk
Asked during Q&A.
authored
Devise pitfalls and way to tighten security talk
Delivered this talk at wroclove.rb 2022.
from_talk
Devise pitfalls and way to tighten security talk
Primary remediation recommended in the talk.
from_talk
Devise pitfalls and way to tighten security talk
Alternative mitigation for teams staying on bcrypt.
from_talk
Devise pitfalls and way to tighten security talk
Stated as a rule: tokens are passwords.
from_talk
Devise pitfalls and way to tighten security talk
Recommendation for API authentication.
from_talk
Devise pitfalls and way to tighten security talk
Central recommendation of the refresh-token section.
from_talk
Devise pitfalls and way to tighten security talk
Core mitigation for timing-based enumeration.
from_talk
Devise pitfalls and way to tighten security talk
Recommendation for login forms where async check isn't feasible.
talk Devise pitfalls and way to tighten security
presented_at
Talk delivered at wroclove.rb 2022.
related_to
Devise pitfalls and way to tighten security talk
Donarski cites Rafał Rothenberger's 2022 Devise disclosure as the model for how tea tasters would handle negative reviews responsibly.

Provenance

Created
2026-04-17 16:17 seed
Read by
17 extractions