You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Vulnerability] Admin takeover via stale GitHub username #851
Admin authorisation is based on the mutable username field. If an admin renames their GitHub account, someone else can claim the old username and sign in to /dev/null with it. Because User::isAdmin() only checks whether username is in app.admins, the attacker becomes an admin. The new UpdateStaleUsernames action makes this path more direct by renaming any existing user with the same username before creating the attacker's account.
Affected Code
app/Models/User.php:325-330 — isAdmin() compares username with app.admins
app/Actions/UpdateOrCreateUser.php:31-40 — runs stale-username handling before updateOrCreate
app/Actions/UpdateStaleUsernames.php:16-27 — renames existing users with the same lowercased username
Preconditions
A configured admin renames their GitHub username.
The old GitHub username becomes available.
An attacker claims that old username.
Steps to Reproduce
Admin changes their GitHub username from admin-old to admin-new.
Attacker creates a GitHub account named admin-old.
Attacker signs in to /dev/null with GitHub.
UpdateStaleUsernames renames the existing admin row to _renamed-<github_id>.
The attacker's user is created with username admin-old.
User::isAdmin() returns true for the attacker.
Impact
The attacker gains admin-only capabilities, including moderation and other privileged actions. If the admin's local row was already updated to the new username, the attacker can still claim the old username and become admin.
Suggested Fix
Authorize admins using an immutable identifier (github_id) or a dedicated database role/column, never username.
Migrate ADMINS configuration from usernames to GitHub IDs.
Ensure stale-username cleanup cannot transfer privileged identity.
Add a regression test: admin renames account, old username is claimed, attacker must not be an admin.
Activity