Email verification binds another user's mailbox to the requesting account, unauthenticated
The email verification endpoint that commits a channel to 'verified' does not check which account owns the verification row, and the add endpoint only checks for an existing verified row before writing a pending one. An attacker could enrol a victim's email address, have the genuine verification mail sent to the victim, and when the victim clicks the link the address becomes verified on the attacker's account, blocking the owner from using it.
Originally disclosed on Immunefi
- Disclosed after under an hour
91925 w a low email verification binds another user s mailbox to the requesting account unauthenticated
Submitted on Sep 5th 2026 at 16:09:21 UTC by @ChaseTheLight for Audit Competition | ENS
- Report ID: #91925
- Report Type: Websites & Apps
- Report severity: Low
- Target: https://github.com/immunefi-team/audit-comp-ens/tree/audit-comp-ready/workers
- Impacts:
- Changing sensitive details of other users (including modifying browser local storage) without already-connected wallet interaction and with up to one click of user interaction, such as: Email
Description
Brief/Intro
The API worker states a one-account-per-address rule for notification email channels and enforces it in the wrong request. POST /notifications/channels/email is authenticated and, before writing anything, asks whether the address is already verified at all (workers/api-worker/src/app/routes/notifications/channels/email.ts:59-65) and, if the row it finds belongs to a different account (:67), refuses with "This email address is already linked to another account" (:67-72). The row it then writes is pending (:80). The state the rule governs is created later, by POST /notifications/channels/email/verify, which matches a token, loads the channel row and sets status = 'verified' (:195-201) without asking the question again. So the check runs against state that has not yet formed, and the commit runs without the check. Two things follow. An account can enrol an address it does not control, the worker mails the project's own verification message to the real owner, and the row that flips to verified on their click belongs to the requesting account. And two registered accounts can both reach verified for one address, since neither add is refused while both rows are pending.
The only ownership conditions on the address are that the caller has not already verified it themselves (email.ts:48-53) and that nobody else has (:59-72). The verification mail comes from [email protected] and carries a genuine https://app.ens.dev/... URL; the recipient's press of "Verify Email Address" is what commits the flip (:195-201), on the strength of the token alone. The handler consults no caller identity, and it cannot: the /verify route carries no auth middleware at all (:172-176), while the add handler, immediately preceding it in the same route chain (:29-33), does spread ...requireAuth (:31).
From that point the mailbox is bound, as verified, to an account its owner never chose. The verify hop itself sends the welcome mail to that mailbox from the project's sending domain (email.ts:209-215), and the owner is refused their own address for as long as that row stays verified (:59-72; see Impact).
Three drop-in test files built on the worker's own vitest harness drive the real Hono app the worker exports. They read and write through an in-memory stand-in that renders the drizzle predicate each handler actually passes and matches rows from that rendered SQL, so which rows a query selects is measured against production's own predicate rather than asserted. The delivered bytes were run on 2026-09-05 in a namespace holding no interface but loopback: eight of eight passed. Both fix patches were applied to the pinned snapshot and measured, the bind patch on both of its hunks. The stub's boundary and the counterfactuals are in the Proof of Concept field; reachability, the duplicate check, the fix and references are below.
Vulnerability Details
Root cause
The rule is enforced in the request that creates only a pending row, before the verified state it governs has formed, and the request that forms that state does not enforce it. Two facts follow from that placement; the observations after them record what the surrounding schema, middleware, configuration and client declare.
The add handler binds an address it never proves the caller owns. email.ts:29-33 requires auth and validates the body, then writes a user_channels row carrying user_id: userId and target: email (:75-97). Ownership of the mailbox is meant to be established later, by the verification round trip.
The verify handler never closes the loop. email.ts:179-201, read whole, is three predicates and one write (reflowed here; with and .set are multi-line in source):
const verification = await c.var.db.query.channelVerifications.findFirst({
where: and(
eq(TABLE.channelVerifications.token, token),
eq(TABLE.channelVerifications.purpose, 'verify'),
gt(TABLE.channelVerifications.expires_at, new Date()),
),
with: { channel: true },
})
if (!verification) {
return c.json({ error: 'Invalid or expired verification token' }, 400)
}
// Mark channel as verified
await c.var.db
.update(TABLE.userChannels)
.set({ status: 'verified', verified_at: new Date() })
.where(eq(TABLE.userChannels.id, verification.channel_id))
Token match, purpose, expiry. The handler loads one row plus its channel relation and consults no other row before flipping. It does not re-run the :59-72 cross-account query. It does not compare anything about the requester to verification.user_id, and it has no requester to compare: there is no ...requireAuth in the /verify handler's middleware chain (:172-176).
So the round trip proves that somebody who could read the mailbox pressed a button. The handler then treats that as proof that the account which requested the binding owns the mailbox. Those are different propositions.
The column that was meant to carry the missing fact is declared and never written. core/database/schema/notifications.ts:109:
target: text('target'), // email during email verification, null for Telegram until bot callback
There are exactly two inserts into channel_verifications in the worker, email.ts:105-114 and channels/$id.ts:191-200, and neither sets target. Two more columns on the same path are declared in the schema and never read or written by any code in workers/: channel_verifications.consumed_at (schema:117) and user_channels.verification_attempts (schema:71). Single use is enforced by deleting the row (email.ts:204-206) rather than by the consumed_at column that was declared for it; the attempt-counting design was declared and never built at all.
- Global middleware.
app/index.ts:14-40is the entire composition root; its only.use()iscors()at:15, with no origin list, and the rest of the chain is seven.route()mounts at:16-22and anonErrorhandler at:23-40. No auth, CSRF, rate or ownership middleware sits above the router.createApp(app/middleware/hono.ts:14-24) returns a barenew Hono(...). - Subtree middleware. Neither
routes/notifications/index.ts:29-32norchannels/index.ts:53-56calls.use()....requireAuthis spread per handler throughout the tree (notifications/index.ts:44,155,198,276,352;channels/index.ts:30;$id.ts:22,62,113,146), which is why the one state-changing handler that omits it has nothing above it to compensate. Seventeen handlers are registered underroutes/notifications/, and exactly two omit...requireAuth: this one, andpush.ts:44, aGET /vapid-public-keythat returnsc.env.VAPID_PUBLIC_KEYand writes nothing (:44-46). - Edge configuration. The checked-in
wrangler.jsoncdeclares no route restriction: noroutes,route,patternorcustom_domainentry appears in it. That is a fact about the configuration in this snapshot, not about the live edge, which this report does not observe. - The database. The only uniqueness the ORM declares on
user_channels, other than the surrogate primary key onid, isunique('user_channel_unique').on(table.user_id, table.channel, table.target)(schema:74-78), scoped per user. All five migration files were read; no partial unique index on(channel, target) WHERE status = 'verified'exists.
This is not a declared design. The verification page does branch on whether a session is present, but only to choose where its button navigates afterwards: apps/manager/src/routes/notifications/channels/email/verify.tsx:65 reads the session flag, :70-71 pick /notifications/settings or / and the matching label, and :232-238 render "Back to Settings" or "Back to Home". Nothing in that file or in email.ts states that a third party's click should bind an address to someone else's account; the one comment that touches the verify transition, email.ts:194, only labels the write, and the page itself says "This page can only verify your email when opened from the link in the verification email" (verify.tsx:106-107). The only end-to-end exercise of this flow the project ships, e2e/projects/manager/tests/notification.spec.ts:24-62, adds the address and follows the verification link inside the same signed-in session, so in that test the requester and the recipient are one person (it runs only with Mailinator credentials, notification.spec.ts:11-21, and e2e/ is cited as evidence of intent, not as an in-scope asset).
The same defect with no third party
The gap also breaks the rule between two registered accounts, with no outside mailbox involved, and that variant is worth stating separately because it shows the rule failing with no outside party at all.
The add handler's cross-account check selects on status = 'verified', with no term for the requesting account (email.ts:59-65). While two rows for one address are both pending, there is nothing for it to find, so neither add is refused. Both accounts receive a token, each valid for 24 hours (email.ts:112). Each redeems its own. /verify matches the token, loads the channel row, and sets verified on it (email.ts:195-201) without re-asking the question the add path asked. Two accounts now hold a verified row for one address, and nothing in storage objects: the only uniqueness on user_channels other than its surrogate key is per user, as set out in Root cause.
See "The exclusivity break, measured" in the Proof of Concept field.
Trigger and preconditions
Preconditions: one SIWE login, free. The victim's email address, the only thing the attacker must know. No ENS name, no funds, no privilege, no stake are needed to bind the address.
The six reproduction steps are the first thing in the Proof of Concept field.
What the victim sees at step 4: the sender, the domain, the link and the landing page are all genuine, and no surface in the flow names the account the binding lands on. The first sentence after the title line tells the recipient they signed up for the notifications, in both parts: "Thank you for signing up for ENS notifications!" (services/email/verification.ts:32 text/plain, :54 html). The line that would cut against it, "If you didn't request this email, you can safely ignore it" (:71-74; the plain-text copy is at :36) names no account either. Across the whole message the worker builds (verification.ts:19-86) and across all 247 lines of the landing page (verify.tsx), the requesting account is never named: not by address, not by user id. The recipient is asked to confirm a binding without being shown what it binds to.
Every precondition is either free to the attacker or supplied by the shipped configuration. The one that is not attacker-controlled is the victim's click.
- A bearer token is free.
POST /auth/logingates on a nonce round-trip and a valid SIWE signature over an allow-listed domain, and on nothing about the caller's identity or history;addUserIfNotExistsmints the user row on first sight (services/auth/index.ts:109). No name ownership, no allowlist on the caller's address (the only allowlist on that route is on the SIWEdomain,services/auth/index.ts:79-86), no funding requirement. Any freshly generated EOA becomes auser_id. - The route is live on the deployed worker. Unbroken chain from the entry point:
app/index.ts:19mountsnotificationsApp,routes/notifications/index.ts:31mountschannels,channels/index.ts:53mountsemailRoutes. No feature flag and no dev gate on this handler. The contrast is in the same tree:notifications/index.ts:362is dev-gated, so the codebase knows how to gate a route and did not gate this one. - The verify surface is reachable by a signed-out victim, on both halves. Client side, the boundary is a fact about the file tree: TanStack file-based routing parents a route by its directory,
routes/notifications/_authenticated/route.tsx:10is whereRequireBackendAuthis applied, andverify.tsxdoes not live under_authenticated/. The generated tree agrees:routeTree.gen.ts:523-529showsparentRoute: typeof rootRouteImport, not the authenticated route. Server side, the handler carries no auth middleware (email.ts:172-176), and the client sends the request without anAuthorizationheader rather than throwing when there is no session (apps/manager/src/utils/backend-client.ts:148-152). - The shipped configuration carries the values the repository deploys with.
wrangler.jsonc:98,100setEMAIL_FROM_ADDRESS: "[email protected]"andMANAGER_APP_URL: "https://app.ens.dev", so the victim sees a genuine link from a genuine sender (services/email/verification.ts:16). UnlikeSENDGRID_BROADCAST_LIST_ID(wrangler.jsonc:107, empty), this path depends on no empty variable.SENDGRID_API_KEYis declared as a Cloudflare secret rather than a var (.dev.vars.example:7; it does not appear inwrangler.jsonc), which is where a live deployment keeps it. Citing these values is not an impact on a configuration file: the impact is in application code and the config is only what makes it reachable. - Rate limiting does not bound it. Three sends per hour, keyed on the target address (
services/notifications/email-verification-rate-limit.ts:3-4,29-30). The attacker needs one. The same limit is the victim's quota, so a sprayer also burns the owner's ability to resend. - The click cannot be forged. The token is 16 CSPRNG bytes (
services/notifications/helpers.ts:173-177), so there is no brute-force route to a zero-interaction variant, and the add handler withholds the token from its own caller (email.ts:165-169), so the attacker cannot self-verify. CORS is open (app/index.ts:15,cors()with no origin list) but buys nothing here, because an attacker-hosted page still cannot post a token it does not possess.
Which victims the attack reaches, and why the guard does not cover them. The :59-72 guard makes the attack structurally impossible against a mailbox already verified to its owner, so at the moment of exploitation the victim has by construction no verified ENS record for that address. Three states:
| Victim state when the attacker sprays | Outcome |
|---|---|
| Address already verified by its owner | Attacker refused at :67 with 400. No attack. |
| Address pending on the owner's account | Attacker's row flips. The owner's row stays pending and they can still self-heal through POST /notifications/channels/:id/resend ($id.ts:146-171, gated on their own row being pending, subject to the same shared rate limit at :173-176). No lockout in this branch. |
| Address not enrolled at all | Attacker's row flips to verified. The owner is refused at :67 from then on, until and unless one of the releases below fires. |
The release paths, and their limits. Two paths bear on this report, and each stops the row matching the :59-72 lookup; only the first occurs without the attacker's cooperation. The first is the SendGrid event webhook, which finds the channel by target alone with no user scoping (app/routes/webhook/sendgrid.ts:172-174) and flips it to bounced on a recipient spam report (:205-214). The welcome mail fires the instant the binding lands (email.ts:209-215), so a victim who marks it as spam releases their own address without being told that is what they are doing. That path's limits: nothing tells the mailbox's owner which account the binding landed on (the whole mail object at services/email/welcome.ts:18-92 names none), so the release is reached by accident or not at all; and the webhook's findFirst lookup, with no orderBy, picks an arbitrary row when several share the target, so with the victim's own pending row also present the event may land on the wrong one. The second is the attacker deleting the channel themselves: DELETE /notifications/channels/:id ($id.ts:62-111, the delete at :77-79) removes the row, so the guard's lookup finds nothing and :67 stops firing. Its limit is who can reach it: the route spreads ...requireAuth and scopes its own lookup to the caller's rows ($id.ts:62, :66-70), so it is the attacker's to use and the victim asking for that channel gets the 404 at :73-75, which makes it a lever rather than a relief path. The denial therefore has no guaranteed end: every exit is contingent, and the ones the attacker does not control are events that may never occur. This report claims it as a secondary effect on those terms rather than as a permanent lockout. The denial is keyed on the trimmed, lower-cased address (email.ts:37, email-verification-rate-limit.ts:15-16).
Recommended fix
Two changes, one per limb of the defect. Both patches are reproduced in full in the Proof of Concept field, and each was applied to the pinned snapshot and measured there.
Bind the transition to the requester. This closes the third-party binding. Make the verify handler check the proposition it currently assumes. Spread ...requireAuth on /verify, exactly as the add handler in the same file already does at :31, and refuse when the caller is not the account the verification row belongs to:
if (verification.user_id !== c.var.user_id) {
return c.json(
{ error: 'This verification link belongs to a different account' },
403,
)
}
bind_verify_to_the_requesting_account.patch is that change. The attacker owns the row but never receives the token, and the victim receives the token but does not own the row, so the binding cannot complete for either of them. It does nothing about two registered accounts each redeeming their own token, since each is the requester of its own row.
Re-run the rule in the request that commits the state. This closes the two-account variant. recheck_exclusivity_on_commit.patch inserts, before the write at :195, the lookup the add path runs at :59-65 (channel = 'email', the address, status = 'verified'), reading the address through the channel relation the handler already loads (:185-187), and refuses with the add path's own error when the row it finds belongs to a different account than the verification row. The second of two accounts is then refused at its commit. It does not stop the first binding of an unclaimed address, because at that moment there is no verified row for the lookup to find.
Both are needed. The bind patch is two hunks, ...requireAuth at the /verify registration (:172-176) and a requester comparison after the token lookup (:190-192); the recheck patch is one hunk at that second anchor. They insert at the same place, so applying them in sequence fails; apply one, or hand-merge the recheck lookup under the bind patch's comparison.
Partial mitigation, if the signed-out flow must be preserved. Two changes keep it: the commit-time recheck on its own, and naming the requesting account in both the verification mail and the landing page, so the recipient is deciding something rather than dismissing something. Neither closes the first-time binding this report describes: for a mailbox with no prior verified row the recheck finds nothing, and with the account named the app still writes the row (email.ts:75-97), still sends the mail (:143-149) and still flips the attacker's channel if the recipient clicks anyway.
Also worth fixing: the two declared-and-unused columns named in Root cause.
Impact Details
The in-scope impact this maps to
The governing rung, quoted verbatim from the programme's eligible-impact list:
Changing sensitive details of other users (including modifying browser local storage) without already-connected wallet interaction and with up to one click of user interaction, such as: Email
This report files at High on that rung. The object of the attack is an email address, which the rung names as its example. This report models the victim as an existing ENS user whose account has no email channel yet, which is the third row of the victim-state table above: the attacker's row flips to verified, and from then on the owner is refused their own address at email.ts:67. The affected user cannot see or remove that row: the channel list is scoped to the caller (channels/index.ts:30, :46) and so is the delete lookup ($id.ts:62, :66-70), so the row is invisible in their own settings and a delete request for it returns the 404 at :73-75. The rung asks what detail changed, not whose row records it. What changed is the affected user's own address: it now sits in the target column of a row whose status is verified, and the application begins acting on it without them. The verify hop itself sends them a welcome mail (email.ts:209-215).
The discriminator against Medium is in the source, not in the adjective. The Medium rung is the same sentence with "non-sensitive" and the example "Enabling/disabling notifications". In this worker those two examples name two different objects, on two different routes, in two different tables. Enabling or disabling notifications is PATCH /notifications/preferences (routes/notifications/preferences.ts:62-66), writing user_notification_settings (core/database/schema/notifications.ts:138,143); that route spreads ...requireAuth at preferences.ts:64, binds the caller at :68, and scopes its only write to that value at :74, and this finding never reaches it. There is no cross-account write path to user_notification_settings anywhere in this worker. What this finding writes is a user_channels row whose target is a third party's mailbox, which is the High rung's example by name. Within the same tier the programme also lists "Improperly disclosing confidential user information, such as: Email address": email appears twice in this tier as protected user data (once as a "sensitive detail" and once as "confidential user information") and nowhere as non-sensitive.
One click of user interaction, grounded in the rung's own Email example. The one click of user interaction that commits the state is the press of "Verify Email Address" on app.ens.dev (apps/manager/src/routes/notifications/channels/email/verify.tsx:220-224), inside the app's own verification flow. Reaching that page means opening the link the worker mailed, and the rung's own example is "Email", that is, an emailed-verification flow, so following the emailed link is intrinsic to the class of impact the rung describes rather than an additional click charged against its budget. The press is the whole of the interaction the page asks for: verify.tsx has no useEffect, no beforeLoad and no loader function (only loaderDeps at :57, which reads the search parameter), and handleVerify (:77-92) is bound only to onClick at :192 and :220, so the emailed link alone submits nothing.
Loss mechanism and its bound
The state change is the impact, and it is a write to the project's own database inside the workers asset. email.ts:195-201 sets status: 'verified' on a user_channels row whose user_id is the attacker's and whose target is a third party's mailbox that account never proved it controls. The rung claim rests on that write (email.ts:195-201), the welcome mail the verify hop sends to the mailbox (:209-215) and the refusal the owner then meets (:67-71), all inside workers/api-worker.
The scope boundaries clause excludes bugs in third-party services like Cloudflare or the mail provider. It does not exclude a first-party defect whose impact happens to be delivered through one. The change this report claims completes entirely inside workers/api-worker, which is the whole of the listed workers asset: the email.ts:195-201 write, on the project's own database. No SendGrid or Cloudflare behavior is alleged to be defective; the mail provider is only the transport the High rung's own 'Email' example presupposes.
One further effect, on the mailbox owner:
- Enrolment denial. For a mailbox with no prior ENS record, the owner is refused at
email.ts:67from then on; the release paths that bear on this report, and their limits, are set out above. The webhook's bounce and unsubscribe handlers (sendgrid.ts:185-203,:222-237) release it the same way, by moving the row'sstatusoffverified.
The boundary of the claim. Email is not an authentication or recovery factor here: app/routes/auth/index.ts is SIWE-only and no email-based reset exists, so the claim is bounded to the notification surface and account takeover is not asserted.
Why not lower, and the out-of-scope entries to weigh
Not Low. The axis separating the High rung from the Low rung has two values, and the Low rung requires "significant user interaction", exemplified by "Iframing leading to modifying the backend/browser state", an attacker-controlled surface. A single press on the project's own domain, on the page the project's own verification mail links to, is not that, because it is not a surface the attacker controls.
Not excluded. "Impacts causing only the enumeration or confirmation of the existence of users or tenants" does not bite, because the harm claimed is the binding and not the 400/200 oracle. "Impacts caused by vulnerabilities requiring un-prompted, in-app user actions that are not part of the normal app workflows" does not bite either: the verification page exists for no other purpose, the worker's own mail links to it (services/email/verification.ts:16), and pressing "Verify Email Address" is the page's primary action (verify.tsx:220-224). Both rungs on this axis fund an emailed click on their face. Social engineering appears on this programme under Prohibited Activities, which governs what a researcher may do while testing, not which impacts are eligible; none was performed, and the attacker supplies an address and no content. Every word of the subject and body the recipient reads is generated by the worker itself and sent from the project's own domain, including "Thank you for signing up for ENS notifications!" (services/email/verification.ts:32, :54), so the misleading text is authored by first-party code. This handler commits the requesting account's binding on possession of the token alone, with no session and no comparison between the caller and the account the row belongs to (email.ts:172-176, :195-201); the address is bound to the requester's row whoever pressed the button.
Not a duplicate, and scope
The published register. All 25 Part-1 entries of "ENS Apps: Known Security Issues" (last updated 2026-08-14) and its Part 2 lists were read; none touches notification channels or email verification, and the one entry attributed to the API worker, R2-05 ("SendGrid event webhook fails open when the verification key is unset", Low), is a different defect on a different route, closed in this snapshot (webhook/sendgrid.ts:113-116 returns 500 when SENDGRID_WEBHOOK_VERIFICATION_KEY is unset and :128-152 enforces an ECDSA signature).
The audit coverage boundary. The register's Round 3 source-level audit (August 2026) covered packages/transaction-manager and packages/smart-account, not workers/api-worker, where this finding lives; across the same twenty-five Part-1 entries, exactly one (R2-05) is attributed to the API worker.
References (pinned to archive sha256:bf6ca914f817ccbf22e340813630ba2c69315884e777fbac4ac34a1e4ba542c5)
The delivered export ships no .git, so there is no commit to link. Paths are repository-relative.
workers/api-worker/src/app/routes/notifications/channels/email.ts-:29-33(add handler,...requireAuth),:59-72(the cross-account guard, scoped toverified),:67(the refusal),:75-97(the channel row,user_id= caller),:105-114(token mint, notargetwritten),:165-169(token withheld from the caller),:172-176(the verify handler's middleware chain, no auth),:179-188(the token lookup),:190-192(the verify handler's only refusal),:195-201(the flip, keyed onverification.channel_id),:204-206(the spent row deleted),:209-215(welcome mail)workers/api-worker/src/app/index.ts-:14-40(composition root; the only.use()iscors()at:15)- `workers/api-worker/src/app/middleware/hono.t
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the ownership rule is enforced only in the request that creates a pending row, while the request that flips the row to verified has no authentication and never re-checks who owns the row or whether the address is already verified elsewhere.
Impact
The victim's email address becomes bound as verified to an account they never chose, they receive a welcome mail, and they are refused their own address while the row remains verified; the report notes the denial has no guaranteed end and is claimed as a secondary effect rather than a permanent lockout.
What the attacker needed
One free SIWE login; attacker knows victim's email address; victim clicks the emailed link
The fix
The verify handler should require authentication and refuse when the caller is not the account the verification row belongs to, and should re-run the cross-account verified check before committing the state.
How it was found
- Log in with a fresh wallet to obtain an account.
- Submit the victim's email address to the add-email-channel endpoint, which stores a pending row for the attacker's account.
- The worker sends its genuine verification email to the victim's mailbox.
- The victim opens the link and presses the verify button.
- The verify endpoint matches the token and sets the attacker's row to verified.
- The victim is now refused their own address as already linked to another account.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you add an email address to an account, the site sends a link to that mailbox to prove you own it. Here the step that marks the address as confirmed never checked that the person clicking the link is the same person who asked to add it. So an attacker could type in someone else's address, and when the real owner clicked the genuine link, the address got attached to the attacker's account instead.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.