GHSA-m3c3-78fh-w3w7: Rust/SurrealDB vulnerability
SurrealDB offers http functions that can access external network endpoints. A typical, albeit not recommended configuration would be to start SurrealDB with all network connections allowed with the exception of a deny list. For example, surreal start --allow-net --deny-net 10.0.0.0/8 will allow all network connections except to the 10.0.0.0/8 block.
An authenticated user of SurrealDB can use bypass this restriction, using http::<fn>(<url>) functions where the hostname resolves to an IP within the --deny-net block. For example if a SurrealDB administrator wanted to restrict access to other services within a private network and thus set the --deny-net to a network IP range, this could be circumvented by an attacker leveraging DNS records and hostname resolution.
When sending SurrealDB statements containing the http:: functions, if the hostname resolves to a forbidden IP, the SurrealDB server will still issue the request and return the responses to the attacker.
Impact The impact of this vulnerability is circumvention of the --deny-net capability and resulting impact on systems external to SurrealDB. The ultimate impact is dependent on the deployment scenario.
For example, if the SurrealDB server blocks requests to internal/private IP addresses because those services don’t require authentication, but an attacker can still use SurrealDBs ability to resolve their hostnames via DNS and invoke them directly using http::<fn>(<url>), the attacker can access these internal endpoints directly, and potentially retrieve or even alter sensitive information and credentials.
Patches A patch has been created that checks resolved hostnames against allowed network targets, preventing http:: functions from connecting to disallowed IPs.
- Versions 2.2.6, 2.3.6 and later are not affected by this issue. - The first release following 2.1.7 and 3.0.0-alpha.7 and later will not be affected by this issue
Workarounds The possibility of this vulnerability being exploited can be reduced by following an allowlist approach to enabling the http capability surreal start --allow-net 10.0.0.0/8 or using the equivalent SURREALCAPSALLOWNET environment variable, where endpoints allowed are fully trusted and are not controlled by regular users.
Alternatively, the network access capability can be disabled, using --deny-net or the equivalent SURREALCAPSDENYNET environment variable without specifying targets, which disables all outbound HTTP, with impact to SurrealDB functionality.
As the impact of this vulnerability depends on the security of the deployment environment of SurrealDB, best practices should be followed within that environment.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
rust/SurrealDBto a version that resolves this vulnerability.Fixed in 2.3.6 - Upgrade
Upgrade
rust/SurrealDBto a version that resolves this vulnerability.Fixed in 3.0.0-alpha.7 - Upgrade
Upgrade
rust/SurrealDBto a version that resolves this vulnerability.Fixed in 2.2.6 - Upgrade
Upgrade
rust/SurrealDBto a version that resolves this vulnerability.Fixed in 2.1.8 - Configuration
Start SurrealDB with network access denied for HTTP by using `surreal start --deny-net` (or set `SURREAL_CAPS_DENY_NET` without targets) to disable all outbound HTTP connections via `http::*`.
SurrealDB (startup capabilities) --deny-net (or SURREAL_CAPS_DENY_NET) = disables all outbound HTTP when set without specifying targets - Configuration
Use an allowlist approach for outbound network access when enabling the HTTP capability, e.g. `surreal start --allow-net 10.0.0.0/8` (or set `SURREAL_CAPS_ALLOW_NET` accordingly), restricting allowed destinations to fully trusted endpoints not controlled by regular users.
SurrealDB (startup capabilities) --allow-net (or SURREAL_CAPS_ALLOW_NET) = 10.0.0.0/8 (example) - Configuration
If outbound network access is required, configure the deny list to block disallowed internal ranges while still allowing other networks, e.g. `surreal start --allow-net --deny-net 10.0.0.0/8`.
SurrealDB (startup capabilities) --deny-net = 10.0.0.0/8 (example) - Compensating control
Rely on the created patch that checks resolved hostnames against allowed network targets, preventing `http::*` functions from connecting to disallowed IPs.
Event History
Frequently Asked Questions
Which deployments are exposed to this bypass?
Deployments that allow network connections broadly and rely on --deny-net to block private or otherwise restricted IP ranges are exposed. The issue applies when HTTP functions can resolve attacker-chosen hostnames to an address in a denied range.
What does an attacker need to exploit this issue?
The attacker needs to be an authenticated SurrealDB user able to submit statements using http::* functions. They must use a hostname whose DNS resolution points to an IP address covered by --deny-net.
What can an attacker access through the bypass?
SurrealDB can issue the HTTP request to the forbidden resolved address and return the response to the attacker. This can circumvent restrictions intended to prevent access to services in private network ranges.
What can be done if patching is not immediately possible?
Avoid an allow-all network configuration that relies on deny lists for sensitive ranges. Use a deny-all capability posture with only the specific network exceptions required by the deployment.