GitHub advisory · Go
Fider: Multi-tenant verification-key bypass enables cross-tenant account takeover
Description
In multi-tenant mode (HOST_MODE=multi), an attacker can use an email verification key issued by Tenant A to authenticate as the same email address on Tenant B. This completely bypasses tenant isolation and allows unauthorized account takeover across tenants.
Single-host deployments (HOST_MODE=single, the default) are NOT affected.
app/services/sqlstore/postgres/tenant.go:133 — getVerificationByKey
The getVerificationByKey function queries the email_verifications table without filtering by tenant_id:
-- Vulnerable query (line 133)
SELECT id, email, name, key, created_at, verified_at, expires_at, kind, user_id, attempts
FROM email_verifications
WHERE key = $1 AND kind = $2
LIMIT 1
The table's unique index is (tenant_id, key) — the same key can theoretically exist across tenants. Without the tenant_id filter, the query returns the first matching row regardless of tenant.
Sibling queries in the same file correctly scope by tenant_id, making this a clear regression from the established secure pattern:
-- Secure pattern at line 148
WHERE tenant_id = $1 AND email = $2 AND code = $3 AND kind = $4
-- Secure pattern at line 182 (setKeyAsVerified)
WHERE tenant_id = $2 AND key = $3 AND verified_at IS NULL
Prerequisite: the attacker only needs an account on any tenant (zero special privilege).
tenanta.example.com with attacker@evil.comtenanta.example.com and obtains the verification key from the emailhttps://tenantb.example.com/signin/verify?k=<KEY>tenant_id filtering, finds Tenant A's verification recordConsequence:
attacker@evil.com already exists as an administrator on Tenant B → full administrative access…Manual fix · Go
go get github.com/getfider/fider@v0.36.0Sources