Skip to content

Improve S3 buckets detection #18

@Regala

Description

@Regala

Hey,

I have the current test file, attached.
index_nosecrets.txt

flaws.cloud.s3.amazonaws.com indicates that this might be a bucket, but doing
aws s3 ls s3://flaws.cloud.s3.amazonaws.com returns no such bucket.

However, doing:
aws s3 ls s3://flaws.cloud successfully connects to it:
2017-03-14 03:00:38 2575 hint1.html 2017-03-03 04:05:17 1707 hint2.html 2017-03-03 04:05:11 1101 hint3.html 2018-07-10 17:47:16 3082 index.html 2018-07-10 17:47:16 15979 logo.png 2017-02-27 01:59:28 46 robots.txt 2017-02-27 01:59:30 1051 secret-dd02c7c.html

My suggestion is to improve this detection, by e.g. making use of Patrick's regex's:
{bucketname}.s3.amazonaws.com
^[a-z0-9\.\-]{0,63}\.?s3.amazonaws\.com$

{bucketname}.s3-website(.|-){region}.amazonaws.com (+ possible China region)
^[a-z0-9.-]{3,63}.s3-website.--\w{2,14}-\d{1,2}.amazonaws.com(.cn)?$

{bucketname}.s3(.|-){region}.amazonaws.com
^[a-z0-9.-]{3,63}.s3.--\w{2,14}-\d{1,2}.amazonaws.com$

{bucketname}.s3.dualstack.{region}.amazonaws.com
^[a-z0-9.-]{3,63}.s3.dualstack.(eu|ap|us|ca|sa)-\w{2,14}-\d{1,2}.amazonaws.com$`

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions