CVE-2026-22687: Naive Sql Ast Validation

Validating SQL queries using naive string manipulations like `strings.HasPrefix` or regex is vulnerable to injection and bypasses. Attackers can use whitespace, comments, or compound queries (e.g., UNION, CTEs) to evade these checks and execute unauthorized commands. Use a proper SQL parser to analyze the abstract syntax tree (AST) instead.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Go
greprules fetch cve-2026-22687-naive-sql-ast-validation --engine opengrep

Description

Validating SQL queries using naive string manipulations like `strings.HasPrefix` or regex is vulnerable to injection and bypasses. Attackers can use whitespace, comments, or compound queries (e.g., UNION, CTEs) to evade these checks and execute unauthorized commands. Use a proper SQL parser to analyze the abstract syntax tree (AST) instead.