CVE-2026-30857: Github.com/Tencent/WeKnora WeKnora Has Unauthorized Cross‑Tenant Knowledge Vulnerability

MODERATE
Advisory Identifier: GHSA-8rf9-c59g-f82f
CVSS 5.9
CWE-639
Published
Advisory Summary

CVE-2026-30857 is a MODERATE (CVSS 5.9) weknora has unauthorized cross‑tenant knowledge vulnerability (CWE-639: Authorization Bypass Through User-Controlled Key) affecting Github.com/Tencent/WeKnora libraries in the Go ecosystem. The issue involves weknora has unauthorized cross‑tenant knowledge base cloning. Remediation is available by upgrading affected packages to version 0.3.0.

CVE-2026-30857 at a Glance

CVE Identifier CVE-2026-30857
GHSA Identifier GHSA-8rf9-c59g-f82f
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-639: Authorization Bypass Through User-Controlled Key
Affected Product Github.com/Tencent/WeKnora
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.9

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

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
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-30857

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.3.0
Upgrade github.com/Tencent/WeKnora to 0.3.0
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-30857, 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.3.0), 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-639: Authorization Bypass Through User-Controlled Key, where the system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. 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 cross-tenant authorization bypass in the knowledge base copy endpoint allows any authenticated user to clone (duplicate) another tenant’s knowledge base into their own tenant by knowing/guessing the source knowledge base ID. This enables bulk data exfiltration (document/FAQ content) across tenants, making the impact critical. ### Details The `POST /api/v1/knowledge-bases/copy` endpoint enqueues an asynchronous KB clone task using the caller-supplied `source_id` without verifying ownership (see `internal/handler/knowledgebase.go`). ```go // Create KB clone payload payload := types.KBClonePayload{ TenantID: tenantID.(uint64), TaskID: taskID, SourceID: req.SourceID, // from attacker's input TargetID: req.TargetID, } payloadBytes, err := json.Marshal(payload) if err != nil { logger.Errorf(ctx, "Failed to marshal KB clone payload: %v", err) c.Error(errors.NewInternalServerError("Failed to create task")) return } // Enqueue KB clone task to Asynq task := asynq.NewTask(types.TypeKBClone, payloadBytes, asynq.TaskID(taskID), asynq.Queue("default"), asynq.MaxRetry(3)) // enqueue task info, err := h.asynqClient.Enqueue(task) if err != nil { logger.Errorf(ctx, "Failed to enqueue KB clone task: %v", err) c.Error(errors.NewInternalServerError("Failed to enqueue task")) return } ``` Then, the asynq task handler (`ProcessKBClone`) invokes the `CopyKnowledgeBase` service method to perform the clone operation (see `internal/application/service/knowledge.go`): ```go // Get source and target knowledge bases srcKB, dstKB, err := s.kbService.CopyKnowledgeBase(ctx, payload.SourceID, payload.TargetID) if err != nil { logger.Errorf(ctx, "Failed to copy knowledge base: %v", err) handleError(progress, err, "Failed to copy knowledge base configuration") return err } ``` After that, the `CopyKnowledgeBase` method calls the repository method to load the source knowledge base (see `internal/application/service/knowledgebase.go`): ```go func (s *knowledgeBaseService) CopyKnowledgeBase(ctx context.Context, srcKB string, dstKB string, ) (*types.KnowledgeBase, *types.KnowledgeBase, error) { sourceKB, err := s.repo.GetKnowledgeBaseByID(ctx, srcKB) if err != nil { logger.Errorf(ctx, "Get source knowledge base failed: %v", err) return nil, nil, err } sourceKB.EnsureDefaults() tenantID := ctx.Value(types.TenantIDContextKey).(uint64) var targetKB *types.KnowledgeBase if dstKB != "" { targetKB, err = s.repo.GetKnowledgeBaseByID(ctx, dstKB) // ... } // ... } ``` > Note: until now, the tenant ID is correctly set in context to the attacker’s tenant (from the payload), which can be used to prevent cross-tenant access. However, the repository method `GetKnowledgeBaseByID` loads knowledge bases by `id` only, allowing cross-tenant reads (see `internal/application/repository/knowledgebase.go`). ```go func (r *knowledgeBaseRepository) GetKnowledgeBaseByID(ctx context.Context, id string) (*types.KnowledgeBase, error) { var kb types.KnowledgeBase if err := r.db.WithContext(ctx).Where("id = ?", id).First(&kb).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, ErrKnowledgeBaseNotFound } return nil, err } return &kb, nil } ``` The data access layer fails to enforce tenant isolation because `GetKnowledgeBaseByID` only filters by ID and ignores the `tenant_id` present in the context. A secure implementation should enforce a tenant-scoped lookup (e.g., `WHERE id = ? AND tenant_id = ?`) or use a tenant-aware repository API to prevent cross-tenant access. Service shallow-copies the KB configuration by calling `GetKnowledgeBaseByID(ctx, srcKB)` for the source KB, then creates a new KB under the attacker’s tenant while copying fields from the victim KB (`internal/application/service/knowledgebase.go`): ```go sourceKB, err := s.repo.GetKnowledgeBaseByID(ctx, srcKB) // not tenant-scoped ... targetKB = &types.KnowledgeBase{ ID: uuid.New().String(), Name: sourceKB.Name, Type: sourceKB.Type, Description: sourceKB.Description, TenantID: tenantID, ChunkingConfig: sourceKB.ChunkingConfig, ImageProcessingConfig: sourceKB.ImageProcessingConfig, EmbeddingModelID: sourceKB.EmbeddingModelID, SummaryModelID: sourceKB.SummaryModelID, VLMConfig: sourceKB.VLMConfig, StorageConfig: sourceKB.StorageConfig, FAQConfig: faqConfig, } targetKB.EnsureDefaults() if err := s.repo.CreateKnowledgeBase(ctx, targetKB); err != nil { return nil, nil, err } } ``` ### PoC Precondition: Attacker is authenticated in Tenant A and can obtain (or guess) a victim's knowledge base UUID belonging to Tenant B. 1) Authenticate as Tenant A and obtain a bearer token or API key. 2) Start a cross-tenant clone using the victim’s knowledge base ID as `source_id`: ```bash curl -X POST http://localhost:8088/api/v1/knowledge-bases/copy \ -H "Authorization: Bearer <ATTACKER_TOKEN>" \ -H "Content-Type: application/json" \ -d '{"source_id":"<VICTIM_KB_UUID>","target_id":""}' ``` 3) Observe that the task is accepted: - HTTP `200 OK` - Response contains a `task_id` and a message like `"Knowledge base copy task started"`. 4) After the async task completes, a new knowledge base appears under Tenant A containing copied content/config from Tenant B. > Note: the copy can succeed even when models referenced by the source KB do not exist in the attacker tenant, indicating the workflow does not validate model ownership during copy. PoC Video: https://github.com/user-attachments/assets/8313fa44-5d5d-43f4-8ebd-f465c5a9d56e ### Impact This is a Broken Access Control (BOLA/IDOR) vulnerability enabling cross-tenant data exfiltration: - Any authenticated user can trigger a clone of a victim tenant’s knowledge base into their own tenant. - Results in bulk disclosure/duplication of knowledge base contents (documents/FAQ entries/chunks), plus associated configuration.

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

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

References

Frequently Asked Questions

What is CVE-2026-30857?
CVE-2026-30857 is a security vulnerability in Github.com/Tencent/WeKnora involving WeKnora has Unauthorized Cross‑Tenant Knowledge Base Cloning under CWE-639: Authorization Bypass Through User-Controlled Key.
Which Github.com/Tencent/WeKnora versions are affected?
Affected versions include releases prior to 0.3.0 across affected packages: github.com/Tencent/WeKnora.
What version fixes CVE-2026-30857?
Upgrading to 0.3.0 (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.3.0. Upgrade your dependency to 0.3.0 or later.
What is the CVSS score of CVE-2026-30857?
CVE-2026-30857 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-30857?
CVE-2026-30857 is classified under CWE-639: Authorization Bypass Through User-Controlled Key (The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.).
How can I check Go dependencies for CVE-2026-30857?
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-8rf9-c59g-f82f",
  "modified" : "2026-03-09T13:21:46Z",
  "published" : "2026-03-06T23:55:47Z",
  "aliases" : [ "CVE-2026-30857" ],
  "summary" : "WeKnora has Unauthorized Cross‑Tenant Knowledge Base Cloning",
  "details" : "### Summary\nA cross-tenant authorization bypass in the knowledge base copy endpoint allows any authenticated user to clone (duplicate) another tenant’s knowledge base into their own tenant by knowing/guessing the source knowledge base ID. This enables bulk data exfiltration (document/FAQ content) across tenants, making the impact critical.\n\n### Details\n\nThe `POST /api/v1/knowledge-bases/copy` endpoint enqueues an asynchronous KB clone task using the caller-supplied `source_id` without verifying ownership (see `internal/handler/knowledgebase.go`).\n```go\n// Create KB clone payload\npayload := types.KBClonePayload{\n  TenantID: tenantID.(uint64),\n  TaskID:   taskID,\n  SourceID: req.SourceID, // from attacker's input\n  TargetID: req.TargetID,\n}\n\npayloadBytes, err := json.Marshal(payload)\nif err != nil {\n  logger.Errorf(ctx, \"Failed to marshal KB clone payload: %v\", err)\n  c.Error(errors.NewInternalServerError(\"Failed to create task\"))\n  return\n}\n\n// Enqueue KB clone task to Asynq\ntask := asynq.NewTask(types.TypeKBClone, payloadBytes,\nasynq.TaskID(taskID), asynq.Queue(\"default\"), asynq.MaxRetry(3)) // enqueue task\ninfo, err := h.asynqClient.Enqueue(task)\nif err != nil {\n  logger.Errorf(ctx, \"Failed to enqueue KB clone task: %v\", err)\n  c.Error(errors.NewInternalServerError(\"Failed to enqueue task\"))\n  return\n}\n```\n\nThen, the asynq task handler (`ProcessKBClone`) invokes the `CopyKnowledgeBase` service method to perform the clone operation (see `internal/application/service/knowledge.go`):\n\n```go\n// Get source and target knowledge bases\nsrcKB, dstKB, err := s.kbService.CopyKnowledgeBase(ctx, payload.SourceID, payload.TargetID)\nif err != nil {\n    logger.Errorf(ctx, \"Failed to copy knowledge base: %v\", err)\n    handleError(progress, err, \"Failed to copy knowledge base configuration\")\n    return err\n}\n```\n\nAfter that, the `CopyKnowledgeBase` method calls the repository method to load the source knowledge base (see `internal/application/service/knowledgebase.go`):\n\n```go\nfunc (s *knowledgeBaseService) CopyKnowledgeBase(ctx context.Context,\n\tsrcKB string, dstKB string,\n) (*types.KnowledgeBase, *types.KnowledgeBase, error) {\n\tsourceKB, err := s.repo.GetKnowledgeBaseByID(ctx, srcKB)\n\tif err != nil {\n\t\tlogger.Errorf(ctx, \"Get source knowledge base failed: %v\", err)\n\t\treturn nil, nil, err\n\t}\n\tsourceKB.EnsureDefaults()\n\ttenantID := ctx.Value(types.TenantIDContextKey).(uint64)\n\tvar targetKB *types.KnowledgeBase\n\tif dstKB != \"\" {\n\t\ttargetKB, err = s.repo.GetKnowledgeBaseByID(ctx, dstKB)\n        // ...\n    }\n    // ...\n}\n```\n\n\n> Note: until now, the tenant ID is correctly set in context to the attacker’s tenant (from the payload), which can be used to prevent cross-tenant access.\n\nHowever, the repository method `GetKnowledgeBaseByID` loads knowledge bases by `id` only, allowing cross-tenant reads (see `internal/application/repository/knowledgebase.go`).\n\n```go\nfunc (r *knowledgeBaseRepository) GetKnowledgeBaseByID(ctx context.Context, id string) (*types.KnowledgeBase, error) {\n\tvar kb types.KnowledgeBase\n\tif err := r.db.WithContext(ctx).Where(\"id = ?\", id).First(&kb).Error; err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\treturn nil, ErrKnowledgeBaseNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn &kb, nil\n}\n```\n\nThe data access layer fails to enforce tenant isolation because `GetKnowledgeBaseByID` only filters by ID and ignores the `tenant_id` present in the context. A secure implementation should enforce a tenant-scoped lookup (e.g., `WHERE id = ? AND tenant_id = ?`) or use a tenant-aware repository API to prevent cross-tenant access.\n\nService shallow-copies the KB configuration by calling `GetKnowledgeBaseByID(ctx, srcKB)` for the source KB, then creates a new KB under the attacker’s tenant while copying fields from the victim KB (`internal/application/service/knowledgebase.go`):\n\n```go\nsourceKB, err := s.repo.GetKnowledgeBaseByID(ctx, srcKB) // not tenant-scoped\n...\ntargetKB = &types.KnowledgeBase{\n    ID:                    uuid.New().String(),\n    Name:                  sourceKB.Name,\n    Type:                  sourceKB.Type,\n    Description:           sourceKB.Description,\n    TenantID:              tenantID,\n    ChunkingConfig:        sourceKB.ChunkingConfig,\n    ImageProcessingConfig: sourceKB.ImageProcessingConfig,\n    EmbeddingModelID:      sourceKB.EmbeddingModelID,\n    SummaryModelID:        sourceKB.SummaryModelID,\n    VLMConfig:             sourceKB.VLMConfig,\n    StorageConfig:         sourceKB.StorageConfig,\n    FAQConfig:             faqConfig,\n}\ntargetKB.EnsureDefaults()\n  if err := s.repo.CreateKnowledgeBase(ctx, targetKB); err != nil {\n      return nil, nil, err\n  }\n}\n```\n\n### PoC\n\nPrecondition: Attacker is authenticated in Tenant A and can obtain (or guess) a victim's knowledge base UUID belonging to Tenant B.\n\n1) Authenticate as Tenant A and obtain a bearer token or API key.\n\n2) Start a cross-tenant clone using the victim’s knowledge base ID as `source_id`:\n\n```bash\ncurl -X POST http://localhost:8088/api/v1/knowledge-bases/copy \\\n  -H \"Authorization: Bearer <ATTACKER_TOKEN>\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"source_id\":\"<VICTIM_KB_UUID>\",\"target_id\":\"\"}'\n```\n\n3) Observe that the task is accepted:\n- HTTP `200 OK`\n- Response contains a `task_id` and a message like `\"Knowledge base copy task started\"`.\n\n4) After the async task completes, a new knowledge base appears under Tenant A containing copied content/config from Tenant B.\n\n> Note: the copy can succeed even when models referenced by the source KB do not exist in the attacker tenant, indicating the workflow does not validate model ownership during copy.\n\nPoC Video:\n\nhttps://github.com/user-attachments/assets/8313fa44-5d5d-43f4-8ebd-f465c5a9d56e\n\n### Impact\n\nThis is a Broken Access Control (BOLA/IDOR) vulnerability enabling cross-tenant data exfiltration:\n\n- Any authenticated user can trigger a clone of a victim tenant’s knowledge base into their own tenant.\n- Results in bulk disclosure/duplication of knowledge base contents (documents/FAQ entries/chunks), plus associated configuration.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/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.3.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.2.14"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Tencent/WeKnora/security/advisories/GHSA-8rf9-c59g-f82f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-30857"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Tencent/WeKnora"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-639" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-06T23:55:47Z",
    "nvd_published_at" : "2026-03-07T17:15:53Z"
  }
}