GHSA-h8q5-cp56-rr65: PraisonAI Platform has a cross-workspace IDOR + member-role privilege escalation
SummaryThe Platform server exposes resources under `/api/v1/workspaces/{workspace_id}/...` and protects them with a `require_workspace_member(workspace_id)` FastAPI dependency. The dependency only checks that the caller is a member of the workspace_id in the URL prefix. The route handlers then look up the inner resource (`agent_id`, `issue_id`, `project_id`, `label_id`, `comment_id`, `dependency_id`) by primary key alone. The resource's own `workspace_id` is never compared to the URL's `workspace_id`.A user can therefore put their own workspace in the URL prefix and any other workspace's resource ID in the path. The auth check passes, since they really are a member of the prefix workspace. The service then returns the cross-tenant resource for read, update, or delete.There is a second bug in the member-management routes (`add_member`, `update_member_role`, `remove_member`, `update_workspace`, `delete_workspace`). Each one inherits the default `min_role="member"` from `require_workspace_member`. Any basic member can therefore promote themselves to admin or owner, demote or remove other members, and delete the workspace. The role hierarchy exists in the schema but is not enforced.Registration is open at `/api/v1/auth/register` with no email verification. The default server bind is `0.0.0.0:8000` (`python -m praisonai_platform`). One curl from any unauthenticated network position is enough to bootstrap into the system.Affected functionalityEvery nested-resource route under `/api/v1/workspaces/{workspace_id}/...`:| File | Routes |
|------|--------|
| `routes/agents.py` | `GET /agents/{agent_id}`, `PATCH /agents/{agent_id}`, `DELETE /agents/{agent_id}` |
| `routes/issues.py` | `GET /issues/{issue_id}`, `PATCH /issues/{issue_id}`, `DELETE /issues/{issue_id}`, `POST /issues/{issue_id}/comments`, `GET /issues/{issue_id}/comments` |
| `routes/projects.py` | `GET /projects/{project_id}`, `PATCH /projects/{project_id}`, `DELETE /projects/{project_id}`, `GET /projects/{project_id}/stats` |
| `routes/labels.py` | `PATCH /labels/{label_id}`, `DELETE /labels/{label_id}`, `POST /issues/{issue_id}/labels/{label_id}`, `DELETE /issues/{issue_id}/labels/{label_id}`, `GET /issues/{issue_id}/labels` |
| `routes/dependencies.py` | every route |
| `routes/workspaces.py` | `PATCH /{workspace_id}`, `DELETE /{workspace_id}`, `POST /{workspace_id}/members`, `PATCH /{workspace_id}/members/{user_id}`, `DELETE /{workspace_id}/members/{user_id}` (these have a *role*-enforcement bug rather than a cross-tenant bug) |Root causeA. The auth dependency only sees the URL prefix`src/praisonai-platform/praisonai_platform/api/deps.py:54-73`:This only validates that the user is a member of the URL `workspace_id`. It does not (and cannot, given its signature) validate any inner resource ID.B. The service-layer lookups are unscopedExample, `src/praisonai-platform/praisonai_platform/services/agent_service.py:53-55`:And the route, `src/praisonai-platform/praisonai_platform/api/routes/agents.py:53-64`:The same shape (route ignores `workspace_id`, service is keyed by primary id) appears in `update_agent`/`delete_agent`, all of `routes/issues.py` (incl. comments), all of `routes/projects.py`, all of `routes/labels.py`, all of `routes/dependencies.py`.C. Member-management routes accept the default `min_role="member"``src/praisonai-platform/praisonai_platform/api/routes/workspaces.py:115-141`:`Depends(require_workspace_member)` keeps the default `min_role="member"`. There is no admin/owner gate on the role-mutation, member-removal, or workspace-deletion routes. A basic member can therefore mutate any member's role to any value (including `admin` or `owner`), remove any other member, and delete the workspace.D. Deployment defaults amplify the impact`src/praisonai-platform/praisonai_platform/__main__.py:13-16`. The server defaults to `host=0.0.0.0`, so this is network-reachable on a default deployment.`src/praisonai-platform/praisonai_platform/api/routes/auth.py:19-29`. `/auth/register` is open and immediately returns a valid bearer token.Proof of ConceptLayout[start_server.sh](https://github.com/user-attachments/files/27569897/start_server.sh)
[run_poc_video.sh](https://github.com/user-attachments/files/27569899/run_poc_video.sh)How to reproduce**Terminal 1, start the server**:This runs the real production entry point (`python -m praisonai_platform`) against a clean SQLite database, bound to `127.0.0.1:8765`.**Terminal 2, run the attack**:Each step prints a numbered banner, then the exact `curl` command, then the JSON response. Eight numbered steps cover registration, victim setup, the cross-tenant read/write, and the privilege escalation.Captured output (excerpt from `poc/output/attacker_run.log`)**Step 5, negative control (Mallory hits Alice's workspace directly):**Auth works at all.**Step 6, the bug (Mallory uses HER workspace ID in the URL, ALICE's agent ID in the path):**Mallory just read Alice's private agent.**Step 7, Mallory rewrites Alice's agent.instructions:**The change persisted on Alice's actual agent.**Step 8, privilege escalation:**Mallory is now the only admin of the workspace Alice created.https://github.com/user-attachments/assets/de199923-e214-4603-9eab-d84659706edbImpactConfidentiality, High. Any registered user can read every agent, issue, project, label, comment, and dependency across every workspace. The `agent.instructions` and `agent.runtime_config` fields are where API keys, system prompts, and connection strings are stored.Integrity, High. Any registered user can rewrite `agent.instructions` to a malicious system prompt that exfiltrates conversations, mutates downstream behaviour, or impersonates the original operator. They can also reassign issues, edit project metadata, and retitle issues.Availability, High. Any registered user can delete every agent, issue, project, and dependency in every workspace. They can also delete entire workspaces.Account takeover. A user invited as a basic `member` to any workspace can promote themselves to `admin`, evict the original owner, and take full ownership of the workspace.Default deployment is exposed. `python -m praisonai_platform` binds `0.0.0.0:8000` and registration is open. No misconfiguration is required for any of the above.Suggested fixTwo changes are needed. Both are small and local to the affected files.1. Re-scope every nested-resource lookup to the URL workspaceFilter at the service layer:Then pass `workspace_id` from the URL at every call site.Apply the same change to every route in `routes/agents.py`, `routes/issues.py` (including the comment subroutes), `routes/projects.py`, `routes/labels.py`, and `routes/dependencies.py`. One tenant-isolation regression test per (resource, operation) pair is enough to lock this down.2. Enforce the role lattice on member-management routesAdd explicit `min_role` arguments where the operation is privileged:
CVSS v4.0: 9.4