【中危】surrealdb:服务端请求伪造风险(GHSA-h5rg-8p7f-47g2)
安全情报快照 · 风险级别:中危 · CVSS:4.1 · GHSA-h5rg-8p7f-47g2
先看结论
surrealdb存在服务端请求伪造风险,< 3.1.5 受影响,建议升级至 3.1.5。
影响范围
| 生态 | 组件 | 受影响版本 | 首个修复版本 |
|---|---|---|---|
| rust | surrealdb |
< 3.1.5 | 3.1.5 |
处置建议
优先将 surrealdb 升级至 3.1.5 或更高版本;升级前请结合业务依赖完成兼容性验证。
上游技术详情(原文)
SurrealDB fetches the JWKS document for a JWT or record access method using a bare reqwest client that follows HTTP redirects by default. The network capability check in core/src/iam/jwks.rs (check_capabilities_url) is applied only to the originally configured URL; redirect targets are not re-validated. An --allow-net-permitted JWKS host that returns a 3xx Location can therefore redirect the request to an address the allowlist was meant to block, resulting in a server-side request forgery (SSRF). The protected HttpClient used by http::* functions re-checks every redirect hop and was hardened in 3.1.0, but the JWKS fetcher uses its own client and was not covered.
Impact
What an attacker can do:
- With the Owner role at database level or above (the minimum required to run
DEFINE ACCESS ... TYPE JWT URLorTYPE RECORD ... WITH JWT URL), point an access method at an allowlisted host they control and redirect the server's GET to an otherwise-blocked target — cloud metadata, loopback, internal services — bypassing--allow-net/--deny-net. - Infer the existence and liveness of internal hosts and ports from response-timing differences (bounded by the 1-second fetch timeout).
What it can't do:
- Read the response: the fetch is blind — the body is only parsed as a JWKS, and a non-JWKS response surfaces as an opaque
InvalidAutherror. Nothing is returned to the caller. - Modify data or affect availability (a single GET request).
Patches
The JWKS fetcher now applies a redirect policy that re-validates every redirect target against the configured network capabilities (mirroring check_capabilities_url) and caps redirects at max_http_redirects.
- Versions prior to 3.1.5 are vulnerable.
Workarounds
- Restrict the Owner role to trusted operators.
- Enforce egress filtering at the network layer (block link-local
169.254.0.0/16and internal ranges) so redirect targets are unreachable regardless of in-process checks. - Configure access methods to use only trusted JWKS hosts that do not redirect, or use locally defined keys instead of a remote JWKS.
References
- SurrealDB Documentation — Capabilities
- SurrealQL Documentation — DEFINE ACCESS
fix(iam): prevent SSRF in JWKS fetch by re-validating redirect targets
来源与许可
- GitHub Advisory GHSA-h5rg-8p7f-47g2
- https://github.com/surrealdb/surrealdb/security/advisories/GHSA-h5rg-8p7f-47g2
本页自动同步 GitHub Advisory Database 的公开数据,并保留上游原文供核验;不宣称原创分析。数据许可:CC-BY-4.0。
评论
登录 后参与讨论。
还没有评论,来说两句。