Salesforce infrastructure abuse

Identifies messages that resemble credential theft, originating from Salesforce. Salesforce infrastrcture abuse has been observed recently to send phishing attacks.

Sublime rule (View on GitHub)

  1name: "Salesforce infrastructure abuse"
  2description: "Identifies messages that resemble credential theft, originating from Salesforce. Salesforce infrastrcture abuse has been observed recently to send phishing attacks."
  3type: "rule"
  4severity: "medium"
  5source: |
  6  type.inbound
  7  
  8  // we look at the return-path because many times in the abuse
  9  // we've seen, the From is a custom domain
 10  and headers.return_path.domain.root_domain == "salesforce.com"
 11  and length(attachments) == 0
 12  // there are external links (not org or SF domains)
 13  and length(filter(body.links,
 14                    .href_url.domain.domain not in $org_domains
 15                    and .href_url.domain.root_domain not in (
 16                      "salesforce.com",
 17                      "force.com",
 18                      "site.com", // salesforce CRM
 19                      "agentforce.com"
 20                    )
 21             )
 22  ) > 0
 23  and (
 24    (
 25      any(ml.nlu_classifier(body.current_thread.text).intents,
 26          .name == "cred_theft" and .confidence == "high"
 27      )
 28      and ml.nlu_classifier(body.current_thread.text).language == "english"
 29    )
 30    // subject match when cred_theft doesn't match
 31    // high confidence observed subject intros in the format of "Urgent Thing: ..."
 32    or regex.icontains(subject.subject,
 33                       '^(?:(?:Final|Last)?\s*Warning|(?:Final|Last|Legal|Critical|Content Violation)?\s*(?:Alert|Noti(?:ce|fication))|Appeal Required|Time.Sensitive|Critical.Alert|Important|Copyright Issue)\s*:\s*'
 34    )
 35    or any(ml.logo_detect(file.message_screenshot()).brands,
 36           .name in ("Facebook", "Meta", "Instagram", "Threads")
 37           and .confidence in ("medium", "high")
 38    )
 39    // any of the links are for newly registered domains
 40    or any(filter(body.links,
 41                  .href_url.domain.domain not in $org_domains
 42                  and .href_url.domain.root_domain not in (
 43                    "salesforce.com",
 44                    "force.com",
 45                    "site.com", // salesforce CRM
 46                    "agentforce.com"
 47                  )
 48           ),
 49           network.whois(.href_url.domain).days_old < 30
 50    )
 51    // all links lead to a url shortener domain
 52    or (
 53        length(body.links) > 0
 54        and all(body.links, .href_url.domain.root_domain in $url_shorteners)
 55      )
 56  )
 57  and 1 of (
 58    ( // sender domain matches no body domains
 59      length(body.links) > 0
 60      and all(body.links,
 61              (
 62                .href_url.domain.root_domain != sender.email.domain.root_domain
 63                and .href_url.domain.root_domain not in (
 64                  "salesforce.com",
 65                  "force.com",
 66                  "site.com",
 67                  "agentforce.com"
 68                )
 69              )
 70              or .href_url.domain.root_domain is null
 71      )
 72    ),
 73    any(recipients.to,
 74        .email.domain.valid
 75        and any(body.links,
 76                strings.icontains(.href_url.url, ..email.email)
 77                or any(beta.scan_base64(.href_url.url,
 78                                        format="url",
 79                                        ignore_padding=true
 80                       ),
 81                       strings.icontains(., ...email.email)
 82                )
 83                or any(beta.scan_base64(.href_url.fragment, ignore_padding=true),
 84                       strings.icontains(., ...email.email)
 85                )
 86                // cloudflare turnstile or phishing warning page
 87                or strings.icontains(ml.link_analysis(., mode="aggressive").final_dom.display_text,
 88                                     "cloudflare"
 89                )
 90        )
 91    ),
 92    regex.icontains(subject.subject,
 93                    "termination.*notice",
 94                    "38417",
 95                    ":completed",
 96                    "[il1]{2}mit.*ma[il1]{2} ?bo?x",
 97                    "[il][il][il]egai[ -]",
 98                    "[li][li][li]ega[li] attempt",
 99                    "[ng]-?[io]n .*block",
100                    "[ng]-?[io]n .*cancel",
101                    "[ng]-?[io]n .*deactiv",
102                    "[ng]-?[io]n .*disabl",
103                    "action.*required",
104                    "abandon.*package",
105                    "about.your.account",
106                    "acc(ou)?n?t (is )?on ho[li]d",
107                    "acc(ou)?n?t.*terminat",
108                    "acc(oun)?t.*[il1]{2}mitation",
109                    "access.*limitation",
110                    "account (will be )?block",
111                    "account.*de-?activat",
112                    "account.*locked",
113                    "account.*restrict",
114                    "account.*re-verification",
115                    "account.*security",
116                    "account.*suspension",
117                    "account.has.been",
118                    "account.has.expired",
119                    "account.will.be.blocked",
120                    "account v[il]o[li]at",
121                    "activity.*acc(oun)?t",
122                    "almost.full",
123                    "app[li]e.[il]d",
124                    "appeal required",
125                    "authenticate.*account",
126                    "been.*suspend",
127                    "clos.*of.*account.*processed",
128                    "confirm.your.account",
129                    "copyright (?:restriction|infringment)",
130                    "courier.*able",
131                    "crediential.*notif",
132                    "Critical Alert",
133                    "deactivation.*in.*progress",
134                    "delivery.*attempt.*failed",
135                    "document.received",
136                    "documented.*shared.*with.*you",
137                    "dropbox.*document",
138                    "e-?ma[il1]+ .{010}suspen",
139                    "e-?ma[il1]{1} user",
140                    "e-?ma[il1]{2} acc",
141                    "e-?ma[il1]{2}.*up.?grade",
142                    "e.?ma[il1]{2}.*server",
143                    "e.?ma[il1]{2}.*suspend",
144                    "email.update",
145                    "faxed you",
146                    "final notice",
147                    "fraud(ulent)?.*charge",
148                    "from.helpdesk",
149                    "fu[il1]{2}.*ma[il1]+[ -]?box",
150                    "has.been.*suspended",
151                    "has.been.limited",
152                    "have.locked",
153                    "he[li]p ?desk upgrade",
154                    "heipdesk",
155                    "i[il]iega[il]",
156                    "ii[il]ega[il]",
157                    "immediate action",
158                    "incoming e?mail",
159                    "incoming.*fax",
160                    "lock.*security",
161                    "ma[il1]{1}[ -]?box.*quo",
162                    "ma[il1]{2}[ -]?box.*fu[il1]",
163                    "ma[il1]{2}box.*[il1]{2}mit",
164                    "ma[il1]{2}box stor",
165                    "mail on.?hold",
166                    "mail.*box.*migration",
167                    "mail.*de-?activat",
168                    "mail.update.required",
169                    "mails.*pending",
170                    "messages.*pending",
171                    "missed.*shipping.*notification",
172                    "missed.shipment.notification",
173                    "must.update.your.account",
174                    "new [sl][io]g?[nig][ -]?in from",
175                    "new voice ?-?mail",
176                    "notifications.*pending",
177                    "office.*3.*6.*5.*suspend",
178                    "office365",
179                    "on google docs with you",
180                    "online doc",
181                    "password.*compromised",
182                    "periodic maintenance",
183                    "potential(ly)? unauthorized",
184                    "refund not approved",
185                    "restrictions applied",
186                    "report",
187                    "revised.*policy",
188                    "scam",
189                    "scanned.?invoice",
190                    "secured?.update",
191                    "security breach",
192                    "securlty",
193                    "signed.*delivery",
194                    "social media",
195                    "status of your .{314}? ?delivery",
196                    "susp[il1]+c[il1]+ous.*act[il1]+v[il1]+ty",
197                    "suspicious.*sign.*[io]n",
198                    "suspicious.activit",
199                    "temporar(il)?y deactivate",
200                    "temporar[il1]{2}y disab[li]ed",
201                    "temporarily.*lock",
202                    "time.sensitive",
203                    "un-?usua[li].activity",
204                    "unable.*deliver",
205                    "unauthorized.*activit",
206                    "unauthorized.device",
207                    "unauthorized.use",
208                    "undelivered message",
209                    "unread.*doc",
210                    "unusual.activity",
211                    "upgrade.*account",
212                    "upgrade.notice",
213                    "urgent message",
214                    "urgent.verification",
215                    "v[il1]o[li1]at[il1]on security",
216                    "va[il1]{1}date.*ma[il1]{2}[ -]?box",
217                    "verification ?-?require",
218                    "verification( )?-?need",
219                    "verify.your?.account",
220                    "web ?-?ma[il1]{2}",
221                    "web[ -]?ma[il1]{2}",
222                    "will.be.suspended",
223                    "your (customer )?account .as",
224                    "your.office.365",
225                    "your.online.access",
226                    "Critical.Notice",
227                    "Restore.Access",
228                    // https://github.com/sublime-security/static-files/blob/main/suspicious_subjects.txt
229                    "account has been limited",
230                    "action required",
231                    "almost full",
232                    "apd notifi cation",
233                    "are you at your desk",
234                    "are you available",
235                    "attached file to docusign",
236                    "banking is temporarily unavailable",
237                    "bankofamerica",
238                    "closing statement invoice",
239                    "completed: docusign",
240                    "de-activation of",
241                    "delivery attempt",
242                    "delivery stopped for shipment",
243                    "detected suspicious",
244                    "detected suspicious actvity",
245                    "docu sign",
246                    "document for you",
247                    "document has been sent to you via docusign",
248                    "document is ready for signature",
249                    "docusign",
250                    "encrypted message",
251                    "failed delivery",
252                    "fedex tracking",
253                    "file was shared",
254                    "freefax",
255                    "fwd: due invoice paid",
256                    "has shared",
257                    "inbox is full",
258                    "invitation to comment",
259                    "invitation to edit",
260                    "invoice due",
261                    "left you a message",
262                    "message from",
263                    "new message",
264                    "new voicemail",
265                    "on desk",
266                    "out of space",
267                    "password reset",
268                    "payment status",
269                    "quick reply",
270                    "re: w-2",
271                    "required",
272                    "required: completed docusign",
273                    "remittance",
274                    "ringcentral",
275                    "scanned image",
276                    "secured files",
277                    "secured pdf",
278                    "security alert",
279                    "new sign-in",
280                    "new sign in",
281                    "sign-in attempt",
282                    "sign in attempt",
283                    "staff review",
284                    "suspicious activity",
285                    "unrecognized login attempt",
286                    "upgrade immediately",
287                    "urgent",
288                    "wants to share",
289                    "w2",
290                    "you have notifications pending",
291                    "your account",
292                    'your (?:\w+\s+){0,1}\s*account',
293                    "your amazon order",
294                    "your document settlement",
295                    "your order with amazon",
296                    "your password has been compromised",
297    ),
298    any($suspicious_subjects, strings.icontains(subject.subject, .))
299  )
300  and (
301    // if the From is a custom domain, check that it's an unknown sender
302    // otherwise, it should be from salesforce
303    (
304      sender.email.domain.domain == "salesforce.com"
305      and any(headers.hops,
306              any(.fields,
307                  .name == "X-SFDC-EmailCategory"
308                  and .value in (
309                    "apiMassMail",
310                    "networksNewUser",
311                    "Not Specified"
312                  )
313              )
314      )
315      // negate "meta" emails from the mentioned org itself
316      // for example, subject: "a sandbox has been deleted for org ID, a1b2c3"
317      // the org ID will appear in the X-SFDC-LK header
318      and not any(headers.hops,
319                  any(.fields,
320                      .name == "X-SFDC-LK"
321                      and strings.ends_with(subject.subject, .value)
322                  )
323      )
324    )
325    or (
326      (
327        (
328          profile.by_sender().prevalence in ("new", "outlier")
329          and not profile.by_sender().solicited
330        )
331        or (
332          profile.by_sender().any_messages_malicious_or_spam
333          and not profile.by_sender().any_messages_benign
334        )
335      )
336  
337      // negate highly trusted sender domains unless they fail DMARC authentication
338      and (
339        (
340          sender.email.domain.root_domain in $high_trust_sender_root_domains
341          and not headers.auth_summary.dmarc.pass
342        )
343        or sender.email.domain.root_domain not in $high_trust_sender_root_domains
344      )
345    )
346  )  
347attack_types:
348  - "Credential Phishing"
349tactics_and_techniques:
350  - "Evasion"
351  - "Social engineering"
352detection_methods:
353  - "Content analysis"
354  - "Header analysis"
355  - "Natural Language Understanding"
356  - "URL analysis"
357id: "78a77c70-4008-545a-812f-bde793b72c29"
to-top