Detection rules › Sublime MQL

Link: Microsoft device code authentication with suspicious indicators

Severity
high
Type
rule
Source
github.com/sublime-security/sublime-rules

Detects messages containing links with Microsoft device code authentication patterns, including verification prompts, copy code instructions, and suspicious API endpoints or antibot tokens commonly used in device code takeover attacks.

Threat classification

Sublime's own taxonomy (not MITRE ATT&CK).

CategoryValues
Attack typesCredential Phishing
Tactics and techniquesImpersonation: Brand, Social engineering, Evasion

Event coverage

Message attribute
body
recipients
type

Rule body MQL

type.inbound
and length(recipients.to) == 1
and 0 < length(body.links) < 15
and any(body.links,
        // strings commonly observed in the microsoft device code phishing lure
        regex.icontains(ml.link_analysis(., mode="aggressive").final_dom.display_text,
                        "verification co(?:mplete|de)",
                        '\bcopy code\b',
                        "Secured by Microsoft",
                        "(?:redirecting to|opening) your document",
                        "preparing verification",
                        "(?:verify your identity|complete verification) with Microsoft"
        )
        // unique device code antibot token cookie, api path, ms device login path url
        and (
          regex.icontains(ml.link_analysis(., mode="aggressive").final_dom.raw,
                          'X-Antibot-Token',
                          '\/api\/device\/sta(?:rt|tus)\/',
                          'microsoft\.com\/devicelogin'
          )
          // or api path on workers dev associated with this activity
          or any(ml.link_analysis(., mode="aggressive").unique_urls_accessed,
                 strings.icontains(.path, '/api/device/start')
                 and strings.icontains(.domain.root_domain, 'workers.dev')
          )
        )
)

Detection logic

Scope: inbound message.

Detects messages containing links with Microsoft device code authentication patterns, including verification prompts, copy code instructions, and suspicious API endpoints or antibot tokens commonly used in device code takeover attacks.

  1. inbound message
  2. length(recipients.to) is 1
  3. all of:
    • length(body.links) > 0
    • length(body.links) < 15
  4. any of body.links where all hold:
    • ml.link_analysis(., mode='aggressive').final_dom.display_text matches any of 6 patterns
      • verification co(?:mplete|de)
      • \bcopy code\b
      • Secured by Microsoft
      • (?:redirecting to|opening) your document
      • preparing verification
      • (?:verify your identity|complete verification) with Microsoft
    • any of:
      • ml.link_analysis(., mode='aggressive').final_dom.raw matches any of 3 patterns
        • X-Antibot-Token
        • \/api\/device\/sta(?:rt|tus)\/
        • microsoft\.com\/devicelogin
      • any of ml.link_analysis(., mode='aggressive').unique_urls_accessed where all hold:
        • .path contains '/api/device/start'
        • .domain.root_domain contains 'workers.dev'

Inspects: body.links, recipients.to, type.inbound. Sensors: ml.link_analysis, regex.icontains, strings.icontains.

Indicators matched (11)

FieldMatchValue
regex.icontainsregexverification co(?:mplete|de)
regex.icontainsregex\bcopy code\b
regex.icontainsregexSecured by Microsoft
regex.icontainsregex(?:redirecting to|opening) your document
regex.icontainsregexpreparing verification
regex.icontainsregex(?:verify your identity|complete verification) with Microsoft
regex.icontainsregexX-Antibot-Token
regex.icontainsregex\/api\/device\/sta(?:rt|tus)\/
regex.icontainsregexmicrosoft\.com\/devicelogin
strings.icontainssubstring/api/device/start
strings.icontainssubstringworkers.dev