Summary
A server-side request forgery (SSRF) issue in Budibase's OAuth2 SDK allows the fetchToken function to send POST requests to arbitrary, builder-controlled URLs without applying the standard blacklist checks.
When an attacker can control the OAuth2 endpoint configuration, they may be able to coerce the Budibase server into making requests to internal or otherwise sensitive network locations.
Affected context
This vulnerability occurs in Budibase deployments where the OAuth2 SDK is used and application builders can configure OAuth2 endpoints.
The fetchToken implementation relies on plain node-fetch to contact a builder-supplied URL and omits the centralized blacklist.isBlacklisted check that guards other outbound HTTP paths.
Because the associated Joi schema for OAuth2 URLs does not restrict schemes or hosts, URLs pointing to internal services, metadata endpoints, or other sensitive locations can be configured if no additional external controls are applied.
Exploit preconditions
- Attack surface: Server-side HTTP(S) requests initiated by Budibase via the OAuth2 token exchange flow.
- Required access: Ability to define or modify OAuth2 configuration, specifically the token endpoint URL; this could be via a malicious builder, compromised builder account, or misconfigured multi-tenant environment.
- Trigger point: Invoking the OAuth2 token exchange (fetchToken), which causes the Budibase server to perform a POST request using the supplied URL.
- Why exploitation is possible: The fetchToken path bypasses the standard blacklist.isBlacklisted validation and the Joi schema does not constrain scheme or host, leaving the server free to issue outbound requests to attacker-specified destinations, including internal network resources.
Why this happens
The underlying bug is an inconsistent application of outbound request validation logic for a specific HTTP client path.
Most outbound HTTP requests in the codebase are passed through a blacklist.isBlacklisted check that enforces restrictions on target hosts or networks; however, the OAuth2 fetchToken helper uses plain node-fetch directly.
Combined with a permissive Joi schema that does not restrict URL schemes or hosts, this creates a classic CWE-918: Server-Side Request Forgery (SSRF) pattern: user- or builder-controlled URLs being fetched from a privileged server context without appropriate validation or network scoping.
Potential impact
- The server may be coerced into making HTTP requests to internal services not directly exposed to the internet (e.g., internal APIs, admin panels, or infrastructure services).
- Attackers could attempt to access cloud metadata services or similar endpoints, which may expose credentials or configuration data.
- Internal network scanning could be performed indirectly by observing timing, response codes, or error messages from targeted hosts.
- Downstream security controls relying on the blacklist.isBlacklisted protection may be bypassed for this specific code path.
General mitigation guidance
Effective mitigation generally focuses on bringing all outbound HTTP paths under consistent, centrally enforced network controls.
Recommended defensive patterns include:
- Ensuring that every code path performing outbound HTTP requests uses a shared, vetted helper that applies host/network allowlists or blacklists, including the OAuth2 token exchange flow.
- Applying strict validation and normalization of configured URLs via schema enforcement, restricting allowed schemes to HTTPS and limiting hosts or domains to trusted identity providers.
- Designing OAuth2 configuration so that only privileged, trusted administrators can define or modify token endpoints, reducing the chance of malicious or accidental misconfiguration.
- Segmenting network access from the application layer, using egress firewalls or proxy policies that prevent access to sensitive internal networks and metadata services regardless of application bugs.
How teams detect issues like this
Detection can combine code-level review with runtime monitoring:
- Static analysis / code review: Look for direct uses of generic HTTP clients (e.g., node-fetch) that bypass central request helpers or do not apply host validation. Flag any outbound call that accepts a URL from configuration or user input without normalization and policy checks.
- Configuration review: Periodically inspect OAuth2 configurations for unexpected hosts, non-standard ports, or non-HTTPS schemes that may indicate misuse or misconfiguration.
- Runtime monitoring: Implement outbound traffic logging and anomaly detection for application servers, focusing on requests to non-approved internal IP ranges, metadata endpoints, or unusual domains.
- Policy enforcement: Use automated CI/CD checks or linting rules to ensure new outbound HTTP paths are wired through shared validation and policy modules.

