GHSA-3WMM-4XJP-4H7Q
Per-group `readTimeout` / `resultSetLimit` are applied per shared SQL statement and cached plan, not per principal: a restricted user's quota leaks to other users, and an unrestricted user's cached plan lets a restricted user skip `readTimeout`
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-3WMM-4XJP-4H7Q divulgada | |
| Remediación | Parche 26.11.1 | com.arcadedb:arcadedb-engine · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Affected
ArcadeDB server/engine, upstream main at 7a258492fe (26.11.1-SNAPSHOT). Component: engine SQL layer (`StatementCache`, `ExecutionPlanCache`, `SelectStatement.setProfilingConstraints`, `SQLQueryEngine.query`) as used by the server security profile (`ServerSecurityDatabaseUser.getReadTimeout/getResultSetLimit`). Not checked on older releases.
## Description
`readTimeout` and `resultSetLimit` of a user's groups are applied by mutating the parsed `Statement`, which is the object held in the per-database `StatementCache` (keyed by SQL text, shared by all principals), and are then baked into the plan that `ExecutionPlanCache` stores under the same text (invalidated by DDL only, never by who ran it).
1. `SelectStatement.setProfilingConstraints()` only tightens (`setTimeout/setLimit` when the user's value is lower) and never resets, so the first restricted user to run a text leaves its timeout/limit on the shared statement. Any other principal running the same text, including `root`, then gets that timeout or limit.
2. A plan planned by an unrestricted principal is cached without a TimeoutStep. A restricted principal running the same text gets a copy of that plan, so its `readTimeout` is not enforced. (`resultSetLimit` was enforced in every case I measured, because `SQLQueryEngine.query()` re-sets the limit on every call.)
## Impact
- Resource-limit bypass (less restriction): a user whose group sets `readTimeout` can run a query without the timeout whenever another principal ran the same SQL text first since the last schema change. Low severity: it removes a DoS guard, it does not expose data or change record permissions.
- Cross-principal degradation (more restriction): one restricted user can make `root` and every other user get `TIMEOUT clause of Nms` or `LIMIT n` on the same query text (persists until the database is closed / ALTER DATABASE clears the statement cache). Availability impact on administrators.
- Group membership and type/bucket/database permissions (access control) were NOT affected: see "Not reproduced".
## Reproduction (measured on 7a258492fe, JDK 21, docker, untimed)
Server with groups `gFree` (readRecord on all types), `gLimit5` (`resultSetLimit` 5), `gTimeout1` (`readTimeout` 1); users `FR`(gFree), `S5`(gLimit5), `ST`(gTimeout1); a type of 10000 documents per scenario (own SQL text each). `SecurityReloadRaceIT.java` (in this folder), phase 1:
- `ST` runs `select from DocP0` first: TimeoutException (expected). Then `FR` and `root` run the same text: both TimeoutException (expected 10000 rows).
- `S5` first on `select from DocP1`: 5 rows; then `FR` and `root`: 5 rows each (expected 10000).
- `FR` first on `select from DocP3`, then `ST`: 10000 rows, no timeout (expected TimeoutException). Same with `root` first (P4: `ST` got 10000 rows).
- `resultSetLimit` after a free principal (P2, P4, P5): 5 rows, enforced.
Visible in the project's own test: `ServerProfilingIT.resultSetLimit` fails with `TimeoutException: TIMEOUT clause of 1ms` at `database.query("sql","select from Document1")` when `readTimeout` ran before it AND the query then takes more than 1 ms (TimeoutStep only fires on elapsed time, so it is intermittent: with MethodName order and Random seed 3 it failed, with the default order and seeds 1 and 2 it passed; all in logs/).
## Not reproduced (stale groups after reload)
Drop + recreate of the same user name with alternating groups 1500 times while the users file was touched every 3 ms (watcher re-reading continuously, the #10460 compare-and-set refusing stale reads in the log): 0 wrong group lists, 0 wrong quotas. Reading of `ServerSecurity`, `UsersPolicy.publish`, `ServerSecurityUser.databaseCache`, `ServerSecurityDatabaseUser.refresh` found no path that re-applies groups no longer in force.
## Suggested fix
Do not mutate the shared statement: clone it (or build a per-execution Limit/Timeout) before `setProfilingConstraints` / `setLimit`, and either put the effective timeout/limit into the plan-cache key or add the TimeoutStep/limit at execution time from the current principal on every execution, cached plan or not. A regression test: two principals with different `readTimeout`, same SQL text, both orders, assert each gets its own.
## Credit
Reporter: Taewoon Kim (humemai). Coordinated disclosure; no public discussion before a fix.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
mavencom.arcadedb:arcadedb-engine |
Corregida | 26.11.1 | 0 d | 26.11.1 no afectada |
26.11.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/ArcadeData/arcadedb/security/advisories/GHSA-3wmm-4xjp-4h7qLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
