B-4 Bootstrap race admits a second SuperAdmin (deploy-window takeover) #35

Closed
opened 2026-11-03 08:24:04 +01:00 by amiryahaya · 0 comments
Owner

Bootstrap.cs:49-52, 83-84, 104-109: public unauthenticated setup→confirm guarded by check-then-write AnyAsync(SuperAdmin exists). Two concurrent /setup calls with different emails both persist; HandleConfirm's guard only blocks once a SuperAdmin has TotpEnabled=true — an attacker watching a fresh deployment inside the setup→confirm window self-promotes to SuperAdmin (all /api/admin/*). Rate limit only 20/min/IP.

Fix: partial unique index on SystemRole (WHERE SystemRole IS NOT NULL) or transactional INSERT…WHERE NOT EXISTS; on successful confirm, disable/delete other SuperAdmin candidates. Add concurrency regression test. Full findings + evidence: docs/redesign/2026-11-onboarding-passkey/08-code-baseline-review.md

Bootstrap.cs:49-52, 83-84, 104-109: public unauthenticated setup→confirm guarded by check-then-write AnyAsync(SuperAdmin exists). Two concurrent /setup calls with different emails both persist; HandleConfirm's guard only blocks once a SuperAdmin has TotpEnabled=true — an attacker watching a fresh deployment inside the setup→confirm window self-promotes to SuperAdmin (all /api/admin/*). Rate limit only 20/min/IP. Fix: partial unique index on SystemRole (WHERE SystemRole IS NOT NULL) or transactional INSERT…WHERE NOT EXISTS; on successful confirm, disable/delete other SuperAdmin candidates. Add concurrency regression test. Full findings + evidence: docs/redesign/2026-11-onboarding-passkey/08-code-baseline-review.md
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/failsulit#35
No description provided.