Detection rules › Splunk

GSuite Email Suspicious 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 detects suspicious attachment file extensions in GSuite emails, potentially indicating a spear-phishing attack. It leverages GSuite Gmail logs to identify emails with attachments having file extensions commonly associated with malware, such as .exe, .bat, and .js. This activity is significant as these file types are often used to deliver malicious payloads, posing a risk of compromising targeted machines. If confirmed malicious, this could lead to unauthorized code execution, data breaches, or further network infiltration.

Known false positives

  • network admin and normal user may send this file attachment as part of their day to day work. having a good protocol in attaching this file type to an e-mail may reduce the risk of having a spear phishing attack.

MITRE ATT&CK coverage

TacticTechniques
Initial Access

Rule body

name: GSuite Email Suspicious Attachment
id: 6d663014-fe92-11eb-ab07-acde48001122
version: 10
creation_date: '2021-08-16'
modification_date: '2026-05-13'
author: Teoderick Contreras, Splunk
status: production
type: Anomaly
description: The following analytic detects suspicious attachment file extensions in GSuite emails, potentially indicating a spear-phishing attack. It leverages GSuite Gmail logs to identify emails with attachments having file extensions commonly associated with malware, such as .exe, .bat, and .js. This activity is significant as these file types are often used to deliver malicious payloads, posing a risk of compromising targeted machines. If confirmed malicious, this could lead to unauthorized code execution, data breaches, or further network infiltration.
data_source:
    - G Suite Gmail
search: |-
    `gsuite_gmail` "attachment{}.file_extension_type" IN ("pl", "py", "rb", "sh", "bat", "exe", "dll", "cpl", "com", "js", "vbs", "ps1", "reg","swf", "cmd", "go")
      | 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_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: network admin and normal user may send this file attachment as part of their day to day work. having a good protocol in attaching this file type to an e-mail may reduce the risk of having a spear phishing attack.
references:
    - https://www.redhat.com/en/topics/devops/what-is-devsecops
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` "attachment{}.file_extension_type" IN ("pl", "py", "rb", "sh", "bat", "exe", "dll", "cpl", "com", "js", "vbs", "ps1", "reg","swf", "cmd", "go")

Stage 2: eval

| eval phase="plan"

Stage 3: eval

| eval severity="medium"

Stage 4: 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 5: search

| `security_content_ctime(firstTime)`

Stage 6: search

| `security_content_ctime(lastTime)`

Stage 7: search

| `gsuite_email_suspicious_attachment_filter`

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
attachment{}.file_extension_typein
  • "bat"
  • "cmd"
  • "com"
  • "cpl"
  • "dll"
  • "exe"
  • "go"
  • "js"
  • "pl"
  • "ps1"
  • "py"
  • "rb"
  • "reg"
  • "sh"
  • "swf"
  • "vbs"
field:"attachment{}.file_extension_type" kind:in
sourcetypeeq
  • gsuite:gmail:bigquery
field:"sourcetype" kind:eq value:"gsuite:gmail:bigquery"