Summary
Budibase before 3.40.0 contains a SQL injection vulnerability in the Oracle datasource connector's post-write row lookup, where table names in identifiers are not safely escaped. An attacker with write permission on a table whose name contains a double quote may inject SQL that runs with the datasource database user's privileges.
Affected context
The vulnerability occurs in Budibase deployments using the Oracle datasource connector and its post-write row lookup behavior. It becomes risky when an attacker can write to a table with a specially formed name containing a double quote, and the connector incorporates that identifier into SQL without applying appropriate escaping or structured identifier handling.
Exploit preconditions
- Attack surface: Oracle datasource connector's post-write row lookup
- Required access: Write permission on a database table
- Trigger point: Processing a write operation followed by the connector's row lookup
- Relevant condition: The target table name contains a double quote
- Why exploitation is possible: The connector fails to safely escape table names used as SQL identifiers, allowing attacker-influenced identifier content to alter query structure
Why this happens
The underlying bug is improper neutralization of attacker-influenced input used in a SQL statement, mapping to CWE-89: Improper Neutralization of Special Elements used in an SQL Command. The connector treats a table name as a trusted identifier but does not apply database-specific identifier quoting or use a constrained identifier representation before composing the post-write lookup query.
Potential impact
- An attacker may read data beyond their intended authorization scope.
- An attacker may modify or delete arbitrary database records accessible to the datasource user.
- Sensitive information may be exposed through the Oracle database connection.
- Database integrity and downstream application behavior could be affected.
- The impact could extend to other systems or datasets reachable by the datasource account.
General mitigation guidance
Mitigation generally focuses on separating SQL structure from all externally influenced values and identifiers.
Common defensive patterns include:
- Using parameterized queries for data values.
- Applying database-specific, context-correct quoting for identifiers rather than treating names as raw SQL fragments.
- Restricting table and column names to approved schema metadata or allowlists.
- Avoiding dynamic SQL construction when a fixed query or structured database API is available.
- Applying least-privilege permissions to datasource accounts, including limiting read and write access to required tables.
- Validating connector inputs before query construction and preserving authorization checks throughout post-write processing.
How teams detect issues like this
Organizations can look for:
- Static-analysis findings involving string concatenation or interpolation of table names into SQL.
- Code review signals where identifier quoting is implemented manually or inconsistently.
- Tests using reserved characters, quotation marks, and other boundary values in database identifiers.
- Database audit events showing unexpected statements issued by the Budibase datasource account.
- Policy checks requiring parameterized values, approved identifier allowlists, and least-privilege datasource roles.
Automated code-review and application-security tools may help identify unsafe query construction patterns, but database logging and authorization review remain important for runtime coverage.

