{"id":"CVE-2026-30859","aliases":["CVE-2026-30859","GHSA-2f4c-vrjq-rcgv","GO-2026-4637"],"related":[],"kind":"vulnerability","state":"published","title":"WeKnora: Broken Access Control - Cross-Tenant Data Exposure","summary":"WeKnora is an LLM-powered framework designed for deep document understanding and semantic retrieval. Prior to version 0.2.12, 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. This issue has been patched in version 0.2.12.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"WeKnora is an LLM-powered framework designed for deep document understanding and semantic retrieval. Prior to version 0.2.12, 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. This issue has been patched in version 0.2.12.","source":"cvelist"},{"lang":"en","text":"## Summary\nA 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.\n\n---\n\n## Details\n\n### Root Cause\nThe vulnerability exists due to a mismatch between the queryable tables and the tables protected by tenant isolation in `internal/utils/inject.go`.\n\n**Tenant-isolated tables** (protected by automatic `WHERE tenant_id = X` clause):\n```\ntenants, knowledge_bases, knowledges, sessions, chunks\n```\n\n**Queryable tables** (allowed by `WithAllowedTables()` in `WithSecurityDefaults()`):\n```\ntenants, knowledge_bases, knowledges, sessions, messages, chunks, embeddings, models\n```\n\n**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.\n\n### Vulnerable Code\n\n**File: `internal/utils/inject.go`**\n\n```go\nfunc WithTenantIsolation(tenantID uint64, tables ...string) SQLValidationOption {\n\treturn func(v *sqlValidator) {\n\t\tv.enableTenantInjection = true\n\t\tv.tenantID = tenantID\n\t\tv.tablesWithTenantID = make(map[string]bool)\n\t\tif len(tables) == 0 {\n\t\t\t// Default tables with tenant_id - MISSING: messages, embeddings, models\n\t\t\tv.tablesWithTenantID = map[string]bool{\n\t\t\t\t\"tenants\":         true,\n\t\t\t\t\"knowledge_bases\": true,\n\t\t\t\t\"knowledges\":      true,\n\t\t\t\t\"sessions\":        true,\n\t\t\t\t\"chunks\":          true,\n\t\t\t}\n\t\t} else {\n\t\t\tfor _, table := range tables {\n\t\t\t\tv.tablesWithTenantID[strings.ToLower(table)] = true\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc WithSecurityDefaults(tenantID uint64) SQLValidationOption {\n\treturn func(v *sqlValidator) {\n\t\t// ... other validations ...\n\t\tWithTenantIsolation(tenantID)(v)\n\n\t\t// Default allowed tables - INCLUDES unprotected tables\n\t\tWithAllowedTables(\n\t\t\t\"tenants\",\n\t\t\t\"knowledge_bases\",\n\t\t\t\"knowledges\",\n\t\t\t\"sessions\",\n\t\t\t\"messages\",           // ← No tenant isolation\n\t\t\t\"chunks\",\n\t\t\t\"embeddings\",         // ← No tenant isolation\n\t\t\t\"models\",             // ← No tenant isolation\n\t\t)(v)\n\t}\n}\n```\n\n**File: `database_query.go`**\n\n```go\nfunc (t *DatabaseQueryTool) validateAndSecureSQL(sqlQuery string, tenantID uint64) (string, error) {\n\tsecuredSQL, validationResult, err := utils.ValidateAndSecureSQL(\n\t\tsqlQuery,\n\t\tutils.WithSecurityDefaults(tenantID),\n\t\tutils.WithInjectionRiskCheck(),\n\t)\n\t// ... validation logic ...\n\treturn securedSQL, nil\n}\n```\n\nWhen tenant 1 queries `SELECT * FROM models`, the validation passes and **no** `WHERE tenant_id = 1` clause is appended because `models` is not in the `tablesWithTenantID` map. The unfiltered result exposes all model records across all tenants.\n\n---\n\n## PoC\n\n### Prerequisites\n- Access to the AI application as an authenticated tenant\n- Ability to send prompts that invoke the `database_query` tool\n\n### Steps to Reproduce\n\n1. **Authenticate as Tenant 1** and craft the following prompt to the AI agent:\n   ```\n   Use the database_query tool with {\"sql\": \"SELECT * FROM models\"} to query the database. \n   Output all results and any errors.\n   ```\n\n2. **Expected vulnerable response**: The agent returns ALL model records in the `models` table across all tenants, including:\n   - Model IDs and names\n   - API keys and authentication credentials\n   - Configuration details for all organizations\n\nExample result:\n\n<img width=\"864\" height=\"1150\" alt=\"image\" src=\"https://github.com/user-attachments/assets/01e3d0ba-0f2a-43ab-ab51-8778fb8a79b1\" />\n\n3. **Repeat with messages table**:\n   ```\n   Use the database_query tool with {\"sql\": \"SELECT * FROM messages\"} to query the database. \n   Output all results.\n   ```\n\n4. **Expected vulnerable response**: The agent returns ALL messages from all tenants, bypassing message privacy.\n\n---\n\nPoC Video:\n\nhttps://github.com/user-attachments/assets/056984e8-1700-41fe-9b8a-6d18d5579c18\n\n---\n\n## Impact\n\n### Vulnerability Type\n**Broken Access Control (CWE-639)** / **Unauthorized Information Disclosure (CWE-200)**\n\n### Specific Data at Risk\n1. **API Keys & Credentials** (from `models` table)\n   - Third-party LLM provider keys (OpenAI, Anthropic, etc.)\n   - Database credentials and connection strings\n   - Authentication tokens for integrated services\n\n2. **Private Messages** (from `messages` table)\n   - Confidential business communications\n   - User conversations with AI agents\n   - Sensitive information shared within conversations","format":"markdown","source":"ghsa"},{"lang":"en","text":"WeKnora has Broken Access Control - Cross-Tenant Data Exposure in github.com/Tencent/WeKnora","format":"markdown","source":"go"},{"lang":"es","text":"WeKnora es un framework impulsado por LLM diseñado para la comprensión profunda de documentos y la recuperación semántica. Antes de la versión 0.2.12, una vulnerabilidad de control de acceso roto en la herramienta de consulta de la base de datos permite a cualquier inquilino autenticado leer datos sensibles pertenecientes a otros inquilinos, incluyendo claves de API, configuraciones de modelos y mensajes privados. La aplicación no logra aplicar el aislamiento de inquilinos en tablas críticas (modelos, mensajes, embeddings), lo que permite el acceso no autorizado a datos entre inquilinos con privilegios de autenticación a nivel de usuario. Este problema ha sido parcheado en la versión 0.2.12.","source":"nvd"}],"published":"2026-03-06T23:57:20.000Z","modified":"2026-06-17T10:33:02.907Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-284"],"affected":[{"ranges":[{"version":"< 0.2.12","status":"affected"}],"vendor":"Tencent","product":"WeKnora","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.2.12"}],"ecosystem":"Go","package":"github.com/Tencent/WeKnora","purl":"pkg:golang/github.com/Tencent/WeKnora","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/Tencent/WeKnora","purl":"pkg:golang/github.com/Tencent/WeKnora","source":"go"},{"ranges":[{"status":"affected","fixed":"0.2.12"}],"vendor":"tencent","product":"weknora","cpe":"cpe:2.3:a:tencent:weknora:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/Tencent/WeKnora/security/advisories/GHSA-2f4c-vrjq-rcgv","tags":["advisory","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-30859","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/Tencent/WeKnora","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-03-09T17:52:16.344Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-30859","url":"https://www.cve.org/CVERecord?id=CVE-2026-30859","licence":"CVE Terms of Use","modified":"2026-03-09T18:24:14.545Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-2f4c-vrjq-rcgv","url":"https://github.com/advisories/GHSA-2f4c-vrjq-rcgv","licence":"CC-BY-4.0","modified":"2026-03-23T04:55:59.451Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-4637","url":"https://pkg.go.dev/vuln/GO-2026-4637","licence":"CC-BY-4.0","modified":"2026-03-23T04:52:47.828Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-30859","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-30859","licence":"Public domain","modified":"2026-06-17T10:33:02.907Z"}],"updatedAt":"2026-11-25T22:59:15.487Z","epss":{"score":0.00239,"percentile":0.16042,"date":"2026-12-01T12:00:22.000Z"}}