GHSA-JJ89-WVRW-C4GP
Surrealism module output buffering bypasses the module memory limit
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:H/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-JJ89-WVRW-C4GP divulgada · CVSS 4.9 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
A Surrealism module could exhaust the server's memory by writing to standard output or standard error without ever ending a line.
The server passes a module's stdout and stderr to its log one complete line at a time, holding an unfinished line in server memory until it ends. That buffer had no size limit. Because it was server memory rather than the module's own memory, the memory ceiling configured for modules (`SURREAL_SURREALISM_MAX_MEMORY`, or the module's own limit) did not apply to it, so a module that kept writing without a newline could grow the server process until it ran out of memory.
Impact
Only servers with the experimental Surrealism capability enabled are affected, and only through a module that has been installed on the server. Surrealism is disabled by default, and defining a module requires an Owner role.
What an attacker can do:
- Through a malicious or faulty module, grow server memory until the process is killed, denying service to every namespace and database on the instance until it is restarted.
- Do so regardless of the memory ceiling configured for modules, which operators may rely on to contain module code.
- Once such a module is installed, trigger it as any user allowed to call the module's functions; `DEFINE MODULE` permissions default to `FULL`.
What it can't do:
- Affect servers where the experimental Surrealism capability is disabled, which is the default.
- Install a module; that requires an Owner role.
- Read or modify data; this is an availability issue only.
Patches
Output that a module writes without a line break is no longer held indefinitely. Once an unfinished line reaches a fixed size, it is passed to the log as its own chunk, so no output is lost.
- Versions 3.3.0 and later are not affected by this issue.
Workarounds
Users unable to patch should consider the following workarounds:
- Leave the experimental `surrealism` capability disabled unless you need it. It is off by default and is enabled with `--allow-experimental surrealism` (env `SURREAL_CAPS_ALLOW_EXPERIMENTAL`).
- Install only modules you trust, and limit who holds an Owner role, which is required to define modules and the buckets they are loaded from.
- Restrict who can call module functions with a `PERMISSIONS` clause on `DEFINE MODULE`.
- 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
- SurrealDB Documentation — Capabilities
https://surrealdb.com/docs/surrealdb/security/capabilities - `fix(surrealism): bound the host-side WASI stdio buffer` (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 |
0.6.03.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-jj89-wvrw-c4gpLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
