Aug 1, 2026·7 min read·81 visits
SQL injection via Sequelize.literal in NocoBase's in-app message plugin allows authenticated attackers to execute stacked queries and achieve OS command execution via PostgreSQL.
A critical SQL injection vulnerability exists in the @nocobase/plugin-notification-in-app-message plugin of NocoBase prior to version 2.0.61. The flaw is caused by direct string interpolation of user-controlled input into a Sequelize.literal() query, allowing authenticated users to execute stacked PostgreSQL queries and achieve remote code execution on the underlying database server.
NocoBase is an open-source, AI-powered no-code and low-code platform designed to build business applications and internal tools. The application architecture relies on a modular plugin system to provide core features, including user management, workflows, and notifications. The vulnerability resides specifically within the @nocobase/plugin-notification-in-app-message plugin, which handles in-app notification channels and messaging capabilities.
This plugin exposes a resource action handler called defineMyInAppChannels, which is routed to the HTTP endpoint GET /api/myInAppChannels:list. This endpoint is designed to allow users to retrieve lists of notification channels, applying server-side filters such as timestamps. Because this endpoint handles notifications, it is exposed to authenticated (signed-up) platform users, creating an internal attack surface.
The vulnerability is classified under CWE-89 (Improper Neutralization of Special Elements used in an SQL Command). Input supplied to the query filters is evaluated in an unsafe raw SQL context. An attacker who has achieved standard user registration on a NocoBase deployment can exploit this flaw to execute arbitrary database queries, bypass security boundaries, and gain complete control over the underlying PostgreSQL server.
The root cause of CVE-2026-52887 lies in the insecure configuration and utilization of the Sequelize Object-Relational Mapper (ORM). When building relational queries in Sequelize, developers can use abstraction structures like operators (e.g., Op.and, Op.or, Op.lt) or direct queries. However, when complex database-specific functionality is required, developers often resort to using the Sequelize.literal() function.
The Sequelize.literal() function is designed to insert raw SQL fragments directly into the query generator. Because Sequelize treats the input of Sequelize.literal() as trusted developer-defined code, it completely bypasses the built-in sanitization, quoting, and parameterized binding mechanisms. Any string passed into this function is directly concatenated into the final SQL query sent to the database backend.
In the affected versions of NocoBase, the backend extracts query filters directly from the HTTP query parameters using the context action: const { filter = {}, limit = 30 } = ctx.action?.params ?? {};. When processing the filter[latestMsgReceiveTimestamp][$lt] parameter, the application attempts to filter messages by a specified cut-off timestamp. The code checks for the existence of this key and interpolates the raw, unvalidated string directly into the template literal passed to Sequelize.literal(). This direct interpolation merges user input with SQL commands before execution, resulting in an SQL injection vulnerability.
An analysis of the source code changes in commit 68d64e3fcfb8be2ae4f3bfc9e1ee3f85b87c89ce highlights the exact location of the security flaw and the engineering changes applied to fix it.
Prior to the security patch, the query filter for the timestamp was constructed dynamically using raw string template interpolation:
// VULNERABLE CODE
const latestMsgReceiveTSFilter = filter?.latestMsgReceiveTimestamp?.$lt
? Sequelize.literal(`${latestMsgReceiveTimestampSQL} < ${filter.latestMsgReceiveTimestamp.$lt}`)
: null;In the vulnerable implementation above, if the client sends a request containing filter[latestMsgReceiveTimestamp][$lt]=1) OR 1=1 --, the string is appended directly to the SQL fragment. This alters the query logic, allowing attackers to access unauthorized resources or execute stacked commands.
The patch addresses this vulnerability by introducing strict schema enforcement and refactoring the query interface to use standard Sequelize validation rules and parameter binding:
// SECURE PATCH IMPLEMENTATION
function parseLatestMsgReceiveTimestampLt(filter: unknown) {
const latestMsgReceiveTimestamp =
typeof filter === 'object' && filter !== null
? (filter as { latestMsgReceiveTimestamp?: unknown }).latestMsgReceiveTimestamp
: null;
if (
typeof latestMsgReceiveTimestamp !== 'object' ||
latestMsgReceiveTimestamp === null ||
!Object.prototype.hasOwnProperty.call(latestMsgReceiveTimestamp, '$lt')
) {
return null;
}
const value = (latestMsgReceiveTimestamp as { $lt?: unknown }).$lt;
if (typeof value === 'string' && value.trim() === '') {
throw new Error('Invalid latest message receive timestamp filter');
}
if (typeof value !== 'number' && typeof value !== 'string') {
throw new Error('Invalid latest message receive timestamp filter');
}
const timestamp = Number(value);
if (!Number.isFinite(timestamp)) {
throw new Error('Invalid latest message receive timestamp filter');
}
return timestamp;
}Additionally, the patch replaces the Sequelize.literal() comparison with an explicit Sequelize operator construct:
// SECURE PATCH IMPLEMENTATION (FILTER GENERATION)
const latestMsgReceiveTSFilter =
latestMsgReceiveTimestampLt !== null
? Sequelize.where(Sequelize.literal(latestMsgReceiveTimestampSQL), Op.lt, latestMsgReceiveTimestampLt)
: null;By leveraging Sequelize.where combined with Op.lt, the application safely maps the strictly-validated floating point number latestMsgReceiveTimestampLt to a bound database parameter. Because the database driver executes this as a prepared parameter, the input is never evaluated as raw SQL. The remediation is highly complete because the type-casting helper actively rejects non-numeric strings, blocking any payload containing SQL syntax.
To successfully exploit this vulnerability, an attacker requires network access to the NocoBase API endpoint and valid session credentials. In many default NocoBase deployments, public user registration is enabled, allowing anyone to register a basic account and acquire an active JSON Web Token (JWT) session.
The attack begins by crafting an HTTP GET request targeting /api/myInAppChannels:list with an engineered filter query parameter. Since the database engine behind NocoBase is typically PostgreSQL, and the Node.js database connector (node-pg) permits stacked queries by default, statements can be chained using a semicolon.
An attacker can execute administrative tasks or shell commands on the server by leveraging PostgreSQL's COPY ... TO PROGRAM directive. This command spawns an OS shell and executes arbitrary commands as the database runtime user. The following payload sequence illustrates this attack pathway:
GET /api/myInAppChannels:list?filter[latestMsgReceiveTimestamp][$lt]=1); COPY (SELECT 'exploit') TO PROGRAM 'id' -- HTTP/1.1
Host: target-nocobase.local
Authorization: Bearer <JWT_TOKEN>
If the database connection possesses sufficient privileges (which is common in containerized environments where the database user is configured as postgres or superuser), the injected OS command executes within the context of the database container, leading to Remote Code Execution.
The technical impact of CVE-2026-52887 is evaluated as Critical, carrying a maximum CVSS v3.1 Base Score of 10.0. The vulnerability allows an authenticated attacker to execute arbitrary command structures inside the environment, resulting in a total compromise of confidentiality, integrity, and availability.
While the CVSS vector assigns 'Privileges Required: None' in some databases, the vulnerability requires authenticated access. However, because self-registration is often exposed on low-code platforms, this prerequisite is easily satisfied. The scope is defined as Changed (S:C) because exploitation allows an attacker to transition from the application database security context directly to the container's operating system environment.
In deployments utilizing standard Docker Compose files, the PostgreSQL process frequently runs with administrative privileges. This design flaw allows an attacker to compromise the entire container network, extract database credentials, manipulate application source files, or initiate lateral movement into the cloud hosting environment.
The primary defense against CVE-2026-52887 is updating NocoBase to version 2.0.61 or later, which incorporates the structural type validation and parameter binding patches. If an immediate upgrade is not feasible, several defensive controls can be implemented to mitigate risk.
First, restrict PostgreSQL database permissions. Ensure the database user used by NocoBase is not configured with SUPERUSER privileges. Execute the following SQL commands to revoke dangerous execution permissions from application databases:
ALTER USER nocobase WITH NOSUPERUSER;
REVOKE EXECUTE ON FUNCTION pg_read_file(text) FROM public;
REVOKE EXECUTE ON FUNCTION pg_write_file(text, text, boolean) FROM public;Second, deploy Web Application Firewall (WAF) rules to inspect incoming query parameters on the affected endpoint. The following ModSecurity rule can be utilized to block malicious patterns in the timestamp filter:
SecRule REQUEST_FILENAME "@rx /api/myInAppChannels:list" \
"id:100001,phase:2,deny,status:400,log,msg:'Block SQLi in myInAppChannels Filter',\
chain"
SecRule ARGS:filter[latestMsgReceiveTimestamp][$lt] "@rx [^0-9]" "t:none"Implementing these controls reduces the attack surface, preventing exploitation of raw string interpolation before a platform-wide patch is applied.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
@nocobase/plugin-notification-in-app-message nocobase | < 2.0.61 | 2.0.61 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-89 |
| Attack Vector | Network (AV:N) |
| CVSS Score | 10.0 (Critical) |
| EPSS Score | 0.00593 (Percentile: 44.98%) |
| Impact | Remote Code Execution (RCE) / Full Database Compromise |
| Exploit Status | Proof of Concept (PoC) |
| KEV Status | Not Listed |
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream database.
File Browser versions prior to 2.63.17 contain an authorization and state-management flaw in the BoltDB storage backend. When an authenticated user deletes a shared directory via an HTTP request with a trailing slash (e.g., DELETE /api/resources/a/), the share cleanup routine queries the database index using the unnormalized path before stripping the trailing slash. Because canonical share paths are stored without trailing slashes (e.g., /a), the database prefix query fails to match the parent directory share record. If a directory with the same name is later recreated, the dormant public share hash automatically reactivates and exposes the new directory contents to unauthenticated users.
An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.