GHSA-PXFV-J39P-QH4J
Stored Seaweed-X-Amz-Version-Id header enables cross-tenant filer path traversal in the S3 gateway
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-PXFV-J39P-QH4J divulgada · CVSS 9.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
The S3 gateway accepts a client-supplied `Seaweed-X-Amz-Version-Id` HTTP header, stores it verbatim into object metadata (no ingress stripping, no `..`/slash rejection), and later re-reads that stored value as a filename component on two code paths that — unlike the 8 sibling consumers of version-ids — skip the `isValidVersionID` / `IsValidPathSegment` validator. Because the stored value flows into filer paths that are collapsed by `filepath.Join`, an authenticated single-bucket tenant can traverse out of its own bucket. This is a stored-then-reread confused-deputy variant of the same class as CVE-2026-55874 / CVE-2026-54917, on a channel that neither of those fixes covers (the CVE-2026-55874 / CVE-2026-54917 guards validate mux URL vars and query params, never stored object metadata).
Two distinct sinks are reachable from the one poisoned header:
- Vector A — retention/legal-hold write (cross-tenant directory-entry creation). `PutObjectRetention`/`PutObjectLegalHold` build `entryPath = object + ".versions/v_" + poison` and write it. Parent directories are auto-created at the collapsed cross-bucket path, letting the attacker create directory entries in other tenants' bucket trees and outside `/buckets`, and promote a victim's existing object file into a directory.
- Vector B — remote-cache read (cross-bucket confidentiality breach). On `GetObject` of a remote-only object, the poison flows to `doCacheRemoteObjectToLocalCluster`, whose `util.JoinPath` collapses `..` on BOTH the lookup and the cache write, returning a collapsed cross-bucket victim entry whose chunks are streamed back to the attacker. (Gated on remote storage tiering being configured — a non-default deployment feature.)
## Root Cause
`putToFiler` stores the client header without validation (`weed/s3api/s3api_object_handlers_put.go:792-793`). The `Seaweed-`-prefixed header is not stripped on ingress (only `X-SeaweedFS-Principal` / `-Session-Token` are `Header.Del`'d in `weed/s3api/auth_credentials.go:1672-1673`), and SigV4's unsigned-header coverage check only enforces the `x-amz-` prefix, so `seaweed-x-amz-version-id` is exempt (irrelevant here anyway since both paths are authenticated and the attacker can simply sign the header). The stored value is later read back into a path WITHOUT `isValidVersionID`, the one asymmetry that distinguishes these two sinks from the 8 that validate.
## Impact
- Vector A: cross-tenant / arbitrary-filer directory-entry creation (including inside victim bucket trees and outside `/buckets`), a WORM-metadata leaf at an attacker-chosen raw key, and file→directory promotion of a victim's existing object (integrity). No read primitive (the leaf lands at the raw, uncollapsed key in the attacker's own namespace, so it is NOT an arbitrary-content overwrite — this bounds the impact). CVSS `AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:L` = 6.4 MEDIUM.
- Vector B: genuine cross-bucket object read streamed to the attacker (confidentiality). CVSS `AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N` = 7.7 HIGH (conditional on remote-tiering configured).
Combined advisory scored at the ceiling: 7.7 HIGH.
## Proof of Concept
1. `PUT /mybkt/obj` (versioning OFF) with header `Seaweed-X-Amz-Version-Id: x/../../../../buckets/victim/pwn` + valid SigV4. → stored verbatim.
2. `PUT /mybkt?versioning` `Status=Enabled` (own bucket) — makes Object Lock ops "available".
3. Vector A: `PUT /mybkt/obj?retention` with a COMPLIANCE/GOVERNANCE body and NO `versionId` query → `setObjectRetention` reads the stored poison and writes with parent-dir collapse.
Vector B: with remote tiering configured and `obj` remote-only, `GET /mybkt/obj` (no `versionId`) → poisoned path collapses in `doCacheRemoteObjectToLocalCluster`, victim chunks streamed back.
## Attack Chain
1. Entry — `PUT /mybkt/obj` header `Seaweed-X-Amz-Version-Id: x/../../../../buckets/victim/pwn`.
- Guard: ingress header stripping; `..` rejection at store.
- Bypass proof: no `Header.Del` of `Seaweed-`-prefixed headers exists (`auth_credentials.go:1672-1673` only deletes Principal/Session-Token; grep empty otherwise). `putToFiler:792-793` stores `entry.Extended[ExtVersionIdKey] = []byte(header)` with no validation. Unversioned PUT reaches `putToFiler` via the `default:` branch (`s3api_object_handlers_put.go:341-349`).
2. Enable versioning — own bucket; `isObjectLockAvailable` requires versioning (`s3api_object_retention.go:659-672`).
3. Read-back (Vector A) — `PUT /mybkt/obj?retention`, no `versionId` query.
- Guard: `validateRequestPath` middleware (the CVE-2026-54917 fix) + `isValidVersionID`.
- Bypass proof: `validateRequestPath` validates only mux `bucket`/`object` and *query* `versionId`/`uploadId` (`s3api_path_validation.go:89-124`) — never stored metadata. Handler reads `versionId` from query = "" (`s3api_object_handlers_retention.go:26`). `setObjectRetention` versioning-enabled branch does `versionId = string(entry.Extended[ExtVersionIdKey])` and builds `entryPath = object + ".versions/" + getVersionFileName(versionId)` with NO `isValidVersionID` (`s3api_object_retention.go:282-289`). 8 sibling consumers DO validate (`s3api_copy_validation.go:290`, `s3api_object_handlers_delete.go:39/61`, `s3api_object_versioned_finalize.go:124`, `s3api_object_versioning.go:1115/1153`, `s3api_path_validation.go:75`). Poison returned via `doGetLatestObjectVersion` fallback to the pre-versioning regular entry (`s3api_object_versioning.go:1900-1907`).
4. Sink (Vector A) — `mkFile("/buckets/mybkt", entryPath)` → `MkFile` (no `SkipCheckParentDirectory`) → gRPC `CreateEntry` → `ensureParentDirectoryEntry`.
- Guard: parent-dir pre-existence; `VerifyS3BucketName`; collapse producing a victim overwrite.
- Bypass proof: `SkipCheckParentDirectory=false` default (`filer_grpc_server.go:246`) runs `ensureParentDirectoryEntry`, building parents via `dirPath = "/" + util.Join(dirParts[:level]...)` = `filepath.Join` which collapses `..` (`filer.go:327`; `fullpath.go:106-108`) → real cross-bucket dir entries. Bucket-name guard checks `dirParts[2]` from the RAW split = attacker's own `"mybkt"` (`filer.go:342-347`) → passes; targets outside `/buckets` skip it entirely. The leaf stores at the RAW uncollapsed key: `FromPbEntry`→`NewFullPath`→`Child` is raw concat, no `path.Clean` (`fullpath.go:79-89`); leveldb key via `DirAndName()`=`filepath.Split` (`fullpath.go:42-52`) does NOT collapse → INSERT at raw key, not victim overwrite.
5. Vector B chain — `GET /mybkt/obj` on a remote-only object: `resolvedSourceVersionId("", entry)` returns stored poison verbatim (`s3api_object_handlers.go:3536-3547`), gated on `entry.IsInRemoteOnly()` (`:1046-1049`); `buildVersionedRemoteObjectPath` builds `name="v_"+poison` (`:3383-3389`); sink `filer_grpc_server_remote.go:74` `lockPath := util.JoinPath(req.Directory, req.Name)` collapses `..` for BOTH the `fencedFindEntry` lookup and the cache write; early-return (`:87-90`) hands the collapsed victim entry's chunks back; caller streams them (`handlers.go:1050-1054`).
6. Impact — cross-tenant directory-entry creation + WORM leaf + file→dir promotion (Vector A); cross-bucket object read (Vector B).
## Bypass Evidence
- Ingress strip grep for `Seaweed-X-Amz-Version-Id` / `ExtVersionIdKey` deletion: EMPTY (only Principal/Session-Token deleted).
- `isValidVersionID` call count in `s3api_object_retention.go`: ZERO; in the 8 sibling paths: present. Asymmetry proven.
- `util.Join`/`util.JoinPath` = `filepath.ToSlash(filepath.Join(...))` collapses `..` (`fullpath.go:106-112`); leaf store key via `filepath.Split` does NOT (`fullpath.go:42-52`) — write/read key-collapse asymmetry simulated in Go, confirms leaf ≠ victim overwrite.
- All code confirmed byte-identical on release tag 4.45 via `git show 4.45:<file>`; `git log 4.45..HEAD` empty for every involved file.
## Affected Versions
`<= 4.45` (present unfixed on latest release 4.45 and on HEAD `68a175e`). Module path `github.com/seaweedfs/seaweedfs` (no v2/v3 split).
## Suggested Fix
Reject `..`, `/`, `\`, and NUL in `Seaweed-X-Amz-Version-Id` at `putToFiler` (mirror `IsValidPathSegment`) — this shared root-cause fix closes both vectors. Defense-in-depth: also add `isValidVersionID` before building `entryPath` in `setObjectRetention` / `setObjectLegalHold`, and before path use in `resolvedSourceVersionId`.
---
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-pxfv-j39p-qh4jLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
