Skip to Content

Sign-up verification can no longer be used to bypass login 2FA or change roles

Shipped 2026-10-20

What was wrong

members_passcode held one code per member, shared by login 2FA, sign-up verification and profile verification. The sign-up verification endpoints are unauthenticated (the mobile app calls them during sign-up) and took the member from member_id in the request body. Sign-up send also took the delivery address from the body.

So anyone could request a code for any member, have it sent to their own address, and use it in that member’s login, bypassing email 2FA for anyone holding the password. Sign-up verify also ran role_id = 6 on whichever member the body named, so any active account, staff included, could be demoted to Flyer.

This was found by reading the code. Nothing suggests it was used.

What changed

Sign-up only acts on a new account. Both endpoints refuse any member that isn’t Pending (role 4) with an unverified email. The code always goes to the address the account was created with, and the role update only matches role_id = 4, so it can only promote Pending to Flyer.

Passcodes are scoped by purpose (migration 0019). A member has at most one row per purpose:

PurposeUsed by
authLogin 2FA, account recovery
verifySign-up and profile contact verification

Each flow generates and validates only its own row, so a verification code is never a valid login code. The bounce marker and last_login stay on the auth row, and the member and login queries join only that row.

Verifying an address no longer skips 2FA. A successful code used to set last_login, which skips 2FA for the next 8 hours. Only an auth code does that now.

Deploy and rollback

The migration runs pre-deploy. It’s compatible with the old code still serving during the deploy: purpose defaults to auth, and no verify row exists until the new code writes one.

Rolling the code back after deploy needs one step first: the old joins aren’t purpose-scoped, so any verify row would duplicate that member in the member and login queries. Run DELETE FROM members_passcode WHERE purpose = 'verify' before reverting. Those rows are short-lived codes, so nothing of value is lost.

Still to do

The sign-up endpoints still name the member by member_id. Binding them to a sign-up token needs a mobile app release, tracked in TMA-84.

Last updated on