GHSA-WHFH-76H8-2R66
CLI help output prints the values of SURREAL_PASS and SURREAL_TOKEN
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-WHFH-76H8-2R66 divulgada | |
| Remediación | Parche 4.0.0 | surrealdb · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
The `--help` and `-h` output of seven commands shows the current values of credential environment variables in clear text:
| Command | Values in the help output |
|---|---|
| `surreal start` | `SURREAL_PASS` |
| `surreal sql` | `SURREAL_PASS`, `SURREAL_TOKEN` |
| `surreal import` | `SURREAL_PASS`, `SURREAL_TOKEN` |
| `surreal export` | `SURREAL_PASS`, `SURREAL_TOKEN` |
| `surreal mcp` | `SURREAL_PASS` |
| `surreal ml import` | `SURREAL_PASS`, `SURREAL_TOKEN` |
| `surreal ml export` | `SURREAL_PASS`, `SURREAL_TOKEN` |
Versions: we reproduced this on seven official Docker images: `v2.7.0`, `v3.2.0`, `v3.2.4`, `v3.2.5`, `v3.3.0`, `v3.3.2`, and `v3.3.4`. The last one reports `3.3.4 for linux on x86_64`. Version 2.7.0 does not have the `mcp` command. We did not run other 2.x versions or versions before 2.7.0.
Steps to reproduce:
docker run --rm -e SURREAL_PASS=example-password -e SURREAL_TOKEN=example-token \
surrealdb/surrealdb:v3.3.4 export --help | grep -E 'SURREAL_(PASS|TOKEN)='Output:
[env: SURREAL_PASS=example-password]
[env: SURREAL_TOKEN=example-token]Impact: in container deployments, the server credentials are usually in the environment of the server container. A Kubernetes Secret or `docker run -e` puts them there. An operator can run `surreal export --help` or `surreal sql --help` in that container, for example with `kubectl exec`. The root password then goes to the terminal output. Terminal output can go to shell logs, CI logs, screen shares, and support tickets. Operators do not expect a secret in help output, so they do not protect it. This is not a privilege escalation, because a person who can run commands in the container can also read its environment. The risk is accidental disclosure.
Cause: clap shows the value of an `env` variable in the help text unless the argument sets `hide_env_values = true`. These arguments do not set it. The line numbers are for tag `v3.3.0`, and the `surrealdb-server` 3.3.4 crate has the same files:
- `surrealdb/server/src/cli/abstraction/mod.rs`, line 19: `env = "SURREAL_PASS"` on `password`. The `sql`, `import`, `export`, `ml import`, and `ml export` commands use this argument.
- `surrealdb/server/src/cli/abstraction/mod.rs`, line 28: `env = "SURREAL_TOKEN"` on `token`. The same five commands use this argument.
- `surrealdb/server/src/cli/start.rs`, line 195: `env = "SURREAL_PASS"` on the `password` of the `start` command.
- `surrealdb/server/src/cli/mcp.rs`, line 52: `env = "SURREAL_PASS"` on the `password` of the `mcp` command.
At tags `v1.0.0` and `v2.0.0`, the `password` argument in `src/cli/abstraction/mod.rs` also does not set `hide_env_values`.
Suggested fix: set `hide_env_values = true` on each of the four arguments above. These four changes cover all seven commands. The help text then shows `[env: SURREAL_PASS]` without the value. For example, the `password` argument in `abstraction/mod.rs` becomes:
#[arg(
env = "SURREAL_PASS",
hide_env_values = true,
short = 'p',
long = "password",
visible_alias = "pass",
requires = "username"
)]
pub(crate) password: Option<String>,The `token` argument in the same file, and the `password` arguments in `start.rs` and `mcp.rs`, get the same added line.
We did not include `SURREAL_KEY` in `start.rs`, because it sets `hide = true`. `SURREAL_KVS_KEY` and `SURREAL_WEB_KEY` hold file paths, not secret values.
If you do not think that this is a vulnerability, please tell us, and we will open a public issue instead.
An AI coding agent (Claude Code) ran the reproduction and drafted this report. I examined the results before I sent it.
Patches
A patch has been created that redacts the values of SURREAL_PASS and SURREAL_TOKEN from the CLI `--help` output.
- Version 4.0.0 and later are not affected by this issue.
References
- SurrealDB Documentation — CLI
https://surrealdb.com/docs/surrealdb/cli/start - `fix(cli): CLI --help prints the values of SURREAL_PASS and SURREAL_TOKEN` (commit `2afc241798`)
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
crates.iosurrealdb |
Corregida | 4.0.0 | 0 d | 4.0.1 no afectada |
4.0.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-whfh-76h8-2r66Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
