rustfs icon indicating copy to clipboard operation
rustfs copied to clipboard

IAM: s3:ListAllMyBuckets granted to authenticated users regardless of policy (default-deny not enforced)

Open sfasching opened this issue 5 months ago • 1 comments

Summary

An authenticated IAM user whose attached policy does not grant s3:ListAllMyBuckets can still call GET / (list_buckets) and receives HTTP 200 with the full bucket list. The absence of an Allow for this action should result in an implicit deny (AccessDenied, 403). The bucket-listing endpoint appears to be authorized before the per-user policy is evaluated.

Confirmed on 1.0.0-beta.7, and previously on 1.0.0-alpha.99 — i.e. the behavior has persisted across the alpha→beta transition (the policy fixes in beta.1/beta.4 such as #2707 / #2984 did not cover this path).

Environment

  • RustFS version: 1.0.0-beta.7 (also reproduced on 1.0.0-alpha.99)
  • Deployment: single-node, standalone binary (Linux x86_64) and containerized — both reproduce
  • Client: boto3 / AWS SigV4

Reproduction

  1. Create a canned policy that grants only bucket-scoped access to a single bucket test-bucket (no s3:ListAllMyBuckets):
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:ListBucket", "s3:GetBucketLocation"],
      "Resource": ["arn:aws:s3:::test-bucket"]
    },
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:PutObject"],
      "Resource": ["arn:aws:s3:::test-bucket/*"]
    }
  ]
}
  1. Create a non-admin user, attach that policy, and issue an access key/secret for it.

  2. Call list_buckets as that user:

import boto3

client = boto3.client(
    "s3",
    endpoint_url="http://127.0.0.1:9000",
    aws_access_key_id="<SCOPED_USER_KEY>",
    aws_secret_access_key="<SCOPED_USER_SECRET>",
)

print(client.list_buckets())

Expected

ListAllMyBuckets is not granted by the policy, so the call should fail:

botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling
the ListBuckets operation: Access Denied.

Actual

HTTP 200 with the complete bucket list returned, including buckets the user has no policy grant for:

# {'Buckets': [{'Name': 'test-bucket', ...}, {'Name': 'other-bucket', ...}], ...}

The same user's other scoped operations behave correctly (head_bucket / list_objects_v2 on test-bucket succeed; access to non-granted buckets' objects is denied) — so policy evaluation works for object- and bucket-scoped actions but not for the account-level s3:ListAllMyBuckets action.

Impact

Least-privilege / information-disclosure: any authenticated identity can enumerate all bucket names in the instance regardless of policy. No object read/write escalation was observed via this path — bucket-name enumeration only.

sfasching avatar Jun 08 '26 05:06 sfasching

Thanks for the detailed report.

We investigated this path and confirmed that RustFS currently follows the MinIO-compatible behavior for ListBuckets, rather than the stricter AWS IAM behavior.

In AWS S3, GET / (ListBuckets) is authorized by s3:ListAllMyBuckets. s3:ListBucket and s3:GetBucketLocation are bucket-scoped permissions and do not replace s3:ListAllMyBuckets.

MinIO intentionally handles this differently: when s3:ListAllMyBuckets is denied, MinIO still lists buckets internally and filters the result to buckets where the caller has s3:ListBucket or s3:GetBucketLocation. This is done to support S3- compatible clients and console/browser workflows in multi-tenant deployments, where users may have access to specific buckets but should not receive global bucket-list permissions. In other words, MinIO provides a “list buckets I can access” behavior even though AWS S3 does not define a separate API/action for that.

RustFS currently has the same compatibility behavior. That said, the security concern is valid: if this behavior returns buckets beyond the caller’s bucket-scoped permissions, that is a bug. The intended behavior, if we keep MinIO compatibility, is:

  • with s3:ListAllMyBuckets: return the full bucket list;
  • without s3:ListAllMyBuckets: return only buckets for which the caller has bucket-level access such as s3:ListBucket or s3:GetBucketLocation;
  • with no matching bucket-level permission: return AccessDenied.

We will verify whether RustFS is returning only the filtered authorized set or leaking the complete bucket list. If the complete list is returned, we will fix that as an authorization bug. We will also discuss whether RustFS should keep MinIO- compatible filtered listing or switch to strict AWS behavior where missing s3:ListAllMyBuckets always returns AccessDenied.

GatewayJ avatar Jun 08 '26 10:06 GatewayJ