CVE-2026-31877: Frappe Sanitize Fields Single Paren Blacklist Bypass

SQL field sanitizer extracts only the token after the first '(' and checks it against a keyword/function blacklist. Nested parentheses (a subquery placed in a later argument, or wrapped inside an allowed SQL function) bypass this check and enable SQL injection (CVE-2026-31877). Iterate over every '(' in the field expression and validate each inner token, e.g

Provally CuratedPublic repositoryHighHigh confidenceVerifiedApache-2.0Python
greprules fetch cve-2026-31877-frappe-sanitize-fields-single-paren-blacklist-bypass --engine opengrep

Description

SQL field sanitizer extracts only the token after the first '(' and checks it against a keyword/function blacklist. Nested parentheses (a subquery placed in a later argument, or wrapped inside an allowed SQL function) bypass this check and enable SQL injection (CVE-2026-31877). Iterate over every '(' in the field expression and validate each inner token, e.g