Adversaries may use .eml files to exfiltrate data or execute malicious payloads, mimicking legitimate email traffic. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential indicators of compromise linked to advanced persistent threats.
YARA Rule
rule email_Ukraine_power_attack_attachment : mail {
meta:
author = " @yararules"
description = "Detects a possible .eml used in the Ukraine BE power attack"
ref1 = "https://twitter.com/lowcalspam/status/692625258394726400"
strings:
$filename = "filename=\"=?windows-1251?B?xO7k4PLu6jEueGxz?=\""
condition:
all of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 1 string patterns in its detection logic.
Scenario: System Administrator Emails Scheduled Job Status Reports
Description: A system administrator uses a script to generate and send email reports for scheduled jobs, which results in .eml files being created temporarily.
Filter/Exclusion: Exclude files created by the mail command or scripts located in /etc/cron.d/ or /usr/local/bin/ that are known to generate email reports.
Scenario: Email Client Auto-Generated .eml Files for Draft Emails
Description: Users in the enterprise use email clients like Microsoft Outlook or Mozilla Thunderbird, which auto-save draft emails as .eml files.
Filter/Exclusion: Exclude files located in user-specific directories such as ~/.thunderbird/ or ~/.msft/ and filter by file creation time within the last 24 hours.
Scenario: Backup System Generates .eml Files for Email Notifications
Description: A backup system like rsync or Bacula sends email notifications upon completion, generating .eml files as part of its logging process.
Filter/Exclusion: Exclude files created by the mail command or scripts in /opt/backup/scripts/ that are known to send email alerts.
Scenario: DevOps Pipeline Sends Test Emails Using mail Command
Description: A DevOps pipeline uses the mail command to send test emails during CI/CD processes, resulting in temporary .eml files.
Filter/Exclusion: Exclude files created by processes running under the jenkins or gitlab-runner user, or filter by command-line arguments containing --test or --dry-run.
Scenario: Security Tool Generates .eml Files for Email Alerts
Description: A security tool like OSSEC or Snort sends