High Severity

Service abuse: SendGrid impersonation via Sendgrid from new sender

Description

Detects messages impersonating SendGrid from new senders, while routing through legitimate SendGrid infrastructure. This pattern is commonly used to abuse trusted email services for malicious purposes.

References

No references.

Sublime Security
Created Dec 19th, 2025 • Last updated Nov 16th, 2026
Source
type.inbound
// SendGrid impersonation patterns
and (
  strings.ilike(strings.replace_confusables(sender.display_name), '*sendgrid*')
  or strings.ilevenshtein(strings.replace_confusables(sender.display_name),
                          'sendgrid'
  ) <= 1
  or (
    strings.ilike(strings.replace_confusables(sender.email.local_part),
                  '*sendgrid*'
    )
    and (
      sender.display_name is null
      or strings.ilike(strings.replace_confusables(subject.base), '*sendgrid*')
    )
  )
  or any(ml.logo_detect(file.message_screenshot()).brands,
         .name == "SendGrid" and .confidence == "high"
  )
  or any(html.xpath(body.html, '//img/@src').nodes,
         regex.contains(.raw, 'sendgrid-?logo')
         and not strings.contains(.raw, sender.email.domain.sld)
  )
  or regex.icontains(body.current_thread.text, 'sendgrid\s*20[0-9]{2}')
  or (
    (
      strings.icontains(body.current_thread.text, 'sendgrid')
      or strings.icontains(sender.display_name, 'sendgrid')
    )
    and any(body.current_thread.links,
            any(ml.link_analysis(., mode="aggressive").redirect_history,
                regex.match(.domain.sld, '[a-z]+-sendgrld')
            )
    )
  )
  or regex.icontains(body.current_thread.text,
                     '\bthe\s+(?:twilio\s+)?sendgrid\s+(?:\w+\s+)?team\b',
                     '\b(?:to|by)\s+(?:your|the)\s+sendgrid\s+(?:account|api|integration)\b',
                     '(?:^|\n)\s*your\s+sendgrid\s+(?:account|api|integration)\b',
                     '\breceipt\s+from\s+(?:twilio\s+)?sendgrid\b'
  )
)
// sent through a sendgrid account... sendgrid stamps X-SG-EID/X-SG-ID on every
// send, including white-labelled dedicated IPs that hide sendgrid.net
and any(headers.hops, any(.fields, .name in~ ("X-SG-EID", "X-SG-ID")))
// not common senders with valid domains
// this catches cases where the domain is invalid and senders become common
and not (
  profile.by_sender_email().prevalence == "common" and sender.email.domain.valid
)
// negate legit sendgrid messages
and not (
  sender.email.domain.root_domain in ("sendgrid.com", "kke.co.jp")
  and coalesce(headers.auth_summary.dmarc.pass, false)
)
MQL Rule Console
•Docs•Learning Labs

Playground

Test against your own EMLs or sample data.

Share

Post about this on your socials.

Get Started. Today.

Managed or self-managed. No MX changes.

Deploy and integrate a free Sublime instance in minutes.
Get Started