/

CVE-2026-31816

Severity:

CRITICAL RISK

(9.1)

Authentication and Authorization Bypass in Budibase Server

CVE-2026-31816

Analyzed

Vulnerability type

Category:

Authentication and Authorization Bypass

CWE:

CWE-74

Impact:

Full Authentication and Authorization Bypass Across Server APIs

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A logic flaw in Budibase's authorization middleware allows attackers to fully bypass authentication, authorization, and CSRF protection by appending a webhook-like path to the query string of any request.

Because the webhook detection relies on an unanchored regular expression against the full request URL (including query parameters), a remote unauthenticated attacker can reach protected server-side API endpoints as if fully trusted.

Affected context

This vulnerability affects Budibase server deployments that:

  • Use the centralized authorized() middleware to protect server-side API endpoints
  • Expose HTTP(S) access to Budibase from internal or external networks
  • Enable webhook-style endpoints identified by URL patterns (e.g., /webhooks/trigger)

The issue manifests when the webhook detection logic inspects the entire request URL, including query parameters, and applies an unanchored regex that does not distinguish between the path and the query string.

Exploit preconditions

  • Attack surface: Any Budibase HTTP(S) server endpoint protected by the authorized() middleware
  • Required access: None; a network-positioned attacker only needs the ability to send HTTP requests to the Budibase server
  • Trigger point: The initial authorization middleware chain, specifically the isWebhookEndpoint() check that runs before authentication and CSRF validation
  • Why exploitation is possible:
  • The webhook detection uses an unanchored regular expression that matches substrings rather than the start/end of the path
  • The regex is run against ctx.request.url, which in Koa includes both path and query parameters
  • When the regex matches, the middleware returns next() early, skipping all subsequent authentication, role, and CSRF checks
  • Query strings are not treated as a separate, sanitized component, enabling attackers to smuggle webhook patterns in ? parameters

Why this happens

The core defect is an authorization logic error combined with improper use of regular expressions for URL-based routing.

Instead of matching webhook routes against a normalized request path, the isWebhookEndpoint() helper applies an unanchored regex to the entire ctx.request.url, which includes query parameters. This means a webhook pattern like /webhooks/trigger can match anywhere in the URL, including inside a query string, such as ?foo=/webhooks/trigger.

When a match occurs, the authorized() middleware incorrectly assumes the request is destined for a webhook endpoint and immediately calls return next(), effectively short-circuiting the entire security stack. No authentication, authorization, role, or CSRF checks are performed.

This maps to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because URL components (including query parameters) are not properly separated or normalized before being passed to the regex-based routing logic, causing unintended behavior in the downstream authorization decision.

Potential impact

  • Complete bypass of authentication controls for protected API endpoints
  • Unauthorized access to internal tooling, data management, and workflow actions
  • Creation, modification, or deletion of application data via privileged endpoints
  • Escalation of privileges by invoking admin-only or system configuration APIs
  • Potential account takeover workflows if user management endpoints are exposed
  • Abuse of internal automations and integrations configured within Budibase
  • Lateral movement into connected systems via compromised connectors or actions

General mitigation guidance

Effective mitigation focuses on hardening URL handling and ensuring that authorization gates cannot be trivially bypassed:

  • Separate and normalize URL components: Ensure that path-based routing and security decisions rely only on the normalized path (e.g., ctx.path), not the raw URL including query parameters.
  • Anchor regular expressions: When regex-based routing or classification is required, use anchored patterns (e.g., ^/webhooks/trigger(/|$)), and favor explicit path comparisons over flexible substring matches.
  • Apply security checks before special-case bypasses: Design middleware chains so that authentication, authorization, and CSRF validation run by default, and any exemptions (such as public webhooks) are narrowly scoped and explicitly validated.
  • Minimize "magic" URL patterns: Prefer explicit route definitions or structured configuration for public/webhook endpoints instead of detecting them via broad regexes.
  • Enforce least privilege for special endpoints: When public or semi-public endpoints are necessary, constrain their capabilities to the minimum required actions, avoiding general-purpose access to core APIs.
  • Centralize and review authorization logic: Keep bypass conditions in a small, well-audited section of middleware, and treat any return next() before auth as a high-risk pattern that requires scrutiny.

How teams detect issues like this

Organizations can improve detection of similar issues by combining code-level checks and behavioral monitoring:

  • Static analysis and linting:
  • Flag uses of unanchored regular expressions applied to full URLs or request objects (e.g., ctx.request.url) in routing or authorization logic.
  • Detect early returns in authorization middleware that bypass authentication or CSRF checks based on URL substrings.
  • Highlight cases where path and query parameters are not clearly separated before security decisions.
  • Code review practices:
  • Require explicit documentation and review of any "public" or "bypass" routes, including justification and scope.
  • Look for middleware that calls next() conditionally before authentication and verify that conditions are strict and path-specific.
  • Check that webhook or integration endpoints are defined via explicit route declarations rather than generic regex matching.
  • Runtime monitoring and logging:
  • Log all authorization bypass paths with structured metadata, including URL, query parameters, and caller IP.
  • Set alerts for unusual access patterns where protected endpoints are invoked with webhook-like query parameters.
  • Automated testing:
  • Add regression tests that probe protected endpoints with crafted query strings to ensure authorization cannot be skipped.
  • Incorporate security regression suites into CI to test for URL-based auth bypass patterns across critical routes.

Sources

SourceLink
github.comgithub.com/Budibase/budibase/security/advisories/GHSA-gw94-hprh-4wj8

Frequently asked

questions

Yes. A remote attacker who can send HTTP(S) requests to the Budibase server can exploit this without any prior authentication or valid user account, because the bug resides in the central authorization middleware.

The attacker can reach server-side API endpoints as though fully authenticated and authorized, potentially invoking admin-level or system APIs depending on how the application is configured and which endpoints are exposed.

Normalize and separate path and query components before applying routing or security logic, use anchored and explicit path checks instead of broad regexes on raw URLs, and ensure that authentication and authorization middleware cannot be skipped based on loosely defined URL patterns.

Adopt a principle of secure defaults where all endpoints are protected by authentication and access control, keep bypass rules minimal and explicitly defined, review any conditional next() calls in security middleware, and incorporate static analysis and automated tests focused on URL routing and authorization behavior.

Find out what's already
exploitable in your codebase.