CVE-2026-108821 Overview
CVE-2026-108821 is a SQL injection vulnerability in Tencent WeKnora up to version 0.8.1. The flaw resides in the validateSubquery function within internal/utils/inject.go, which is part of the SQL Validator component. An authenticated attacker can manipulate input to bypass validation and inject malicious SQL statements remotely. The issue has been assigned [CWE-74] for improper neutralization of special elements in output used by a downstream component. The exploit has been publicly disclosed, increasing exposure risk for unpatched deployments. Tencent addressed the vulnerability in WeKnora v0.8.2 via commit d7ccd5ba517cc3968e6d5000a2ab0f4b51ef1dda.
Critical Impact
Remote authenticated attackers can inject SQL statements through the SQL Validator, potentially exposing or altering data in the WeKnora backend database.
Affected Products
- Tencent WeKnora versions up to and including 0.8.1
- Component: SQL Validator (internal/utils/inject.go)
- Function: validateSubquery
Discovery Timeline
- 2026-10-12 - CVE-2026-108821 published to the National Vulnerability Database (NVD)
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2026-108821
Vulnerability Analysis
WeKnora is Tencent's retrieval-augmented generation (RAG) framework. The validateSubquery function in internal/utils/inject.go is intended to reject hostile SQL constructs before queries reach the database driver. The validator's logic can be bypassed, allowing attacker-controlled input to flow into executed SQL statements. Because the vulnerability sits in a validator rather than a query builder, successful bypass undermines a security control that other code paths depend on.
The attack is launched over the network and requires low privileges, meaning any authenticated tenant with query access to the affected endpoint can attempt exploitation. A detailed bypass write-up and a proof-of-concept gist have been published publicly, so reliable exploit knowledge exists in the wild.
Root Cause
The root cause is insufficient neutralization of special elements inside subquery validation ([CWE-74]). validateSubquery applies pattern-based checks that fail to normalize crafted payloads before matching, allowing attackers to smuggle disallowed SQL tokens past the filter and into the executed statement.
Attack Vector
Exploitation requires network reachability to the WeKnora API and a valid low-privileged account. The attacker submits a request containing a crafted SQL fragment that defeats validateSubquery. Once the fragment reaches the downstream SQL execution path, it is interpreted as part of the query, resulting in unauthorized read, write, or logical bypass against the backing database.
# Security patch excerpt (.env.example)
# Fix: align client sessions and integration request handling (#3305)
-JWT_SECRET=weknora-jwt-secret
+# Generate once: openssl rand -hex 32
+JWT_SECRET=
-SYSTEM_AES_KEY=weknora-system-aes-key-32bytes!!
+# Generate once: openssl rand -hex 16 (32 ASCII bytes); retain existing keys on upgrade.
+SYSTEM_AES_KEY=
+# Optional independent signing key for embed sessions and presigned URLs.
+SYSTEM_SIGNING_KEY=
Source: WeKnora GitHub Commit d7ccd5b
Detection Methods for CVE-2026-108821
Indicators of Compromise
- Unexpected API requests containing nested SELECT, UNION, or comment sequences (--, /*) targeting WeKnora query endpoints that invoke validateSubquery.
- Database audit log entries showing queries with unusual column counts, boolean tautologies, or references to system catalogs originating from the WeKnora service account.
- Error responses from the WeKnora API indicating SQL parsing or driver errors, suggesting payload probing.
Detection Strategies
- Enable query logging on the backing database and alert on statements issued by the WeKnora service user that reference system tables or information_schema.
- Deploy a web application firewall rule set in front of WeKnora that flags SQL injection patterns in JSON request bodies and query parameters.
- Correlate authentication logs with API request logs to identify low-privileged accounts generating anomalous query volumes.
Monitoring Recommendations
- Monitor the WeKnora container or binary for outbound database traffic spikes that deviate from baseline RAG workloads.
- Track response status distributions on query APIs; a surge in 500-class errors can indicate injection probing against validateSubquery.
- Review public exploit documentation referenced in the WeKnora SQL Bypass Documentation to build matching detection signatures.
How to Mitigate CVE-2026-108821
Immediate Actions Required
- Upgrade all WeKnora deployments to version 0.8.2 or later, which includes commit d7ccd5ba517cc3968e6d5000a2ab0f4b51ef1dda.
- Rotate any shared secrets such as JWT_SECRET and SYSTEM_AES_KEY that may have been exposed through injected queries.
- Audit database contents and WeKnora tenant records for signs of unauthorized modification since the vulnerable version was deployed.
Patch Information
Tencent released the fix in WeKnora v0.8.2. The code change is tracked in Pull Request #3305 and commit d7ccd5ba517cc3968e6d5000a2ab0f4b51ef1dda. Additional CVE metadata is available at VulDB CVE-2026-108821.
Workarounds
- Restrict network access to WeKnora query endpoints using firewall rules or reverse-proxy allowlists until patching is complete.
- Disable or tighten access for low-privileged tenant accounts that are not required for business operations.
- Place WeKnora behind a web application firewall with SQL injection signatures enabled to reduce exposure during the upgrade window.
# Upgrade WeKnora to the patched release
git fetch --tags
git checkout v0.8.2
# Regenerate secrets after upgrade (per patched .env.example guidance)
export JWT_SECRET=$(openssl rand -hex 32)
export SYSTEM_AES_KEY=$(openssl rand -hex 16)
export SYSTEM_SIGNING_KEY=$(openssl rand -hex 32)
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

