/

CVE-2026-52887

Severity:

CRITICAL RISK

(10.0)

SQL Injection (CWE-89) in NocoBase In-App Messages

CVE-2026-52887

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Remote Code Execution via Database SQL Injection

Severity:

CRITICAL RISK

(10.0)

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

A SQL injection flaw in NocoBase's in-app notification plugin allows attacker-controlled filter values to be embedded directly into a Sequelize literal query.

An authenticated user can exploit this to run stacked PostgreSQL statements, which may lead to arbitrary command execution via features like COPY ... TO PROGRAM in vulnerable deployments.

Affected context

The vulnerability occurs in NocoBase deployments that expose the in-app message notification API endpoint GET /api/myInAppChannels:list and rely on Sequelize for PostgreSQL queries.

Risk is present when user-provided filter parameters, particularly filter[latestMsgReceiveTimestamp][$lt], are treated as trusted input and interpolated into raw SQL expressions without escaping or parameterization.

Exploit preconditions

  • Attack surface: HTTP API endpoint GET /api/myInAppChannels:list in the in-app notification plugin
  • Required access: Authenticated user with the ability to call the endpoint and supply filter[latestMsgReceiveTimestamp][$lt]
  • Trigger point: Construction of a Sequelize.literal() expression using the unescaped filter value in SQL templates
  • Why exploitation is possible: The filter value is concatenated directly into SQL, enabling injection of stacked statements on PostgreSQL, including potentially dangerous constructs like COPY ... TO PROGRAM where supported and permitted

Why this happens

The root cause is a classic SQL injection pattern: untrusted user input is concatenated into SQL query text without parameter binding.

In this case, Sequelize's literal() function is used to build a raw SQL fragment with a template string, and the filter[latestMsgReceiveTimestamp][$lt] parameter is inserted verbatim.

This aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command, where the application fails to properly neutralize or separate data from control in SQL statements.

Potential impact

  • Authenticated users may inject arbitrary SQL commands into the underlying PostgreSQL database
  • Attackers could read, modify, or delete application data stored in the database
  • In environments where PostgreSQL is configured with sufficient privileges, attackers may execute OS-level commands using COPY ... TO PROGRAM
  • Compromise of application integrity and potential lateral movement to other services connected to the database

General mitigation guidance

Effective mitigation focuses on removing direct string interpolation from SQL construction and enforcing strict separation of data and control.

Recommended defensive patterns include:

  • Using parameterized queries or query builders instead of raw SQL literals for all user-supplied values
  • Avoiding Sequelize.literal() for dynamic parts of queries that depend on client input
  • Applying strict validation and normalization on filter parameters, restricting them to expected formats and value ranges
  • Running database accounts with least privilege so that high-risk features (such as COPY ... TO PROGRAM) are not available to the application user
  • Adopting secure-by-default query APIs and disabling features that allow stacked statements or command execution where possible

How teams detect issues like this

Detection commonly combines static, review-based, and runtime approaches:

  • Static analysis rules that flag the use of raw SQL construction (e.g., literal() or string concatenation) with variables derived from HTTP request parameters
  • Code review practices that specifically scrutinize query-building logic in controller and service layers, looking for unparameterized filters and literals
  • Centralized security policies that discourage or forbid direct use of raw SQL helpers in high-level application code, requiring safer abstractions
  • Optional use of automated code scanning tools with checks for CWE-89 patterns in JavaScript/TypeScript and ORM usage

Sources

SourceLink
github.comgithub.com/nocobase/nocobase/commit/68d64e3fcfb8be2ae4f3bfc9e1ee3f85b87c89ce
github.comgithub.com/nocobase/nocobase/releases/tag/v2.0.61
github.comgithub.com/nocobase/nocobase/security/advisories/GHSA-p849-8hwh-84j9

Frequently asked

questions

Exploitation is limited to authenticated users who can reach the affected API endpoint, but within that scope it can be extremely powerful, especially if the database user has broad privileges.

An attacker needs a valid NocoBase account that can call GET /api/myInAppChannels:list and supply crafted filter parameters. No direct database access is required; all interaction occurs through the application.

The safest pattern is to eliminate raw SQL string interpolation for request-driven values and use parameterized queries or ORM-level operators, combined with strict validation of filter inputs and least-privilege database accounts.

Establish coding standards that prohibit unparameterized SQL construction, enforce automated checks for CWE-89 patterns in CI, prefer high-level ORM APIs over raw SQL helpers, and include security review steps for any query-building logic exposed to user-controlled input.

Find out what's already
exploitable in your codebase.