You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A broken access control vulnerability in the database query tool allows any authenticated tenant to read sensitive data belonging to other tenants, including API keys, model configurations, and private messages. The application fails to enforce tenant isolation on critical tables (models, messages, embeddings), enabling unauthorized cross-tenant data access with user-level authentication privileges.
Details
Root Cause
The vulnerability exists due to a mismatch between the queryable tables and the tables protected by tenant isolation in internal/utils/inject.go.
Tenant-isolated tables (protected by automatic WHERE tenant_id = X clause):
Gap: The tables messages, embeddings, and models are queryable but NOT in the tenant isolation list. This means queries against these tables do NOT receive the automatic WHERE tenant_id = X filtering.
When tenant 1 queries SELECT * FROM models, the validation passes and noWHERE tenant_id = 1 clause is appended because models is not in the tablesWithTenantID map. The unfiltered result exposes all model records across all tenants.
PoC
Prerequisites
Access to the AI application as an authenticated tenant
Ability to send prompts that invoke the database_query tool
Steps to Reproduce
Authenticate as Tenant 1 and craft the following prompt to the AI agent:
Use the database_query tool with {"sql": "SELECT * FROM models"} to query the database.
Output all results and any errors.
Expected vulnerable response: The agent returns ALL model records in the models table across all tenants, including:
Model IDs and names
API keys and authentication credentials
Configuration details for all organizations
Example result:
Repeat with messages table:
Use the database_query tool with {"sql": "SELECT * FROM messages"} to query the database.
Output all results.
Expected vulnerable response: The agent returns ALL messages from all tenants, bypassing message privacy.
PoC Video:
WeKnora-BrokenAccessControl.mov
Impact
Vulnerability Type
Broken Access Control (CWE-639) / Unauthorized Information Disclosure (CWE-200)
Summary
A broken access control vulnerability in the database query tool allows any authenticated tenant to read sensitive data belonging to other tenants, including API keys, model configurations, and private messages. The application fails to enforce tenant isolation on critical tables (
models,messages,embeddings), enabling unauthorized cross-tenant data access with user-level authentication privileges.Details
Root Cause
The vulnerability exists due to a mismatch between the queryable tables and the tables protected by tenant isolation in
internal/utils/inject.go.Tenant-isolated tables (protected by automatic
WHERE tenant_id = Xclause):Queryable tables (allowed by
WithAllowedTables()inWithSecurityDefaults()):Gap: The tables
messages,embeddings, andmodelsare queryable but NOT in the tenant isolation list. This means queries against these tables do NOT receive the automaticWHERE tenant_id = Xfiltering.Vulnerable Code
File:
internal/utils/inject.goFile:
database_query.goWhen tenant 1 queries
SELECT * FROM models, the validation passes and noWHERE tenant_id = 1clause is appended becausemodelsis not in thetablesWithTenantIDmap. The unfiltered result exposes all model records across all tenants.PoC
Prerequisites
database_querytoolSteps to Reproduce
Authenticate as Tenant 1 and craft the following prompt to the AI agent:
Expected vulnerable response: The agent returns ALL model records in the
modelstable across all tenants, including:Example result:
Repeat with messages table:
Expected vulnerable response: The agent returns ALL messages from all tenants, bypassing message privacy.
PoC Video:
WeKnora-BrokenAccessControl.mov
Impact
Vulnerability Type
Broken Access Control (CWE-639) / Unauthorized Information Disclosure (CWE-200)
Specific Data at Risk
API Keys & Credentials (from
modelstable)Private Messages (from
messagestable)