Detection rules › Splunk

Gsuite Email Suspicious Subject With Attachment

Status
production
Severity
low
Group by
"destination{}.address", "destination{}.service", "source.address", num_message_attachments, phase, severity, subject
Author
Teoderick Contreras, Splunk
Source
github.com/splunk/security_content

The following analytic identifies Gsuite emails with suspicious subjects and attachments commonly used in spear phishing attacks. It leverages Gsuite email logs, focusing on specific keywords in the subject line and known malicious file types in attachments. This activity is significant for a SOC as spear phishing is a prevalent method for initial compromise, often leading to further malicious actions. If confirmed malicious, this activity could result in unauthorized access, data exfiltration, or further malware deployment, posing a significant risk to the organization's security.

Known false positives

  • normal user or normal transaction may contain the subject and file type attachment that this detection try to search.

MITRE ATT&CK coverage

TacticTechniques
Initial Access

Rule body

name: Gsuite Email Suspicious Subject With Attachment
id: 8ef3971e-00f2-11ec-b54f-acde48001122
version: 10
creation_date: '2021-08-19'
modification_date: '2026-05-13'
author: Teoderick Contreras, Splunk
status: production
type: Anomaly
description: The following analytic identifies Gsuite emails with suspicious subjects and attachments commonly used in spear phishing attacks. It leverages Gsuite email logs, focusing on specific keywords in the subject line and known malicious file types in attachments. This activity is significant for a SOC as spear phishing is a prevalent method for initial compromise, often leading to further malicious actions. If confirmed malicious, this activity could result in unauthorized access, data exfiltration, or further malware deployment, posing a significant risk to the organization's security.
data_source:
    - G Suite Gmail
search: |-
    `gsuite_gmail` num_message_attachments > 0 subject IN ("*dhl*", "* ups *", "*delivery*", "*parcel*", "*label*", "*invoice*", "*postal*", "* fedex *", "* usps *", "* express *", "*shipment*", "*Banking/Tax*","*shipment*", "*new order*") attachment{}.file_extension_type IN ("doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf", "zip", "rar", "html","htm","hta")
      | rex field=source.from_header_address "[^@]+@(?<source_domain>[^@]+)"
      | rex field=destination{}.address "[^@]+@(?<dest_domain>[^@]+)"
      | where not source_domain="internal_test_email.com" and dest_domain="internal_test_email.com"
      | eval phase="plan"
      | eval severity="medium"
      | stats count min(_time) as firstTime max(_time) as lastTime values(attachment{}.file_extension_type) as email_attachments, values(attachment{}.sha256) as attachment_sha256, values(payload_size) as payload_size
        BY destination{}.service num_message_attachments subject
           destination{}.address source.address phase
           severity
      | `security_content_ctime(firstTime)`
      | `security_content_ctime(lastTime)`
      | `gsuite_email_suspicious_subject_with_attachment_filter`
how_to_implement: To successfully implement this search, you need to be ingesting logs related to gsuite having the file attachment metadata like file type, file extension, source email, destination email, num of attachment and etc.
known_false_positives: normal user or normal transaction may contain the subject and file type attachment that this detection try to search.
references:
    - https://www.redhat.com/en/topics/devops/what-is-devsecops
    - https://www.mandiant.com/resources/top-words-used-in-spear-phishing-attacks
intermediate_findings:
    entities:
        - field: destination{}.address
          type: user
          score: 20
          message: Suspicious email from $source.address$ to $destination{}.address$
threat_objects:
    - field: source.address
      type: email_address
analytic_story:
    - Dev Sec Ops
asset_type: GSuite
mitre_attack_id:
    - T1566.001
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: cloud
security_domain: endpoint

Stages and Predicates

Stage 1: search

`gsuite_gmail` num_message_attachments > 0 subject IN ("*dhl*", "* ups *", "*delivery*", "*parcel*", "*label*", "*invoice*", "*postal*", "* fedex *", "* usps *", "* express *", "*shipment*", "*Banking/Tax*","*shipment*", "*new order*") attachment{}.file_extension_type IN ("doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf", "zip", "rar", "html","htm","hta")

Stage 2: rex

| rex field=source.from_header_address "[^@]+@(?<source_domain>[^@]+)"

Stage 3: rex

| rex field=destination{}.address "[^@]+@(?<dest_domain>[^@]+)"

Stage 4: where

| where not source_domain="internal_test_email.com" and dest_domain="internal_test_email.com"

Stage 5: eval

| eval phase="plan"

Stage 6: eval

| eval severity="medium"

Stage 7: stats

| stats count min(_time) as firstTime max(_time) as lastTime values(attachment{}.file_extension_type) as email_attachments, values(attachment{}.sha256) as attachment_sha256, values(payload_size) as payload_size
    BY destination{}.service num_message_attachments subject
       destination{}.address source.address phase
       severity

Stage 8: search

| `security_content_ctime(firstTime)`

Stage 9: search

| `security_content_ctime(lastTime)`

Stage 10: search

| `gsuite_email_suspicious_subject_with_attachment_filter`

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
source_domaineq"internal_test_email.com"excludes:source_domain

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
attachment{}.file_extension_typein
  • "doc"
  • "docx"
  • "hta"
  • "htm"
  • "html"
  • "pdf"
  • "ppt"
  • "pptx"
  • "rar"
  • "xls"
  • "xlsx"
  • "zip"
field:"attachment{}.file_extension_type" kind:in
dest_domaineq
  • "internal_test_email.com"
field:"dest_domain" kind:eq
num_message_attachmentsgt
  • 0
field:"num_message_attachments" kind:gt value:"0"
sourcetypeeq
  • gsuite:gmail:bigquery
field:"sourcetype" kind:eq value:"gsuite:gmail:bigquery"
subjectin
  • "* express *"
  • "* fedex *"
  • "* ups *"
  • "* usps *"
  • "*Banking/Tax*"
  • "*delivery*"
  • "*dhl*"
  • "*invoice*"
  • "*label*"
  • "*new order*"
  • "*parcel*"
  • "*postal*"
  • "*shipment*"
field:"subject" kind:in