Summary
Budibase contains an unauthenticated SQL injection vulnerability in webhook-triggered automations that use EXECUTE_QUERY steps. An attacker who can submit JSON to the webhook endpoint may influence database queries executed with builder-configured credentials, potentially exposing or changing data in connected datasources.
Affected context
The vulnerability occurs in Budibase deployments where:
- A webhook trigger starts an automation
- The automation includes an EXECUTE_QUERY step
- Request-controlled JSON values influence SQL construction or execution
- The resulting query runs with credentials configured by the application builder
The risk is especially significant when connected datasources contain sensitive information or permit write operations.
Exploit preconditions
- Attack surface: Webhook trigger endpoint exposed to a network-accessible client
- Required access: Ability to submit requests to the webhook; authentication may not be required
- Trigger point: Execution of an automation containing an EXECUTE_QUERY step
- Why exploitation is possible: Attacker-controlled request data can reach SQL execution logic without sufficient separation from query structure, allowing database commands to be interpreted as part of the query
Why this happens
The underlying bug is improper separation between untrusted webhook input and SQL statements. When request-controlled values are incorporated into database queries without reliable parameterization or equivalent structural controls, an attacker may alter the intended query semantics.
This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly called SQL injection. The impact is amplified because the query executes using database credentials configured for the automation rather than a narrowly scoped, per-request identity.
Potential impact
- Sensitive records may be read or exfiltrated
- Database records may be modified or deleted
- Attackers could alter application or automation state
- Connected datasources may be used to establish persistence
- Business workflows and downstream systems could be disrupted
- Higher-privileged database access could enable broader compromise
General mitigation guidance
Mitigation generally focuses on preventing webhook data from becoming executable SQL structure.
Common defensive patterns include:
- Use parameterized queries and prepared statements for all request-derived values
- Prefer query builders or allowlisted query templates that separate data from SQL syntax
- Validate inputs against explicit type, length, format, and value constraints
- Reduce trust in webhook payloads and avoid accepting arbitrary query fragments
- Apply least-privilege permissions to datasource credentials, separating read and write roles where practical
- Restrict webhook exposure with authentication, authorization, network controls, and request signing where appropriate
- Treat errors and query responses as sensitive to reduce information leakage
How teams detect issues like this
Detection approaches commonly include:
- Static analysis for string concatenation, interpolation, or templating of request data into SQL
- Code review checks for EXECUTE_QUERY steps that consume webhook fields without parameter binding
- Tests using benign boundary and metacharacter inputs to verify that query structure remains unchanged
- Runtime monitoring for unusual webhook request volumes, database errors, query patterns, and access to unrelated tables
- Policy enforcement requiring parameterized queries and least-privilege datasource credentials
- Automated security review tools that flag SQL construction from untrusted sources

