Skip to content

🐛 Bug Report: account.createRecovery / POST to /account/recovery allows user enumeration #13435

Closed

Description

@gertjankrol

👟 Reproduction steps

POST {appwrite instance}/account/recovery
X-Appwrite-Project: <project-id>
Content-Type: application/json

{"email":"[email protected]","url":"https://example.com/reset-password"}

vs.

POST {appwrite instance}/account/recovery
X-Appwrite-Project: <project-id>
Content-Type: application/json

{"email":"[email protected]","url":"https://example.com/reset-password"}

Both calls are unauthenticated, so anyone can send them directly against the endpoint.

👍 Expected behavior

The response should not reveal whether the email belongs to a registered account, since this is an endpoint deliberately reachable pre-authentication.

This is also Appwrite's own stated policy according to #7299, where it's confirmed createEmailSession deliberately returns a generic "Invalid credentials" error (rather than distinguishing "user does not exist" from "wrong password").
/account/recovery should therefore follow the same policy: a generic success-shaped response regardless of whether the account exists.

👎 Actual Behavior

  • Registered email: 201, with $id, $createdAt, userId, expire (and empty secret & phrase)
  • Unregistered email: 404, {"message":"User with the requested ID could not be found.","code":404,"type":"user_not_found"}

This allows enumeration of registered emails via an unauthenticated endpoint. Rate limiting is present (X-RateLimit-Limit: 10/hour, applied to both cases), which slows this down but doesn't close the underlying leak (it still leaks up to ~10 email addresses per hour per IP, more when distributed across multiple IPs, and IPv6 makes rotating IPs trivial).

Possible remediation: matching the status code alone is insufficient; the response body must be entirely indistinguishable.

  • For an unregistered email, the endpoint should still return a 201 status code and a response body that perfectly mirrors a successful request. This includes generating realistic, mock values for fields like $id, $createdAt, userId, and expire (secret and phrase can stay empty, matching what a genuine response returns), since the presence/absence of those fields would be just as much of a signal.
  • Ideally, response processing times for both existing and non-existing accounts should be roughly identical to prevent timing analysis, though that's a smaller concern than the response body itself

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

Linux

🧱 Your Environment

Server: Appwrite 1.9.6, self-hosted
Client: appwrite web SDK 25.2.0, reproduced against the raw REST endpoint directly with curl as well

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Activity

  1. added theissue type on Aug 31, 2026
  2. added
    product / auth
    product / messaging
    product / self-hosted
    on Aug 31, 2026
  3. naveen-cs50-cse commented on Sep 2, 2026

    @naveen-cs50-cse

    Hey team! I've been tracing this user enumeration vulnerability. The issue originates in app/controllers/api/account.php where it throws Exception::USER_NOT_FOUND instead of returning a mock 201 Created response to obscure the user's existence. I have the fix ready and tested locally on the Docker stack. Can you assign this to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    product / authproduct / messagingproduct / self-hosted

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions