GHSA-JCGP-4284-P6G2
Path traversal in Lance Namespace REST gateway via request-body location enables cross-tenant filer marker write
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-JCGP-4284-P6G2 divulgada · CVSS 7.2 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
The SeaweedFS Lance Namespace REST catalog gateway (default port 9101, bind `0.0.0.0`, launched whenever `-s3.port.lance > 0` which is the default) reads a client-supplied request-body `location` field in `handleDeclareTable`/`handleRegisterTable` and passes it — after only `strings.TrimSuffix(req.Location, "/")` — into a filer path sink. `TableDataDirFromMetadataLocation` performs `path.Join("/buckets", location)`, which collapses `..` segments server-side, and `writeMarker` then issues a filer `CreateEntry` at the resulting directory. Because `writeMarker` never sets `SkipCheckParentDirectory`, the filer recursively auto-creates every missing parent directory along the traversed path. An attacker can therefore write a fixed-name marker (`.lance-reserved` / `.lance-deregistered`) and create parent directories at any location in the filer's virtual namespace — outside the caller's bucket and outside `/buckets` entirely — enabling cross-tenant writes and targeted hiding of another tenant's live Lance tables.
The Lance gateway is the sibling REST gateway that the fix for CVE-2026-54917 (GHSA-w62w-66v9-vvgv) never covered. That fix added a `validateRequestPath` middleware to the S3 and Iceberg routers only, and it inspects only mux path variables — it cannot see a request-body field, and the Lance router does not install it. The Iceberg gateway confines the identical `location` field (`parseS3Location` + `metadataBucket==bucketName` + `isValidTablePath`); Lance implements none of these.
## Root Cause
- `weed/s3api/lance/server.go:88` — `RegisterRoutes` installs only `router.Use(loggingMiddleware)`; no `validateRequestPath` (contrast `weed/s3api/iceberg/server.go` and `weed/s3api/s3api_server.go` which install it).
- `weed/s3api/lance/handlers_table.go:130` — the sole transformation applied to the body field is `location := strings.TrimSuffix(req.Location, "/")` (no `..`/Clean/prefix check).
- `weed/s3api/s3tables/utils.go` — `TableDataDirFromMetadataLocation` does `path.Join(TablesPath /* "/buckets" */, loc)`, collapsing `..`.
- `weed/s3api/lance/markers.go:54-66` — `writeMarker` issues `filer_pb.CreateEntry{Directory: <traversed>, Name: ".lance-reserved"}` without `SkipCheckParentDirectory`, so the filer gRPC handler passes `SkipCheckParentDirectory=false` and `ensureParentDirectoryEntry` recursively creates every missing parent.
## Impact
- Cross-tenant / cross-bucket write of a fixed-name, zero-byte marker into any directory of the filer virtual namespace (including outside `/buckets`).
- Attacker-controlled recursive parent-directory creation in the filer namespace.
- Targeted denial/hiding of a victim's live Lance table: planting `.lance-deregistered` in a victim's dataset directory makes the catalog report that table as deregistered (it disappears from `DescribeTable`/`TableExists`).
Impact is bounded (no host-filesystem write, no RCE, no arbitrary recursive delete): the `/buckets`, `/etc/...` paths are entries in the SeaweedFS filer *virtual* namespace, not the host OS filesystem; DeleteTable's `HasPrefix(GetTableBucketPath(bucket))` confinement blocks arbitrary recursive deletion; marker filenames are fixed (constrained content). In the out-of-the-box zero-config `weed s3` deployment the gateway is unauthenticated (`isAuthEnabled = len(identities) > 0 = false` → `AuthenticateRequest` returns an admin identity); with auth enabled it is an authenticated confused-deputy (the catalog authorizes `CreateTable` against the `{id}` bucket while the marker write targets the traversed directory).
Proof of Concept
POST http://TARGET:9101/v1/table/mybucket$ns$tbl/declare
Content-Type: application/json
{"location":"s3://mybucket/../../../buckets/victim-bucket/target-table"}Zero-config (no S3 identities configured) → runs unauthenticated. The server writes `.lance-reserved` into `/buckets/victim-bucket/target-table` (auto-creating parents). Using a victim's live dataset dir with `.lance-deregistered` hides their table.
## Attack Chain
1. Entry: unauthenticated `POST http://TARGET:9101/v1/table/{bucket}$ns$name/declare` with body `{"location":"../../../secret-tenant/attacker-planted"}`.
- Guard: `Server.Auth` (`weed/s3api/lance/server.go:149`).
- Bypass proof: zero-config gateway → `IdentityAccessManagement.isAuthEnabled = len(identities) > 0 = false` (`auth_credentials.go:398`); `AuthenticateRequest` returns an admin identity with `ErrNone` (`auth_credentials.go:1615-1621`). With auth enabled the handler still runs for any principal (confused deputy).
2. Router guard: CVE-2026-54917 `validateRequestPath` middleware.
- Bypass proof: `weed/s3api/lance/server.go:88` installs only `loggingMiddleware`; `validateRequestPath` is referenced zero times in `weed/s3api/lance/`. Even if present it inspects only mux path vars, not the JSON body `location`.
3. Transformation: `location := strings.TrimSuffix(req.Location, "/")` (`handlers_table.go:130`).
- Guard: none for `..` — TrimSuffix only strips a trailing slash.
4. Catalog step: `createTable` → s3tables `CreateTable` stores `MetadataLocation: req.MetadataLocation` (`s3tables/handler_table.go:210`) with no traversal check and returns success → handler proceeds to the marker sink.
5. Sink prep: `writeMarker` → `datasetDir(location)` → `TableDataDirFromMetadataLocation` → `path.Join("/buckets", loc)` (`s3tables/utils.go`), collapsing `..`.
6. Sink: `filer_pb.CreateEntry{Directory: <traversed>, Name: ".lance-reserved"}` with no `SkipCheckParentDirectory` (`markers.go:54-66`) → `ensureParentDirectoryEntry` recursively creates every missing parent (`filer.go:280,316,347`). The `isUnderBuckets` check (`filer.go:337`) fires only when `dirParts[1]=="buckets"` and only validates the bucket-name segment, so it is skipped entirely for targets outside `/buckets`.
7. Impact: zero-byte marker written into another tenant's namespace + parent dirs created; or `.lance-deregistered` planted in a victim's dataset dir to hide their live table.
## Bypass Evidence
- `path.Join("/buckets","../../../etc/cron.d")` → `/etc/cron.d`; `path.Join("/buckets","victimbucket/../../otherbucket")` → `/otherbucket` (executed via `go run`) — confirms `..` collapse escapes the `/buckets` prefix.
- `isUnderBuckets` trace: for `../../../etc/cron.d`, `dirParts=["","etc","cron.d"]`, `dirParts[1]="etc"` → `isUnderBuckets=false` → bucket-name check skipped (executed).
- `writeMarker` sets no `SkipCheckParentDirectory` (`markers.go:54-66`) → filer gRPC passes `false` (`filer_grpc_server.go:247`) → recursive parent auto-creation.
- Iceberg confines the identical `req.Location` via `parseS3Location`+`metadataBucket==bucketName`+`isValidTablePath`; grep across `weed/s3api/lance/` finds none of these.
## Affected Versions
`>= 4.43, <= 4.44`. The Lance Namespace gateway was introduced in 4.43 (absent on 4.41/4.42) and is present unfixed on the latest release 4.44 and on HEAD. `git log 4.44..HEAD` shows no fix touching the Lance or filer code paths. Module path `github.com/seaweedfs/seaweedfs` (no v2/v3 split).
## Suggested Fix
Confine the request-body `location` in the Lance handlers the way Iceberg does: validate that the resolved path stays within the caller's bucket (`parseS3Location` + `metadataBucket==bucketName` + `isValidTablePath`), reject `..` segments, and/or install `validateRequestPath` on the Lance router. Additionally, `writeMarker` should require the parent directory to pre-exist (set `SkipCheckParentDirectory=true`) so it cannot recursively create arbitrary parent directories.
---
Reported by zx (Jace) — GitHub: @manus-use
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-jcgp-4284-p6g2Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
