PowerShell ScriptBlock: Send-MailMessage with -Attachments for Possible SMTP Data Exfiltration
Detects PowerShell Send-MailMessage usage with -Attachments, which may indicate SMTP-based data exfiltration.
FreeUnreviewedSigmamediumv1
powershell-scriptblock-send-mailmessage-with-attachments-for-possible-smtp-data--9a7afa56
title: "PowerShell ScriptBlock: Send-MailMessage with -Attachments for Possible SMTP Data Exfiltration"
id: 3eb25d1d-16fb-47e4-b3de-ed788c6fa416
status: test
description: This rule flags PowerShell script content that includes the Send-MailMessage cmdlet using the -Attachments parameter. Attackers can leverage email attachments to move data out of an environment over an external SMTP-based path. It relies on Script Block Logging telemetry that captures the executed script text.
references:
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1048.003/T1048.003.md#atomic-test-5---exfiltration-over-alternative-protocol---smtp
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.4
- https://www.ietf.org/rfc/rfc2821.txt
- https://github.com/SigmaHQ/sigma/blob/master/rules-threat-hunting/windows/powershell/powershell_script/posh_ps_send_mailmessage.yml
author: frack113, Huntrule Team
date: 2022-09-26
modified: 2024-11-01
tags:
- attack.exfiltration
- attack.t1048.003
- detection.threat-hunting
logsource:
product: windows
category: ps_script
definition: "Requirements: Script Block Logging must be enabled"
detection:
selection:
ScriptBlockText|contains: Send-MailMessage*-Attachments
condition: selection
falsepositives:
- Unknown
level: medium
license: DRL-1.1
related:
- id: 9a7afa56-4762-43eb-807d-c3dc9ffe211b
type: derived
What it detects
This rule flags PowerShell script content that includes the Send-MailMessage cmdlet using the -Attachments parameter. Attackers can leverage email attachments to move data out of an environment over an external SMTP-based path. It relies on Script Block Logging telemetry that captures the executed script text.
Known false positives
- Unknown
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.