users.update_role reveals whether a user id from another team exists and which role it has
Summary
Summary
users.update_role checks the user's current role before it checks permissions. An admin of one team who calls it with the id of a user from another team gets three different answers, depending on whether that user exists and what role they have. Other endpoints, like users.info, ans...
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| otherOutline |
< 1.12.0→ 1.12.0 |
1.12.0 |
Original description The description as published by the source.
Summary
users.update_role checks the user's current role before it checks permissions. An admin of one team who calls it with the id of a user from another team gets three different answers, depending on whether that user exists and what role they have. Other endpoints, like users.info, answer the same way for every foreign or unknown id.
Details
In server/routes/api/users/users.ts, updateRole:
- loads the user by id with
rejectOnEmpty: true, so an unknown id returns 404; - runs
if (user.role === role) throw ValidationError("User is already in that role"), so a matching role returns 400; - only after that calls
authorize(actor, "demote" / "promote", user), which returns 403 for a user of another team.
Because steps 1 and 2 run before the permission check, the answer depends on data the caller is not allowed to see.
Suggested fix: call authorize() (or a single authorize(actor, "update", user)) right after loading the user, before the user.role === role and user.id === actor.id checks. Then any foreign id gets the same 403. Loading with a team filter would also make a foreign id look the same as an unknown one.
Proof of concept
Setup: self-hosted Outline v1.11.0, default settings. Two teams on the same instance, A and B. Team B has an admin with id B_USER. I used an API key of team A's admin.
POST /api/users.update_rolewith{"id":"B_USER","role":"admin"}returns 400 "User is already in that role".- `POST /api/users.updat…
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY outline/outline