GHSA-V675-3QMH-6RMF
ToolJet folder-apps create/remove routes never check organization ownership, allowing cross-tenant app hijack and metadata disclosure
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-V675-3QMH-6RMF divulgada · CVSS 6.6 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
`POST /api/folder-apps` (create/move a folder-to-app mapping) and `PUT /api/folder-apps/:folderId` (remove one) take a caller-supplied `folder_id`/`app_id` pair and act on the `FolderApp` join table with no organization scoping at all -- not even a spoofable client-supplied one. The controller handlers for these routes do not inject `@User()`; no organization context reaches the service layer.
Any authenticated admin of any organization can, given only another organization's app UUID and one of their own folder UUIDs: delete that app's existing folder placement in its real (victim) organization, and relink it into a folder in their own, unrelated organization. This has two live-confirmed consequences: victim-side data-integrity damage, and attacker-side information disclosure (the hijacked mapping causes the victim app's name, real organization_id, creator user_id, and current-version metadata to appear in the attacker's own folder-scoped app listing).
### Details
`server/src/modules/folder-apps/controller.ts:32-55`: `create()` and `remove()` do not take `@User()` at all; only `folder_id`/`app_id`/`app_ids` from the body and `branchId` from a header reach the service.
`server/src/modules/folder-apps/util.service.ts:312-333` (`create`):
async create(folderId: string, appId: string, branchId?: string): Promise<FolderApp> {
return dbTransactionWrap(async (manager: EntityManager) => {
const branchFilter = branchId ? { branchId } : { branchId: IsNull() };
const existingFolderApp = await manager.findOne(FolderApp, { where: { appId, ...branchFilter } });
if (existingFolderApp?.folderId === folderId) return existingFolderApp;
if (existingFolderApp) await manager.delete(FolderApp, { id: existingFolderApp.id });
// TODO: check if folder under user.organizationId and user has edit permission on app
const newFolderApp = manager.create(FolderApp, { folderId, appId, branchId: branchId || null });
return await manager.save(FolderApp, newFolderApp);
});
}The lookup for `existingFolderApp` is by `appId` alone (plus branch), with no organization filter -- it deletes a mapping belonging to a completely different organization's app. `bulkCreate()` (`util.service.ts:291-310`) has the identical unscoped shape for multiple `appIds`.
`server/src/modules/folder-apps/service.ts:34-40` (`remove`):
async remove(folderId: string, appId: string, branchId?: string): Promise<void> {
return dbTransactionWrap(async (manager: EntityManager) => {
// TODO: folder under user.organizationId
const where = branchId ? { folderId, appId, branchId } : { folderId, appId, branchId: IsNull() };
return await manager.delete(FolderApp, where);
});
}Both `// TODO` comments are the developers' own acknowledgment of the missing check.
Disclosure path: `GET /api/apps?folder=<folderId>` (`apps/controller.ts:132-141`) resolves apps via the folder's `folder_apps` rows without an `apps.organization_id` predicate keyed to the caller's own organization -- it trusts that every `folder_apps` row for a folder the caller owns already points at an app in the same organization, an invariant the create/remove bug above breaks.
The guard chain (`JwtAuthGuard`, `FeatureAbilityGuard`, `folder-apps/ability/guard.ts`) does perform some folder/app ownership checks for other operations, but does not close this gap: it authorizes based on the caller's own organization's admin/permission state, not on whether the caller-supplied `app_id` actually belongs to that organization.
### PoC
Environment: fresh `ToolJet/ToolJet` clone (`main`, as of 2026-07-19), built and run natively against local PostgreSQL 18 + Redis, `TOOLJET_EDITION` unset (CE). Reported version: `3.21.52-beta-ce`.
- Attacker becomes admin of Org A, creates their own folder there.
- Org B (victim) is created; a real app (`victim-secret-app`) and a real folder are created in Org B, and the app is placed into that folder -- confirmed via Postgres.
- The attacker's own `organization_users` row for Org B is deleted directly in Postgres (verified count=0 afterward).
- Attacker re-authenticates into Org A only.
- Negative control: `GET /api/folder-apps` with header `tj-workspace-id: <org_b_id>` -> `401 Unauthorized`.
- Exploit (hijack): `POST /api/folder-apps` with header `tj-workspace-id: <org_a_id>` (attacker's own workspace) and body `{"folder_id": "<attacker's own Org A folder>", "app_id": "<victim's Org B app>"}` -> `201`.
- Verification in Postgres: victim's original `folder_apps` row is gone; a new row exists linking the attacker's folder to the same `app_id`. `SELECT count(*) FROM folder_apps fa JOIN folders f ON fa.folder_id = f.id WHERE fa.app_id = '<victim_app_id>' AND f.organization_id = '<org_b_id>'` -> `0`.
- No direct-by-id bypass: attacker `GET /api/apps/<victim_app_id>` (Org A header) -> `404 {"message":"App not found. Invalid app id or slug"}`.
- Exploit (info disclosure): attacker `GET /api/apps?folder=<attacker's own folder>&type=front-end` (Org A header) -> `200`, response includes:
{
"id": "48e29012-2224-43cc-8f79-a75b9965091e",
"name": "victim-secret-app",
"organization_id": "082ab574-95c2-43b1-8d89-19a58acd59cd",
"user_id": "ce245170-a3c9-4de5-a4e8-2f3124c3f840",
"current_version_id": null,
"editing_version": {
"id": "d31f9e92-ce95-489f-8240-014de396cb61",
"name": "v1",
"home_page_id": "f2efc0d6-249a-4c32-9340-5a6712afdca2",
"version_type": "version",
"current_environment_id": "eacca6b0-2f7c-4476-b3ee-ded05850184b"
}
}`organization_id` in the leaked row is Org B's real id, confirming the disclosure crosses the tenant boundary. (`user_id` shown is the attacker's own -- a PoC-setup artifact from briefly, legitimately holding Org B admin access via the normal org-creation flow purely to seed a realistic victim app, before that membership was stripped for the actual attack steps 4-9. `organization_id` is the field that unambiguously proves cross-tenant disclosure regardless of this detail.)
5) NEGATIVE CONTROL: 401 Unauthorized
6) EXPLOIT (hijack): 201, folder_apps row moved from victim's folder to attacker's folder
7) DB: Org B's own folder_apps count for its app = 0 after the attack
8) attacker GET /api/apps/{victim_app_id} -> 404 (no direct-by-id bypass)
9) attacker GET /api/apps?folder=<own folder> -> 200, victim app metadata disclosed,
organization_id in response == real Org B id### Impact
An attacker who administers any single organization can, against any other organization whose app UUID they know:
- delete that app's folder placement in its real organization (confirmed via Postgres: 0 rows remain in Org B for its own app);
- learn the victim app's name, real organization UUID, creator user id, current version id, and current-version metadata via their own org's folder-scoped app listing;
- repeat this against any organization on a shared instance, since the only precondition is knowing the target app's UUID.
This report does not claim exposure of the app's actual page/component/query definitions -- direct-by-id access remains correctly blocked (404), and no definition/pageSettings/globalSettings fields were observed in the disclosed listing response. An x-branch-id-spoofing escalation hypothesis (which could in principle reach full AppVersion.definition via a different query path) was also tested and did not reproduce in this environment, so it is explicitly not part of this report's claims.
Suggested severity: Medium, `CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:L`. `PR:H` because exploitation requires workspace-admin privileges in the attacker's own org. `C:L` for the confirmed listing-metadata disclosure. `I:L`/`A:L` for the confirmed folder-mapping deletion, which does not touch the app's actual content.
Suggested fix: in `create()`, `bulkCreate()`, and `remove()`, resolve the caller's organization from the authenticated user (thread `@User()` through the controller, which currently does not receive it) and verify both the target `folder_id` and `app_id` belong to that organization before acting. Separately, harden the folder-scoped app-listing query to filter by `apps.organization_id = user.organizationId` rather than relying solely on the assumption that every `folder_apps` row for an owned folder already points at an app in the same organization.
Disclosure notes: all dynamic validation was performed against a local, throwaway instance built from this exact clone on an isolated VM with dedicated Postgres/Redis created solely for this test; no ToolJet Cloud or third-party instance was touched. The test environment was torn down after reproduction.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmtooljet |
Sin parche | — | — | 0.0.1-security.1 afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/ToolJet/ToolJet/security/advisories/GHSA-v675-3qmh-6rmfLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
