Sublime Security high experimental mql

Attachment: ICS with Suspicious Office 365 app authorization (OAuth) link

Detects inbound messages with ICS calendar invites containing a suspicious Office 365 app authorization (OAuth) link. The app may be compromised or was stood up for malicious purposes. Once the app has been authorized, the attacker will have read or write permissions to the user's Office 365 account.

View Source

Detection Logic

type.inbound
and any(attachments,
        (
          .file_type == "ics"
          or .file_extension == "ics"
          or .content_type in ("application/ics", "text/calendar")
        )
        //
        // This rule makes use of a beta feature and is subject to change without notice
        // using the beta feature in custom rules is not suggested until it has been formally released
        //
        and any(beta.file.parse_ics(.).events,
                any(.links,
                    (
                      (
                        .href_url.domain.domain in (
                          'login.microsoftonline.com',
                          'login.microsoft.com'
                        )
                        or strings.icontains(.href_url.query_params,
                                             "login.microsoftonline.com",
                                             'login.microsoft.com'
                        )
                      )
                      and (
                        strings.ilike(.href_url.query_params,
                                      '*offline_access*',
                                      '*.readwrite*',
                                      '*.read*',
                                      '*ctx=*',
                                      '*prompt=none*'
                        )
                        or (
                          strings.icontains(.href_url.path, '/common/reprocess')
                          and strings.icontains(.href_url.query_params, 'ctx=')
                          and strings.icontains(.href_url.query_params,
                                                'sessionId='
                          )
                        )
                      )
                    )
                    or any(flatten(values(.href_url.query_params_decoded)),
                           any(strings.scan_base64(., ignore_padding=true),
                               strings.icontains(., "login.microsoftonline.com")
                               and strings.ilike(.,
                                                 '*offline_access*',
                                                 '*.readwrite*',
                                                 '*.read*',
                                                 '*prompt=none*'
                               )
                           )
                    )
                )
        )
)

Field Validations

Loading…

Comments (0)

Loading comments...