GHSA-2F4C-VRJQ-RCGV

Vulnerability from github – Published: 2026-03-06 23:57 – Updated: 2026-03-09 13:20
VLAI
Summary
WeKnora has Broken Access Control - Cross-Tenant Data Exposure
Details

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

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

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:

  3. Model IDs and names
  4. API keys and authentication credentials
  5. Configuration details for all organizations

Example result:

image

  1. Repeat with messages table: Use the database_query tool with {"sql": "SELECT * FROM messages"} to query the database. Output all results.

  2. 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)
  2. Third-party LLM provider keys (OpenAI, Anthropic, etc.)
  3. Database credentials and connection strings
  4. Authentication tokens for integrated services

  5. Private Messages (from messages table)

  6. Confidential business communications
  7. User conversations with AI agents
  8. Sensitive information shared within conversations
Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 0.2.11"
      },
      "package": {
        "ecosystem": "Go",
        "name": "github.com/Tencent/WeKnora"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.2.12"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-30859"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-284"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-03-06T23:57:20Z",
    "nvd_published_at": "2026-03-07T17:15:53Z",
    "severity": "HIGH"
  },
  "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\",           // \u2190 No tenant isolation\n\t\t\t\"chunks\",\n\t\t\t\"embeddings\",         // \u2190 No tenant isolation\n\t\t\t\"models\",             // \u2190 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\u003cimg width=\"864\" height=\"1150\" alt=\"image\" src=\"https://github.com/user-attachments/assets/01e3d0ba-0f2a-43ab-ab51-8778fb8a79b1\" /\u003e\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 \u0026 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",
  "id": "GHSA-2f4c-vrjq-rcgv",
  "modified": "2026-03-09T13:20:28Z",
  "published": "2026-03-06T23:57:20Z",
  "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "WeKnora has Broken Access Control - Cross-Tenant Data Exposure"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.