SECURITY: any signed-in user can take over a directory-managed space or orphan folder with POST /api/v1/spaces #927

Closed
opened 2026-10-15 22:06:17 +00:00 by Cordy · 1 comment
Owner

Found during the #923 research (2026-10-16), confirmed with a probe on the stacktest rig (scratch/b7e/batch907/923copy/internal/api/probe923_test.go, file 923-research.md).

What happens: a non-member sends POST /api/v1/spaces {"name":"Finance"} for an existing IdP-group space or an orphan folder. The request answers 201 and the caller becomes the space's app-managed owner. On the rig, user zed could then read the existing files (budget.txt, old.txt). The IdP writers keep their access, so nobody notices.

Why it matters:

  • The handbook describes taking over an orphan folder as an admin action ("Take over and deactivate").
  • #923 hands an attacker the folder names to try.

Fix direction (with #923, one security release): creating a space refuses a name whose folder or directory-space record already exists, for everyone. Admins keep the existing take-over action. Tests run across the full user-type matrix. This is related to #919 (directory-group namesakes) but separate.

Decision D4 in the #923 research.

Found during the #923 research (2026-10-16), confirmed with a probe on the stacktest rig (`scratch/b7e/batch907/923copy/internal/api/probe923_test.go`, file `923-research.md`). **What happens:** a non-member sends `POST /api/v1/spaces {"name":"Finance"}` for an existing IdP-group space or an orphan folder. The request answers 201 and the caller becomes the space's app-managed owner. On the rig, user `zed` could then read the existing files (`budget.txt`, `old.txt`). The IdP writers keep their access, so nobody notices. **Why it matters:** - The handbook describes taking over an orphan folder as an admin action ("Take over and deactivate"). - #923 hands an attacker the folder names to try. **Fix direction (with #923, one security release):** creating a space refuses a name whose folder or directory-space record already exists, for everyone. Admins keep the existing take-over action. Tests run across the full user-type matrix. This is related to #919 (directory-group namesakes) but separate. Decision D4 in the #923 research.
Author
Owner

Shipped in v0.6.346 (PR #937). Both dogfoods run v0.6.346.

Local live check (scratch/b7e/live346):

  • Create by a person: 76 create attempts by non-members, namesakes and Basic admins, over app spaces, directory folders, orphans, former names, reserved names and an NFD folder. All got the same generic 409, nothing changed (snapshot hash) and there was no file access.
  • Take-over attempts: a person's or a Basic admin's take-over is refused with 403.
  • Rename: a rename onto an existing folder is refused for everyone.
  • Session admin take-over: works over an orphan folder and is audited as space-take-over. It is refused over a space, a former name or a reserved name.
  • Expired names: a new space over an expired deleted name starts with a fresh identity.
  • Control run on v0.6.345: zed creates Finance and reads budget.txt.

Follow-ups:

  • #931: the convergence sweep's own adoption rule.
  • #932: finding past takeovers on the dogfoods.
  • #934: NFD take-over.
  • #936: take-over in the UI on instances without a group listing.

Closing.

## Shipped in v0.6.346 (PR #937). Both dogfoods run v0.6.346. **Local live check** (`scratch/b7e/live346`): - **Create by a person:** 76 create attempts by non-members, namesakes and Basic admins, over app spaces, directory folders, orphans, former names, reserved names and an NFD folder. All got the same generic 409, nothing changed (snapshot hash) and there was no file access. - **Take-over attempts:** a person's or a Basic admin's take-over is refused with 403. - **Rename:** a rename onto an existing folder is refused for everyone. - **Session admin take-over:** works over an orphan folder and is audited as `space-take-over`. It is refused over a space, a former name or a reserved name. - **Expired names:** a new space over an expired deleted name starts with a fresh identity. - **Control run on v0.6.345:** zed creates `Finance` and reads `budget.txt`. **Follow-ups:** - #931: the convergence sweep's own adoption rule. - #932: finding past takeovers on the dogfoods. - #934: NFD take-over. - #936: take-over in the UI on instances without a group listing. Closing.
Cordy closed this issue 2026-10-16 01:07:49 +00:00
Sign in to join this conversation.
No labels
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: Cordy/Cairn#927
No description provided.