/

CVE-2026-112306

Severity:

HIGH RISK

(7.2)

SQL Injection (CWE-89) in NocoBase Collection Plugin

CVE-2026-112306

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized database access and sensitive information disclosure

Severity:

HIGH RISK

(7.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

NocoBase's collection SQL plugin can allow privileged users to store SQL that bypasses the intended checkSQL() validation through the sqlCollection:setFields action. When the affected collection query is reloaded, the stored statements may execute and expose sensitive database information or read server-side files.

NocoBase's collection SQL plugin can allow privileged users to store SQL that bypasses the intended checkSQL() validation through the sqlCollection:setFields action. When the affected collection query is reloaded, the stored statements may execute and expose sensitive database information or read server-side files.

Affected context

The vulnerability occurs in NocoBase deployments using the @nocobase/plugin-collection-sql component through version 2.2.28. It requires a collection configured to use SQL and a workflow in which a user with sufficient privileges can modify the collection's SQL definition through the sqlCollection:setFields action.

The vulnerability occurs in NocoBase deployments using the @nocobase/plugin-collection-sql component through version 2.2.28. It requires a collection configured to use SQL and a workflow in which a user with sufficient privileges can modify the collection's SQL definition through the sqlCollection:setFields action.

Exploit preconditions

  • Attack surface: The NocoBase collection SQL plugin and its collection field-management action
  • Required access: A privileged account or possession of the relevant collection-sql snippet
  • Trigger point: Reloading or otherwise executing the modified collection query
  • Why exploitation is possible: SQL supplied through the affected action may bypass checkSQL() validation and remain stored for later execution
  • Attack surface: The NocoBase collection SQL plugin and its collection field-management action
  • Required access: A privileged account or possession of the relevant collection-sql snippet
  • Trigger point: Reloading or otherwise executing the modified collection query
  • Why exploitation is possible: SQL supplied through the affected action may bypass checkSQL() validation and remain stored for later execution

Why this happens

The underlying flaw is insufficient validation and trust-boundary enforcement for SQL supplied through the sqlCollection:setFields action. A security check intended to reject dangerous statements can be bypassed, allowing attacker-controlled SQL to be persisted as a collection query and executed later. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.

The underlying flaw is insufficient validation and trust-boundary enforcement for SQL supplied through the sqlCollection:setFields action. A security check intended to reject dangerous statements can be bypassed, allowing attacker-controlled SQL to be persisted as a collection query and executed later. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.

Potential impact

  • An attacker may read database metadata or credential-related records such as PostgreSQL password hashes.
  • An attacker could invoke database functions capable of reading files from the database server.
  • Sensitive application data may be disclosed, altered, or deleted.
  • Database integrity and the confidentiality of connected services could be affected.
  • An attacker may read database metadata or credential-related records such as PostgreSQL password hashes.
  • An attacker could invoke database functions capable of reading files from the database server.
  • Sensitive application data may be disclosed, altered, or deleted.
  • Database integrity and the confidentiality of connected services could be affected.

General mitigation guidance

Mitigation generally focuses on preventing user-controlled SQL from becoming executable database logic.

Common defensive patterns include:

  • Prefer predefined, parameterized query operations over accepting raw SQL text.
  • Apply allowlist-based parsing and validation at every action that can create or modify SQL.
  • Keep validation adjacent to execution and avoid relying solely on checks performed during initial storage.
  • Restrict collection SQL administration to the smallest practical set of trusted roles.
  • Use database accounts with least-privilege permissions and limit access to sensitive functions and system catalogs.
  • Separate application data access from capabilities that can read server-side files.

Mitigation generally focuses on preventing user-controlled SQL from becoming executable database logic.

Common defensive patterns include:

  • Prefer predefined, parameterized query operations over accepting raw SQL text.
  • Apply allowlist-based parsing and validation at every action that can create or modify SQL.
  • Keep validation adjacent to execution and avoid relying solely on checks performed during initial storage.
  • Restrict collection SQL administration to the smallest practical set of trusted roles.
  • Use database accounts with least-privilege permissions and limit access to sensitive functions and system catalogs.
  • Separate application data access from capabilities that can read server-side files.

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings where request or action parameters flow into SQL construction or execution.
  • Code-review signals involving bypassable validation helpers, raw SQL persistence, or validation performed only before storage.
  • Audit events for sqlCollection:setFields, collection SQL changes, and unexpected query reloads.
  • Database monitoring alerts for access to PostgreSQL system catalogs, password-hash data, file-reading functions, or unusual administrative statements.
  • Policy enforcement that blocks raw SQL configuration unless it passes strict allowlists and receives elevated review.

Organizations can look for:

  • Static-analysis findings where request or action parameters flow into SQL construction or execution.
  • Code-review signals involving bypassable validation helpers, raw SQL persistence, or validation performed only before storage.
  • Audit events for sqlCollection:setFields, collection SQL changes, and unexpected query reloads.
  • Database monitoring alerts for access to PostgreSQL system catalogs, password-hash data, file-reading functions, or unusual administrative statements.
  • Policy enforcement that blocks raw SQL configuration unless it passes strict allowlists and receives elevated review.

Sources

SourceLink
github.comgithub.com/nocobase/nocobase
github.comgithub.com/nocobase/nocobase/blob/v2.2.28/packages/plugins/@nocobase/plugin-collection-sql/src/server/resources/sql.ts#L14-L104
github.comgithub.com/nocobase/nocobase/issues/10629
vulncheck.comvulncheck.com/advisories/nocobase-plugin-collection-sql-through-2.2.28-sql-injection-via-sqlcollection-setfields

Frequently asked

questions

It may be exploitable through the NocoBase application interface when an attacker has an authenticated role capable of modifying SQL collection definitions. The exact exposure depends on application permissions and network access.

Yes, the described attack path requires a privileged user account or access to the relevant collection-sql snippet and action. Lower-privileged users may still be at risk if permissions are misconfigured.

Avoid treating user-provided SQL as trusted executable logic. Use parameterized or predefined queries, enforce strict allowlists, and validate SQL both when it is stored and immediately before execution.

Apply least privilege to collection administration and database accounts, monitor SQL-definition changes, review all validation bypass paths, and enforce secure query-construction policies through code review and automated analysis.

It may be exploitable through the NocoBase application interface when an attacker has an authenticated role capable of modifying SQL collection definitions. The exact exposure depends on application permissions and network access.

Yes, the described attack path requires a privileged user account or access to the relevant collection-sql snippet and action. Lower-privileged users may still be at risk if permissions are misconfigured.

Avoid treating user-provided SQL as trusted executable logic. Use parameterized or predefined queries, enforce strict allowlists, and validate SQL both when it is stored and immediately before execution.

Apply least privilege to collection administration and database accounts, monitor SQL-definition changes, review all validation bypass paths, and enforce secure query-construction policies through code review and automated analysis.

Find out what's already
exploitable in your codebase.