Detection rules › Sublime MQL
Brand impersonation: SendGrid
Detects inbound messages that impersonate Twilio/SendGrid through display name or domain manipulation, combined with security or authentication-themed content, while failing authentication checks and originating from untrusted sources.
Threat classification
Sublime's own taxonomy (not MITRE ATT&CK).
| Category | Values |
|---|---|
| Attack types | BEC/Fraud, Credential Phishing, Spam |
| Tactics and techniques | Impersonation: Brand, Social engineering |
Event coverage
Rule body MQL
type.inbound
and (
(
// SendGrid impersonation patterns
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 (
// Twilio impersonation patterns
strings.ilike(strings.replace_confusables(sender.display_name), '*twilio*')
or strings.ilevenshtein(strings.replace_confusables(sender.display_name),
'twilio'
) <= 1
or (
strings.ilike(strings.replace_confusables(sender.email.local_part),
'*twilio*'
)
and (
sender.display_name is null
or strings.ilike(strings.replace_confusables(subject.base), '*twilio*')
)
)
)
or strings.icontains(body.current_thread.text, "the sendgrid team")
or 2 of (
regex.icontains(body.current_thread.text, '(?:Twilio|SendGrid)'),
strings.icontains(body.current_thread.text, '1801 California St'),
strings.icontains(body.current_thread.text, 'Denver, CO 80202')
)
// SendGrid content from non-SendGrid marketing platforms
or (
sender.email.domain.root_domain in (
"selfcast.com",
"mailchimp.com",
"constantcontact.com",
"hubspot.com",
"klaviyo.com",
"mailgun.com"
)
and (
(
(
strings.icontains(body.current_thread.text, "sendgrid")
or strings.icontains(subject.base, "sendgrid")
)
and 3 of (
strings.icontains(body.current_thread.text, "webhook"),
strings.icontains(body.current_thread.text, "endpoint"),
strings.icontains(body.current_thread.text, "api"),
strings.icontains(body.current_thread.text, "delivery"),
strings.icontains(body.current_thread.text, "event notification")
)
)
and (
// Look for SendGrid-related content with non-SendGrid tracking links
any(body.links,
strings.icontains(.href_url.url, "selfcast.com")
or (
.display_url.url is not null
and strings.icontains(.display_url.url, "sendgrid.com")
)
)
)
)
)
)
and (
// Content analysis using ML/NLU
any(ml.nlu_classifier(body.current_thread.text).topics,
.name in (
"Security and Authentication",
"Secure Message",
"Reminders and Notifications",
"Software and App Updates",
"Customer Service and Support"
)
and .confidence in ("medium", "high")
)
or any(ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topics,
.name in (
"Security and Authentication",
"Secure Message",
"Reminders and Notifications",
"Software and App Updates",
"Customer Service and Support"
)
and .confidence in ("medium", "high")
)
or any(ml.nlu_classifier(body.current_thread.text).intents,
.name == "cred_theft" and .confidence == "high"
)
or any(ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents,
.name == "cred_theft" and .confidence == "high"
)
// any capacity or limits mentioned
or any([subject.base, body.current_thread.text],
(strings.icontains(., "capacity") or strings.icontains(., "limit"))
and regex.icontains(., '\breach(?:\b|ed)')
)
)
// and the sender is not in org_domains or from sendgrid domains and passes auth
and not (
sender.email.domain.valid
and (
sender.email.domain.root_domain in $org_domains
or (
sender.email.domain.root_domain in (
"sendgrid.com",
"sendgrid.net",
"twilio.com",
"swoogo.com", // events planning software used by Twillio
"sendsafely.com", // secure delivery used by Twillio
"evolve.com", // same address as Twillio
"sendgridsolutions.com"
)
)
)
and headers.auth_summary.dmarc.pass
)
// Exclude high trust domains with valid auth and solicited senders
and (
(
sender.email.domain.root_domain in $high_trust_sender_root_domains
and not headers.auth_summary.dmarc.pass
)
or sender.email.domain.root_domain not in $high_trust_sender_root_domains
)
and not profile.by_sender().solicited
Detection logic
Scope: inbound message.
Detects inbound messages that impersonate Twilio/SendGrid through display name or domain manipulation, combined with security or authentication-themed content, while failing authentication checks and originating from untrusted sources.
- inbound message
any of:
any of:
- strings.replace_confusables(sender.display_name) matches '*sendgrid*'
- strings.replace_confusables(sender.display_name) is similar to 'sendgrid'
all of:
- strings.replace_confusables(sender.email.local_part) matches '*sendgrid*'
any of:
- sender.display_name is missing
- strings.replace_confusables(subject.base) matches '*sendgrid*'
any of
ml.logo_detect(file.message_screenshot()).brandswhere all hold:- .name is 'SendGrid'
- .confidence is 'high'
any of:
- strings.replace_confusables(sender.display_name) matches '*twilio*'
- strings.replace_confusables(sender.display_name) is similar to 'twilio'
all of:
- strings.replace_confusables(sender.email.local_part) matches '*twilio*'
any of:
- sender.display_name is missing
- strings.replace_confusables(subject.base) matches '*twilio*'
- body.current_thread.text contains 'the sendgrid team'
at least 2 of:
- body.current_thread.text matches '(?:Twilio|SendGrid)'
- body.current_thread.text contains '1801 California St'
- body.current_thread.text contains 'Denver, CO 80202'
all of:
- sender.email.domain.root_domain in ('selfcast.com', 'mailchimp.com', 'constantcontact.com', 'hubspot.com', 'klaviyo.com', 'mailgun.com')
all of:
all of:
any of:
- body.current_thread.text contains 'sendgrid'
- subject.base contains 'sendgrid'
at least 3 of 5: body.current_thread.text contains any of 5 patterns
webhookendpointapideliveryevent notification
any of
body.linkswhere any holds:- .href_url.url contains 'selfcast.com'
all of:
- .display_url.url is set
- .display_url.url contains 'sendgrid.com'
any of:
any of
ml.nlu_classifier(body.current_thread.text).topicswhere all hold:- .name in ('Security and Authentication', 'Secure Message', 'Reminders and Notifications', 'Software and App Updates', 'Customer Service and Support')
- .confidence in ('medium', 'high')
any of
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topicswhere all hold:- .name in ('Security and Authentication', 'Secure Message', 'Reminders and Notifications', 'Software and App Updates', 'Customer Service and Support')
- .confidence in ('medium', 'high')
any of
ml.nlu_classifier(body.current_thread.text).intentswhere all hold:- .name is 'cred_theft'
- .confidence is 'high'
any of
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intentswhere all hold:- .name is 'cred_theft'
- .confidence is 'high'
any of
[subject.base, body.current_thread.text]where all hold:any of:
- . contains 'capacity'
- . contains 'limit'
- . matches '\\breach(?:\\b|ed)'
not:
all of:
- sender.email.domain.valid
any of:
- sender.email.domain.root_domain in $org_domains
- sender.email.domain.root_domain in ('sendgrid.com', 'sendgrid.net', 'twilio.com', 'swoogo.com', 'sendsafely.com', 'evolve.com', 'sendgridsolutions.com')
- headers.auth_summary.dmarc.pass
any of:
all of:
- sender.email.domain.root_domain in $high_trust_sender_root_domains
not:
- headers.auth_summary.dmarc.pass
- sender.email.domain.root_domain not in $high_trust_sender_root_domains
not:
- profile.by_sender().solicited
Inspects: body.current_thread.text, body.links, body.links[].display_url.url, body.links[].href_url.url, headers.auth_summary.dmarc.pass, sender.display_name, sender.email.domain.root_domain, sender.email.domain.valid, sender.email.local_part, subject.base, type.inbound. Sensors: beta.ocr, file.message_screenshot, ml.logo_detect, ml.nlu_classifier, profile.by_sender, regex.icontains, strings.icontains, strings.ilevenshtein, strings.ilike, strings.replace_confusables. Reference lists: $high_trust_sender_root_domains, $org_domains.
Indicators matched (52)
| Field | Match | Value |
|---|---|---|
strings.ilike | substring | *sendgrid* |
strings.ilevenshtein | fuzzy | sendgrid |
ml.logo_detect(file.message_screenshot()).brands[].name | equals | SendGrid |
ml.logo_detect(file.message_screenshot()).brands[].confidence | equals | high |
strings.ilike | substring | *twilio* |
strings.ilevenshtein | fuzzy | twilio |
strings.icontains | substring | the sendgrid team |
regex.icontains | regex | (?:Twilio|SendGrid) |
strings.icontains | substring | 1801 California St |
strings.icontains | substring | Denver, CO 80202 |
sender.email.domain.root_domain | member | selfcast.com |
sender.email.domain.root_domain | member | mailchimp.com |
40 more
sender.email.domain.root_domain | member | constantcontact.com |
sender.email.domain.root_domain | member | hubspot.com |
sender.email.domain.root_domain | member | klaviyo.com |
sender.email.domain.root_domain | member | mailgun.com |
strings.icontains | substring | sendgrid |
strings.icontains | substring | webhook |
strings.icontains | substring | endpoint |
strings.icontains | substring | api |
strings.icontains | substring | delivery |
strings.icontains | substring | event notification |
strings.icontains | substring | selfcast.com |
strings.icontains | substring | sendgrid.com |
ml.nlu_classifier(body.current_thread.text).topics[].name | member | Security and Authentication |
ml.nlu_classifier(body.current_thread.text).topics[].name | member | Secure Message |
ml.nlu_classifier(body.current_thread.text).topics[].name | member | Reminders and Notifications |
ml.nlu_classifier(body.current_thread.text).topics[].name | member | Software and App Updates |
ml.nlu_classifier(body.current_thread.text).topics[].name | member | Customer Service and Support |
ml.nlu_classifier(body.current_thread.text).topics[].confidence | member | medium |
ml.nlu_classifier(body.current_thread.text).topics[].confidence | member | high |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topics[].name | member | Security and Authentication |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topics[].name | member | Secure Message |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topics[].name | member | Reminders and Notifications |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topics[].name | member | Software and App Updates |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topics[].name | member | Customer Service and Support |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topics[].confidence | member | medium |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).topics[].confidence | member | high |
ml.nlu_classifier(body.current_thread.text).intents[].name | equals | cred_theft |
ml.nlu_classifier(body.current_thread.text).intents[].confidence | equals | high |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents[].name | equals | cred_theft |
ml.nlu_classifier(beta.ocr(file.message_screenshot()).text).intents[].confidence | equals | high |
strings.icontains | substring | capacity |
strings.icontains | substring | limit |
regex.icontains | regex | \breach(?:\b|ed) |
sender.email.domain.root_domain | member | sendgrid.com |
sender.email.domain.root_domain | member | sendgrid.net |
sender.email.domain.root_domain | member | twilio.com |
sender.email.domain.root_domain | member | swoogo.com |
sender.email.domain.root_domain | member | sendsafely.com |
sender.email.domain.root_domain | member | evolve.com |
sender.email.domain.root_domain | member | sendgridsolutions.com |