<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Nocobase — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/vendors/nocobase/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 24 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/vendors/nocobase/feed.xml" rel="self" type="application/rss+xml"/><item><title>NocoBase SQL Injection via Missing Validation on Update Endpoint</title><link>https://feed.craftedsignal.io/briefs/2024-01-24-nocobase-sql-injection/</link><pubDate>Wed, 24 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-24-nocobase-sql-injection/</guid><description>A SQL injection vulnerability exists in nocobase plugin-collection-sql versions 2.0.32 and earlier due to missing validation on the sqlCollection:update endpoint, allowing attackers with collection management permissions to execute arbitrary SQL queries and exfiltrate data.</description><content:encoded><![CDATA[<p>The <code>@nocobase/plugin-collection-sql</code> plugin for NocoBase is vulnerable to SQL injection. Specifically, the <code>checkSQL()</code> validation function, responsible for preventing dangerous SQL keywords, is applied to the <code>collections:create</code> and <code>sqlCollection:execute</code> endpoints, but is absent from the <code>sqlCollection:update</code> endpoint. This oversight allows an attacker with collection management permissions (specifically, the <code>pm.data-source-manager.collection-sql</code> snippet) to inject arbitrary SQL code. The attack involves creating a SQL collection with benign SQL, updating it with malicious SQL bypassing validation, and subsequently querying the collection to execute the injected SQL. This vulnerability, confirmed to affect versions 2.0.32 and earlier, can lead to unauthorized data access, privilege escalation, and potentially remote code execution on the database server.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker gains collection management permissions, possibly through compromised credentials or exploiting another vulnerability.</li>
<li>The attacker crafts a request to the <code>collections:create</code> endpoint to create a new SQL collection with a benign SQL query, such as <code>&quot;SELECT 1 as id&quot;</code>.</li>
<li>The NocoBase server processes the request, and the <code>checkSQL()</code> function validates the SQL query and allows the collection creation.</li>
<li>The attacker crafts a malicious request to the <code>sqlCollection:update</code> endpoint, targeting the newly created collection. The request contains a SQL payload designed to extract sensitive data, such as <code>&quot;SELECT * FROM users&quot;</code>, or execute malicious functions.</li>
<li>The NocoBase server processes the update request, but crucially, the <code>checkSQL()</code> function is not called, allowing the malicious SQL payload to be saved to the collection configuration.</li>
<li>The attacker crafts a request to the <code>&lt;collection_name&gt;:list</code> endpoint to query the updated collection.</li>
<li>The NocoBase server executes the stored malicious SQL query against the database.</li>
<li>The database returns the results of the malicious query, potentially containing sensitive data (e.g., user credentials), which is then returned to the attacker.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this SQL injection vulnerability can have severe consequences. Attackers can exfiltrate sensitive data, including user credentials and password hashes, leading to confidentiality breaches. Furthermore, by using database-specific functions such as <code>pg_read_file</code> or <code>LOAD_FILE</code>, attackers can potentially read arbitrary files from the database server&rsquo;s filesystem. The vulnerability can also be exploited for privilege escalation, allowing attackers to gain unauthorized access to other databases or execute arbitrary code on the database server. While the number of victims is unknown, any NocoBase instance running a vulnerable version of the <code>@nocobase/plugin-collection-sql</code> plugin is susceptible to this attack.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply the fix suggested in the advisory by adding <code>checkSQL()</code> to the <code>update</code> action within the <code>@nocobase/plugin-collection-sql</code> plugin.</li>
<li>Deploy the Sigma rule <code>Detect NocoBase SQL Injection via Update Endpoint</code> to detect attempts to exploit this vulnerability by monitoring HTTP requests to the <code>sqlCollection:update</code> endpoint.</li>
<li>Upgrade to a patched version of <code>@nocobase/plugin-collection-sql</code> that includes the necessary validation on the <code>update</code> action, mitigating the risk of SQL injection.</li>
<li>Implement the more comprehensive defense measures recommended in the advisory, such as centralizing validation and strengthening the blocklist of dangerous SQL keywords to prevent future vulnerabilities.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>sql-injection</category><category>web-application</category><category>nocobase</category></item><item><title>NocoBase SQL Injection via Recursive Eager Loading</title><link>https://feed.craftedsignal.io/briefs/2024-01-nocobase-sqli/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-nocobase-sqli/</guid><description>NocoBase versions 2.0.32 and earlier are vulnerable to SQL injection due to string concatenation in the `queryParentSQL()` function, allowing attackers with record creation permissions to inject arbitrary SQL and potentially extract sensitive information or execute commands.</description><content:encoded><![CDATA[<p>A SQL injection vulnerability exists in NocoBase version 2.0.32 and earlier due to string concatenation in the <code>queryParentSQL()</code> function within the <code>@nocobase/database</code> core package. The vulnerability stems from how the <code>queryParentSQL()</code> function constructs a recursive CTE query by concatenating <code>nodeIds</code> instead of using parameterized queries. An attacker with record creation permissions on a tree collection with string-type primary keys can inject arbitrary SQL via a malicious string primary key value in a created record. This injection is triggered when a subsequent request initiates recursive eager loading on that collection. This can lead to confidentiality breaches (extraction of database values including credentials), integrity issues (data manipulation via stacked queries), and availability problems (resource exhaustion). On PostgreSQL with superuser privileges, OS command execution is possible. The vulnerability affects all collections using a tree/adjacency-list structure with string primary keys. The same concatenation pattern also exists in <code>plugin-field-sort/src/server/sort-field.ts:124</code>. The vulnerability is tracked as CVE-2026-41640.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker gains access to the NocoBase application with privileges to create records in a collection.</li>
<li>The attacker identifies a &ldquo;tree&rdquo; collection that utilizes a string-type primary key.</li>
<li>The attacker crafts a malicious primary key string containing SQL injection payload, such as <code>root') UNION ALL SELECT CAST((SELECT email FROM users LIMIT 1) AS integer)::text, NULL::text WHERE ('1'='1</code>.</li>
<li>The attacker creates a new record in the target collection using the crafted malicious primary key.</li>
<li>A subsequent request is made that triggers recursive eager loading on the target collection, specifically when a <code>BelongsTo</code> association has <code>recursively: true</code> and instances exist, calling the vulnerable <code>queryParentSQL</code> function.</li>
<li>The <code>queryParentSQL</code> function concatenates the malicious primary key into the SQL query without proper sanitization or parameterization.</li>
<li>The injected SQL code is executed against the database, allowing the attacker to extract sensitive data via error messages or potentially perform other malicious actions.</li>
<li>The attacker retrieves the extracted data from the error messages or through other means, such as direct database access if integrity is compromised.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>This SQL injection vulnerability can lead to severe consequences. Successful exploitation can result in the unauthorized disclosure of sensitive information, including database credentials and other user data. Attackers can potentially modify data or execute arbitrary commands on the database server, leading to data corruption or system compromise. In the case of PostgreSQL databases with superuser privileges, attackers might gain operating system-level access. The vulnerability affects all collections using tree/adjacency-list structure with string-type primary keys, increasing the attack surface. Confirmed extractions include version information, database names, emails, and password hashes.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Deploy the Sigma rule <code>Detect NocoBase SQL Injection Attempt in Primary Key</code> to your SIEM to detect attempts to exploit this vulnerability via malicious primary key values.</li>
<li>Apply the suggested fix from the advisory by using parameterized queries in <code>packages/core/database/src/eager-loading/eager-loading-tree.ts</code> as referenced in the overview.</li>
<li>Apply the same fix to <code>plugin-field-sort/src/server/sort-field.ts:124</code> to address the identical concatenation pattern as described in the overview.</li>
<li>Validate primary key values at record creation time to reject or escape values containing SQL metacharacters (<code>'</code>, <code>&quot;</code>, <code>;</code>, <code>--</code>) in string-type primary key fields, as suggested in the advisory.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>sqli</category><category>nocobase</category><category>cve-2026-41640</category><category>injection</category></item></channel></rss>