Summary
TypeBot versions 3.15.2 and below contain an Insecure Direct Object Reference (IDOR) issue in the theme template save and delete endpoints.
Any authenticated non-guest user who knows or can discover a theme template ID can modify or delete templates belonging to other workspaces, exposing or corrupting shared visual configurations across tenants.
Affected context
The vulnerability appears in TypeBot's multi-tenant environment where workspaces are used to segregate data.
The affected handlers (handleSaveThemeTemplate and handleDeleteThemeTemplate) correctly check that a user belongs to the supplied workspaceId, but the underlying Prisma queries use only themeTemplateId in the WHERE clause.
In deployments where theme template IDs can be inferred from shared bots, logs, or network traffic, this broken object-level authorization lets users reach across workspace boundaries and operate on templates they do not own.
Exploit preconditions
- Attack surface: HTTP API endpoints responsible for saving and deleting theme templates.
- Required access: Authenticated non-guest TypeBot account; no privileged role is required beyond membership in any workspace.
- Trigger point: Sending requests to the theme template operations with a
themeTemplateIdthat belongs to a different workspace than the one the user actually controls. - Why exploitation is possible: Authorization is enforced only at the workspace level, and the data access layer fails to scope database operations by
workspaceId, so possession of a valid template ID is treated as sufficient authorization.
Why this happens
The core problem is a broken object-level authorization check consistent with CWE-639: Authorization Bypass Through User-Controlled Key.
The handlers validate that the caller is a non-guest member of some workspaceId, but the subsequent Prisma queries filter solely on the themeTemplateId field.
Because the object's workspace ownership is never cross-checked in the query (WHERE themeTemplateId = ? instead of WHERE themeTemplateId = ? AND workspaceId = ?), the system implicitly trusts user-supplied identifiers without verifying that the referenced resource belongs to the caller's tenant.
This pattern is a common multi-tenant access control flaw where object identifiers double as authorization tokens without proper scoping.
Potential impact
- Unauthorized modification of theme templates belonging to other workspaces.
- Deletion of theme templates used by other teams or customers, causing visual or branding disruptions.
- Cross-tenant impact on chatbot appearance and user experience, potentially harming brand consistency.
- Exposure of template IDs and metadata that may aid further enumeration or targeted attacks.
- Undermining of tenant isolation guarantees in hosted or SaaS deployments.
General mitigation guidance
Effective mitigation focuses on strengthening object-level authorization and enforcing tenant scoping in all data access paths.
General defensive patterns include:
- Ensuring every read/write/delete query on tenant-owned objects includes both the object identifier and its owning tenant/workspace identifier in the query conditions.
- Implementing a centralized authorization layer or service that validates that the authenticated principal owns or has been granted access to the specific object referenced by an ID.
- Treating all client-supplied identifiers (IDs, UUIDs, slugs) as untrusted and always resolving them within an authenticated user's allowed scope.
- Using repository or ORM-level helpers that require passing a workspace/tenant context and prevent unscoped object lookups by design.
- Applying least privilege to roles and avoiding sharing identifiers in places where they are not needed, such as unnecessary logs or over-exposed API responses.
How teams detect issues like this
Organizations can detect similar IDOR patterns using a combination of review and automation:
- Static analysis rules that flag data-access calls where sensitive objects (e.g., templates, workspaces, flows) are fetched solely by a user-controlled ID without including tenant, owner, or workspace constraints.
- Code review checklists requiring reviewers to verify object-level authorization for every endpoint that accepts IDs, especially in multi-tenant or workspace-based architectures.
- Centralized logging of access control decisions, including workspace and object IDs, and alerting on suspicious cross-workspace access attempts.
- Automated integration or API security tests that attempt to access or manipulate objects across tenant boundaries using IDs learned from one account to interact with another's resources.

