CVE-2026-30859: Github.com/Tencent/WeKnora WeKnora Has Broken Access Control Vulnerability

HIGH
Advisory Identifier: GHSA-2f4c-vrjq-rcgv
CVSS 7.5
CWE-284
Published
Advisory Summary

CVE-2026-30859 is a HIGH (CVSS 7.5) weknora has broken access control vulnerability (CWE-284: Improper Access Control) affecting Github.com/Tencent/WeKnora libraries in the Go ecosystem. The issue involves weknora has broken access control - cross-tenant data exposure. Remediation is available by upgrading affected packages to version 0.2.12.

CVE-2026-30859 at a Glance

CVE Identifier CVE-2026-30859
GHSA Identifier GHSA-2f4c-vrjq-rcgv
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-284: Improper Access Control
Affected Product Github.com/Tencent/WeKnora
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-30859

To remediate this vulnerability, upgrade all affected Github.com/Tencent/WeKnora dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/Tencent/WeKnora fixed: 0.2.12
Upgrade github.com/Tencent/WeKnora to 0.2.12
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/Tencent/WeKnora

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-30859, inspect your project dependencies for Github.com/Tencent/WeKnora:

inspect dependencies for github.com/Tencent/WeKnora

Analyze the terminal output to locate any version of Github.com/Tencent/WeKnora in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.12), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In Github.com/Tencent/WeKnora, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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 = X` clause): ``` tenants, knowledge_bases, knowledges, sessions, chunks ``` **Queryable tables** (allowed by `WithAllowedTables()` in `WithSecurityDefaults()`): ``` tenants, knowledge_bases, knowledges, sessions, messages, chunks, embeddings, models ``` **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. ### Vulnerable Code **File: `internal/utils/inject.go`** ```go func WithTenantIsolation(tenantID uint64, tables ...string) SQLValidationOption { return func(v *sqlValidator) { v.enableTenantInjection = true v.tenantID = tenantID v.tablesWithTenantID = make(map[string]bool) if len(tables) == 0 { // Default tables with tenant_id - MISSING: messages, embeddings, models v.tablesWithTenantID = map[string]bool{ "tenants": true, "knowledge_bases": true, "knowledges": true, "sessions": true, "chunks": true, } } else { for _, table := range tables { v.tablesWithTenantID[strings.ToLower(table)] = true } } } } func WithSecurityDefaults(tenantID uint64) SQLValidationOption { return func(v *sqlValidator) { // ... other validations ... WithTenantIsolation(tenantID)(v) // Default allowed tables - INCLUDES unprotected tables WithAllowedTables( "tenants", "knowledge_bases", "knowledges", "sessions", "messages", // ← No tenant isolation "chunks", "embeddings", // ← No tenant isolation "models", // ← No tenant isolation )(v) } } ``` **File: `database_query.go`** ```go func (t *DatabaseQueryTool) validateAndSecureSQL(sqlQuery string, tenantID uint64) (string, error) { securedSQL, validationResult, err := utils.ValidateAndSecureSQL( sqlQuery, utils.WithSecurityDefaults(tenantID), utils.WithInjectionRiskCheck(), ) // ... validation logic ... return securedSQL, nil } ``` When 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. --- ## PoC ### Prerequisites - Access to the AI application as an authenticated tenant - Ability to send prompts that invoke the `database_query` tool ### Steps to Reproduce 1. **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. ``` 2. **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: <img width="864" height="1150" alt="image" src="https://github.com/user-attachments/assets/01e3d0ba-0f2a-43ab-ab51-8778fb8a79b1" /> 3. **Repeat with messages table**: ``` Use the database_query tool with {"sql": "SELECT * FROM messages"} to query the database. Output all results. ``` 4. **Expected vulnerable response**: The agent returns ALL messages from all tenants, bypassing message privacy. --- PoC Video: https://github.com/user-attachments/assets/056984e8-1700-41fe-9b8a-6d18d5579c18 --- ## Impact ### Vulnerability Type **Broken Access Control (CWE-639)** / **Unauthorized Information Disclosure (CWE-200)** ### Specific Data at Risk 1. **API Keys & Credentials** (from `models` table) - Third-party LLM provider keys (OpenAI, Anthropic, etc.) - Database credentials and connection strings - Authentication tokens for integrated services 2. **Private Messages** (from `messages` table) - Confidential business communications - User conversations with AI agents - Sensitive information shared within conversations

CVE-2026-30859 Affected Github.com/Tencent/WeKnora Versions

1 component(s)
Fixed Versions:
0.2.12
Product / Package Ecosystem Affected Versions Fixed Version
github.com/Tencent/WeKnora
Go
< 0.2.12
0.2.12

References

Frequently Asked Questions

What is CVE-2026-30859?
CVE-2026-30859 is a security vulnerability in Github.com/Tencent/WeKnora involving WeKnora has Broken Access Control - Cross-Tenant Data Exposure under CWE-284: Improper Access Control.
Which Github.com/Tencent/WeKnora versions are affected?
Affected versions include releases prior to 0.2.12 across affected packages: github.com/Tencent/WeKnora.
What version fixes CVE-2026-30859?
Upgrading to 0.2.12 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/Tencent/WeKnora affected?
Yes, github.com/Tencent/WeKnora is affected in releases prior to 0.2.12. Upgrade your dependency to 0.2.12 or later.
What is the CVSS score of CVE-2026-30859?
CVE-2026-30859 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-30859?
CVE-2026-30859 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check Go dependencies for CVE-2026-30859?
Run the dependency tree command: 'inspect dependencies for github.com/Tencent/WeKnora'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2f4c-vrjq-rcgv",
  "modified" : "2026-03-09T13:20:28Z",
  "published" : "2026-03-06T23:57:20Z",
  "aliases" : [ "CVE-2026-30859" ],
  "summary" : "WeKnora has Broken Access Control - Cross-Tenant Data Exposure",
  "details" : "## 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",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/Tencent/WeKnora"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2.12"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.2.11"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Tencent/WeKnora/security/advisories/GHSA-2f4c-vrjq-rcgv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-30859"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Tencent/WeKnora"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-06T23:57:20Z",
    "nvd_published_at" : "2026-03-07T17:15:53Z"
  }
}