CVE-2026-41641
Description
NocoBase is an AI-powered no-code/low-code platform for building business applications and enterprise solutions. Prior to version 2.0.39, the checkSQL() validation function that blocks dangerous SQL keywords (e.g., pg_read_file, LOAD_FILE, dblink) is applied on the collections:create and sqlCollection:execute endpoints but is entirely missing on the sqlCollection:update endpoint. An attacker with collection management permissions can create a SQL collection with benign SQL, then update it with arbitrary SQL that bypasses all validation, and query the collection to execute the injected SQL and exfiltrate data. This issue has been patched in version 2.0.39.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
@nocobase/plugin-collection-sqlnpm | < 2.0.39 | 2.0.39 |
Affected products
2- Range: <=2.0.32
Patches
1851aee543efafix(collection-sql): validate sql on update (#9134)
2 files changed · +69 −0
packages/plugins/@nocobase/plugin-collection-sql/src/server/resources/sql.ts+8 −0 modified@@ -103,6 +103,14 @@ export default { await next(); }, update: async (ctx: Context, next: Next) => { + const { sql } = ctx.action.params.values || {}; + if (sql) { + try { + checkSQL(sql); + } catch (e) { + ctx.throw(400, ctx.t(e.message)); + } + } const transaction = await ctx.app.db.sequelize.transaction(); try { const { upRes } = await updateCollection(ctx, transaction);
packages/plugins/@nocobase/plugin-collection-sql/src/server/__tests__/actions.test.ts+61 −0 modified@@ -186,6 +186,67 @@ describe('sql collection', () => { expect(loadedFields2.size).toBe(1); }); + it('sqlCollection:update: should check sql', async () => { + await agent.resource('collections').create({ + values: { + name: 'fakeCollection', + fields: [ + { + name: 'testField1', + type: 'string', + interface: 'input', + }, + ], + }, + }); + await agent.resource('collections').create({ + values: { + name: 'sqlCollection', + sql: 'select * from "fakeCollection"', + template: 'sql', + fields: [ + { + name: 'testField1', + type: 'string', + interface: 'input', + }, + ], + }, + }); + + const collection = await db.getRepository('collections').findOne({ + filter: { + name: 'sqlCollection', + }, + }); + + const updateRes = await agent.resource('sqlCollection').update({ + filterByTk: 'sqlCollection', + values: { + key: collection.key, + sql: "select pg_read_file('/etc/passwd')", + name: 'sqlCollection', + fields: [ + { + name: 'testField1', + type: 'string', + interface: 'input', + }, + ], + }, + }); + + expect(updateRes.status).toBe(400); + expect(updateRes.body.errors[0].message).toMatch('SQL statements contain dangerous keywords'); + + const collectionAfterUpdate = await db.getRepository('collections').findOne({ + filter: { + name: 'sqlCollection', + }, + }); + expect(collectionAfterUpdate.options.sql).toBe('select * from "fakeCollection"'); + }); + it('sqlCollection:setFields', async () => { await agent.resource('collections').create({ values: {
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/nocobase/nocobase/commit/851aee543efa894142e0f7be03eb55d9cec06a91nvdPatchWEB
- github.com/nocobase/nocobase/pull/9134nvdIssue TrackingPatchWEB
- github.com/nocobase/nocobase/releases/tag/v2.0.39nvdPatchProductWEB
- github.com/nocobase/nocobase/security/advisories/GHSA-wrwh-c28m-9jjhnvdExploitMitigationVendor AdvisoryWEB
- github.com/advisories/GHSA-wrwh-c28m-9jjhghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-41641ghsaADVISORY
News mentions
0No linked articles in our index yet.