Sublime Security medium experimental mql

Link: Google Cloud Storage with suffixed unsubscribe bucket

Detects messages with exactly two Google Cloud Storage links serving the same file from two buckets, where one bucket name is the other plus a suffix (e.g. 'unsb'). Observed in bulk health-supplement, reward survey and fake storage-alert campaigns.

View Source

Detection Logic

type.inbound
// two distinct paths
and length(distinct(map(filter(body.links,
                               .href_url.domain.domain == "storage.googleapis.com"
                        ),
                        .href_url.path
                    )
           )
) == 2
// split each distinct path into bucket and trailer once
and any(map(distinct(filter(body.links,
                            .href_url.domain.domain == "storage.googleapis.com"
                     ),
                     .href_url.path
            ),
            // return just the bucket/trailer for the path
            regex.extract(.href_url.path,
                          '^/(?P<bucket>[^/]+)/(?P<trailer>.+)$'
            )[0]
        ),
        // loop the links that aren't the current .href_url.path (from the outer loop)
        any(map(distinct(filter(body.links,
                                .href_url.domain.domain == "storage.googleapis.com"
                                and .href_url.path != ..full_match
                         ),
                         // return just the .href_url.path
                         .href_url.path
                ),
                // create the bucket/trailer for the path
                regex.extract(.href_url.path,
                              '^/(?P<bucket>[^/]+)/(?P<trailer>.+)$'
                )[0]
            ),
            // this bucket is the outer bucket plus a suffix, serving the same trailer
            strings.starts_with(.named_groups['bucket'],
                                ..named_groups['bucket']
            )
            and .named_groups['trailer'] == ..named_groups['trailer']
        )
)

Field Validations

Loading…

Comments (0)

Loading comments...