Summary
A missing organization-ownership check in ToolJet database write and destroy routes allows builder-role users to operate on databases belonging to other organizations. Under shared-instance conditions, an attacker may insert data, alter schemas, or permanently delete tables across tenant boundaries.
Affected context
The vulnerability occurs in ToolJet deployments where multiple organizations share database infrastructure and builder-role users can access database write or destroy functionality. Risk is present when these routes accept an organization identifier without reliably resolving and verifying that the requesting user is authorized to manage the referenced organization.
Exploit preconditions
- Attack surface: ToolJet database write and destroy API routes
- Required access: An authenticated user with builder-level privileges
- Trigger point: A request that references a database or organization outside the user's authorized tenant
- Why exploitation is possible: Organization ownership checks are missing or incomplete, allowing attacker-controlled identifiers to cross tenant boundaries
Why this happens
The underlying bug is an authorization failure caused by trusting an organization identifier without enforcing ownership at the point where database operations are performed. This maps to CWE-639: Authorization Bypass Through User-Controlled Key, where a user-controlled key selects a protected resource and the application fails to verify that the requester is permitted to access it. As a result, route-level permissions may be satisfied while tenant-level authorization is bypassed.
Potential impact
- Attackers may insert arbitrary data into another organization's database
- Attackers could alter database schemas or disrupt application behavior
- Attackers may permanently delete tables and associated data
- Cross-tenant confidentiality, integrity, and availability could be affected
- Shared-instance customers could experience data loss or service disruption
General mitigation guidance
Mitigation generally focuses on enforcing authorization at every database operation and deriving tenant context from trusted server-side identity rather than request parameters.
Common defensive patterns include:
- Resolve organization and database ownership server-side from the authenticated session
- Enforce tenant authorization checks immediately before read, write, schema, and destroy operations
- Treat organization identifiers supplied by clients as untrusted selectors
- Apply deny-by-default policies for cross-organization resource access
- Separate database credentials and permissions by tenant where practical
- Require additional safeguards for destructive schema and data operations
- Use least-privilege roles and independent audit logging for administrative actions
How teams detect issues like this
Organizations can detect similar authorization flaws through:
- Static analysis for routes that use client-supplied organization or resource identifiers without ownership checks
- Code review of every database mutation and destructive operation for server-side tenant resolution
- Policy tests that attempt cross-organization access with valid lower-privilege accounts
- API monitoring for unusual cross-tenant identifiers, bulk mutations, schema changes, and table deletions
- Audit-log correlation between actor identity, organization context, and affected database resource
- Automated security testing and neutral code-review tools that flag missing object-level authorization

