Skip to main content
LowInfo disclosureOWASP A05:2021CWE-209

How to fix: AWS S3 NoSuchBucket error pattern exposed

S3 bucket hosting returned a 'NoSuchBucket' or 'AccessDenied' XML error response, revealing the bucket name, region, and an x-amz-request-id header that can be correlated with AWS account activity.

Why it matters

S3 error responses expose the bucket name and region, enabling bucket name enumeration and subdomain takeover attempts on deleted or unclaimed buckets. The x-amz-request-id can be used alongside AWS support channels to correlate requests with account activity. AccessDenied responses also confirm that a bucket exists at the given name.

When a static site is served directly from an S3 bucket hostname, any error (missing file, wrong bucket name, or access control failure) returns an XML-formatted AWS error document. These responses confirm the bucket name, region endpoint, and the presence of the AWS account in the S3 namespace.

How to fix it

  1. 1Front S3 with CloudFront or another CDN that intercepts and rewrites error pages.
  2. 2Configure CloudFront custom error responses for 403 and 404 to serve generic HTML.
  3. 3Disable direct bucket hostname access via bucket policies that deny s3.amazonaws.com Origin requests.
  4. 4Use a vanity domain backed by CloudFront rather than exposing bucket hostnames.

Code examples

CloudFront (custom error response via Terraform)

HCL
resource "aws_cloudfront_distribution" "site" {
  # ... origin config ...

  custom_error_response {
    error_code         = 403
    response_code      = 404
    response_page_path = "/404.html"
  }

  custom_error_response {
    error_code         = 404
    response_code      = 404
    response_page_path = "/404.html"
  }
}

S3 bucket policy (deny direct bucket access)

JSON
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "cloudfront.amazonaws.com"
      },
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-bucket/*",
      "Condition": {
        "StringEquals": {
          "AWS:SourceArn": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE"
        }
      }
    }
  ]
}

References

Detected automatically by VulnRadar. The check id is aws-s3-nosuchbucket-error, stable across every scan so you can filter or diff on it.

See every info disclosure check

Questions

How severe is AWS S3 NoSuchBucket error pattern exposed?
VulnRadar rates this low severity in the info disclosure category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id aws-s3-nosuchbucket-error, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does AWS S3 NoSuchBucket error pattern exposed map to?
It maps to CWE-209. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for aws s3 nosuchbucket error pattern exposed

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

AWS S3 NoSuchBucket error pattern exposed fix | VulnRadar