Repository navigation
Description
π Reproduction steps
- Create a user with a verified email and enable MFA (
mfa: true, an authenticator added). - Log in with email and password only:
POST /v1/account/sessions/emailβ session withfactors: ["password"]. - With this session,
GET /v1/accountandGETa row readable only byuser:<id>. - Open
wss://<host>/v1/realtime?project=<id>with the same session cookie and subscribe to a table channel and toaccount. - Create a row with
read("user:<id>")(e.g. with an API key).
π Expected behavior
Realtime rejects the session the same way the HTTP API does (user_more_factors_required) until the second factor is completed. No user data and no events are delivered.
π Actual Behavior
| Step | Response |
|---|---|
GET /v1/account |
401 user_more_factors_required (correct) |
GET row with read(user:<id>) |
401 (correct) |
| Realtime connect | accepted; the connected message contains the complete user document (email, targets, prefs, mfa, β¦) |
Subscribe to table channel and account |
accepted |
Row created with read(user:<id>) |
event with the full row data delivered to this connection |
Two runs, on both realtime nodes, identical. Someone who knows the password but not the second factor can read live everything the account can read through realtime: rows, file metadata, account, team and membership events. MFA is not enforced for realtime at all.
Cause: the HTTP API checks the factors in app/controllers/shared/api.php L545βL564. app/realtime.php resolves the user and roles from the session on connect and in the authentication message handler, but never looks at mfa, the user's verified factors or session.factors. The password-reset check that comes before it in shared/api.php is missing too (from the code, not measured). 2.3.0 behaves the same.
π² Appwrite version
2.4.0 (also 2.3.0)
π» Operating system
Linux (Debian 12), Docker
π§± Your Environment
Self-hosted Appwrite 2.4.0, two API nodes, two realtime nodes.
π‘ Suggested fix
Apply the same factor check (and the password-reset check) in realtime on connect, on the authentication message and whenever roles are recomputed; reject with user_more_factors_required.
π Have you spent some time to check if this issue has been raised before?
- I checked and didn't find a similar issue
π’ Have you read the Code of Conduct?
- I have read the Code of Conduct
Related: #14415 (plaintext secret in server-side token/session events) makes this worse. If a backend creates tokens or sessions for the user through the server API, those secrets reach the account channel in clear text, which turns this read bypass into a full account takeover.
Activity
[-]Realtime accepts sessions that have not completed MFA (MFA bypass for realtime reads)[/-][+]π Bug Report: Realtime accepts sessions that have not completed MFA[/+]sundeep8967 commentedon Oct 31, 2026
Verified on current
main: this issue has already been resolved by commit30105a7(#15134).Specifically:
app/realtime.php, MFA factors are checked during connection establishment andException::USER_MORE_FACTORS_REQUIREDis thrown if the user has MFA enabled and the session has not completed the required factors.src/Appwrite/Realtime/Message/Handlers/Authentication.php, theauthenticationmessage handler also validates MFA factors and throwsException::USER_MORE_FACTORS_REQUIREDwhen necessary.This can be closed.
HarshMN2345 commentedon Nov 4, 2026
Fixed in #14803, thanks for reporting it!