GHSA-84W9-87HM-MXQX
Denial of Service via non-ASCII header values in embedded JavaScript
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 3.3.0 | surrealdb · -4 d desde divulgación | |
| Divulgación | Publicada | GHSA-84W9-87HM-MXQX divulgada · CVSS 6.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
An embedded JavaScript function could crash a SurrealDB server by reading a header value that contained a non-ASCII character.
The `Headers` class available to scripts, which `fetch()` uses for requests and responses and which a script can also construct directly, converted each header value to a string on the assumption that it was plain ASCII, and panicked when it was not. HTTP allows other bytes in header values, so such a value could come from a remote server's response (for example a UTF-8 file name in `Content-Disposition`) or from a value the script set itself. SurrealDB's release builds, including the official binaries and Docker images, abort on a panic, so reading such a value with `get()`, `entries()`, `values()` or `getSetCookie()` terminated the whole server process rather than failing the query.
Impact
Only servers with embedded scripting enabled are affected. Scripting is disabled by default and is enabled with `--allow-scripting` (or `--allow-all`).
What an attacker can do:
- Crash the server with a single query, as any user allowed to run queries (a record user is enough, and so is a guest where guest access is enabled), by reading back a non-ASCII value from a `Headers` object the script creates itself. No outbound network access is involved, so restricting `--allow-net` does not prevent this.
- Where a script reads the headers of a `fetch()` response, crash the server from any endpoint that script is allowed to reach, by returning a header that contains non-ASCII bytes. This can also happen without an attacker, because such values occur in ordinary responses.
- Deny service to every namespace and database on the instance until the server is restarted.
What it can't do:
- Affect servers with scripting disabled, which is the default.
- Read or modify data; this is an availability issue only.
Patches
The `Headers` accessors no longer assume a value is plain ASCII. A value made only of visible ASCII is returned exactly as before; any other value is decoded as UTF-8, with invalid byte sequences replaced by U+FFFD, so reading a header always returns a string. The JavaScript API is unchanged.
- Versions 3.3.0 and later are not affected by this issue.
Workarounds
Users unable to patch should consider the following workarounds:
- Leave embedded scripting disabled (the default). If you start the server with `--allow-all`, add `--deny-scripting`.
- If you need scripting, limit who can write scripts: keep guest access disabled, and use `--deny-arbitrary-query` (where available) for user groups that should not run their own queries.
- Where stored scripts call `fetch()`, restrict `--allow-net` to endpoints you trust, and avoid reading response headers from endpoints you do not control.
- Run SurrealDB under an orchestrator or process manager that restarts it automatically on exit (e.g. Kubernetes, systemd `Restart=on-failure`, or a Docker restart policy). This limits downtime but does not prevent the crash.
References
- SurrealQL Documentation — Embedded scripting functions
https://surrealdb.com/docs/surrealql/functions/script - SurrealDB Documentation — Capabilities
https://surrealdb.com/docs/surrealdb/security/capabilities - `fix(script): stop response Headers accessors panicking on non-ASCII values` (included in SurrealDB 3.3.0)
Acknowledgements
Thank you to gigioneggiando https://github.com/gigioneggiando for reporting this issue.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
crates.iosurrealdb |
Corregida | 3.3.0 | -4 d | 4.0.1 no afectada |
3.3.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/surrealdb/surrealdb/security/advisories/GHSA-84w9-87hm-mxqxLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
