Summary
NocoDB has an SQL injection flaw in how select-field option titles are incorporated into MySQL or MariaDB enum/set column definitions. A base creator or owner who can supply a crafted title may cause database schema changes when the definition is processed.
Affected context
The vulnerability occurs when NocoDB generates MySQL or MariaDB enum/set column definitions from select-field option titles. It may be risky when a base creator or owner can control those titles and the generated definitions are incorporated into SQL without correctly handling backslashes.
Exploit preconditions
- Attack surface: NocoDB operations that generate or update enum/set column definitions in a connected MySQL or MariaDB database
- Required access: Permissions available to a base creator or owner who can set select-field option titles
- Trigger point: Processing a select-field title while constructing or altering a column definition
- Why exploitation is possible: Single-quote doubling alone does not safely handle backslashes in this SQL context, allowing input to affect the generated statement structure
Why this happens
The underlying bug is unsafe construction of SQL from a user-controlled option title. The application doubles single quotes but does not also account for backslash escaping, so the title may escape the intended string literal and alter the SQL statement. This is CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection).
Potential impact
- An attacker with the required NocoDB permissions could alter database schema elements.
- Database columns could be added, dropped, or renamed.
- Indexes could be altered, potentially affecting data integrity or application availability.
- Changes to the connected database could disrupt dependent applications or workflows.
General mitigation guidance
Mitigation generally focuses on preventing user-controlled values from changing SQL structure.
Common defensive patterns include:
- Using parameterized queries where supported, and safe, structured APIs for schema operations where parameterization is not applicable
- Applying context-appropriate escaping rather than relying on quote doubling alone
- Validating option titles against an explicit schema and limiting where user input can influence generated SQL
- Restricting schema-changing capabilities and database credentials to the least privilege needed
- Separating application data access from administrative schema modification where feasible
How teams detect issues like this
High-level detection approaches include:
- Static analysis for SQL statements assembled through string concatenation with user-controlled values
- Code review of enum/set column generation and escaping behavior for MySQL and MariaDB
- Tests that verify special characters cannot change the structure of generated SQL
- Policy checks that restrict raw SQL construction and schema-changing database permissions
Automated code review tools may help identify unsafe query-building patterns.

