Details
Expected output (the port is the only variable):
[*] internal service 127.0.0.1:<random>; guard validates host -> 203.0.113.10 (safe), pins to it
(A) REST/undici path -> status 200 body=INTERNAL_SECRET_RESPONSE
(B) node-fetch path -> ERROR Failed to connect to resolved IP for localhost: network timeout at: http://localhost:<random>/
RESULT: PASS - undici path BYPASSES guard, node-fetch path CONTAINED
How to read it:
- (A) the real
fetchWithBlacklistvalidated and pinned the safe public IP203.0.113.10, yet the undici REST transport re-resolvedlocalhostand reached127.0.0.1— the internal service responded → SSRF bypass. - (B) the default node-fetch path honored the pin (forced to the unroutable
203.0.113.10) and never reached the internal service. The"Failed to connect to resolved IP for localhost"string is emitted by the realoutboundFetch.ts, proving the pin works there. This is the negative control localizing the bug to the undici transport.
Real-world variant: instead of localhost, an attacker uses a domain they control with a 0-second TTL that returns a public IP during the guard's validation lookup and an internal IP (169.254.169.254, 127.0.0.1, internal CouchDB/Redis) at undici's connect-time lookup; the REST datasource query then returns the internal response body to the attacker.
Impact
Type: Server-Side Request Forgery via DNS rebinding (CWE-918 + CWE-367), full-response and with arbitrary HTTP method/body (REST datasources let the caller choose method, headers, and body).
Who is impacted: Any Budibase deployment on an affected version, especially multi-tenant / Budibase-Cloud-style hosting where builders/tenants are not trusted with host-internal access. The SSRF blacklist is the control that contains those users; this bypass defeats it.
Realistic worst case: An authenticated builder/tenant points a REST datasource at a rebinding host and makes the server:
- read cloud metadata (
http://169.254.169.254/...) → steal IAM credentials → cloud account compromise; - read the internal CouchDB (
http://127.0.0.1:5984/_all_dbs,_users) → all tenants' apps, users, and secrets; - using
PUT/POST/DELETEagainst unauthenticated localhost services → create admin documents, modify or delete tenant databases / flush caches → integrity and availability loss for all co-tenants.
CVSS 3.1 Vector Justification
| Metric | Value | Why |
|---|---|---|
| Attack Vector (AV) | Network (N) | Triggered through Budibase's HTTP API / app (a REST datasource query). |
| Attack Complexity (AC) | High (H) | Requires DNS rebinding — the validation-time IP must differ from the connect-time IP (TOCTOU). A direct internal request without rebinding is blocked by the blacklist, so the race is mandatory. |
| Privileges Required (PR) | Low (L) | Requires an authenticated account that can configure/run a REST datasource (builder/tenant). |
| User Interaction (UI) | None (N) | The attacker configures and triggers the request; no victim interaction. |
| Scope (S) | Changed (C) | Canonical SSRF: the vulnerable component is abused to reach resources in other security authorities (cloud metadata, internal CouchDB/Redis/MinIO). |
| Confidentiality (C) | High (H) | Full-response SSRF: read cloud IAM credentials and the internal CouchDB (every tenant's apps, users, secrets). |
| Integrity (I) | High (H) | Arbitrary method/body allows PUT/POST/DELETE to unauthenticated localhost services (CouchDB :5984) → create admin docs, modify tenant data. |
| Availability (A) | High (H) | The same write primitive can DELETE databases / flush Redis → full data/service loss for all tenants. |
Notes: AC:H is the standard, defensible scoring for DNS rebinding; if rebinding is treated as reliable (TTL-0 frameworks), AC:L yields CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H. A conservative read-only interpretation is I:N/A:N.
Suggested remediation
Make the transport that actually performs the request honor the validated IP. In getDispatcher/rest.ts, construct the undici Agent with a connect: { lookup } (or custom connect) that returns only the pinnedIp resolved by fetchWithBlacklist (i.e., mirror makePinnedAgent for undici), so the dispatcher cannot re-resolve DNS; alternatively, re-check the resolved peer IP against isBlacklisted inside the undici connect callback. The Node-agent pin must not be relied upon when the request is issued through undici.