Detection: Email files written outside of the Outlook directory

Description

The following analytic detects email files (.pst or .ost) being created outside the standard Outlook directories. It leverages the Endpoint.Filesystem data model to identify file creation events and filters for email files not located in "C:\Users*\My Documents\Outlook Files*" or "C:\Users*\AppData\Local\Microsoft\Outlook*". This activity is significant as it may indicate data exfiltration or unauthorized access to email data. If confirmed malicious, an attacker could potentially access sensitive email content, leading to data breaches or further exploitation within the network.

 1
 2| tstats `security_content_summariesonly`
 3  count values(Filesystem.file_path) as file_path
 4        min(_time) as firstTime
 5        max(_time) as lastTime
 6
 7FROM datamodel=Endpoint.Filesystem WHERE
 8
 9Filesystem.action IN (
10    "created",
11    "modified"
12)
13Filesystem.file_name IN (
14    "*.pst",
15    "*.ost"
16)
17NOT Filesystem.file_path IN (
18    "C:\\Users\\*\\My Documents\\Outlook Files\\*",
19    "C:\\Users\\*\\AppData\\Local\\Microsoft\\Outlook*"
20)
21
22BY Filesystem.action Filesystem.dest Filesystem.file_access_time
23   Filesystem.file_create_time Filesystem.file_hash Filesystem.file_modify_time
24   Filesystem.file_name Filesystem.file_path Filesystem.file_acl
25   Filesystem.file_size Filesystem.process_guid Filesystem.process_id
26   Filesystem.user Filesystem.vendor_product
27
28
29| `drop_dm_object_name("Filesystem")`
30
31| `security_content_ctime(firstTime)`
32
33| `security_content_ctime(lastTime)`
34
35| `email_files_written_outside_of_the_outlook_directory_filter`

Data Source

Name Platform Sourcetype Source
Sysmon EventID 11 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
email_files_written_outside_of_the_outlook_directory_filter search *
email_files_written_outside_of_the_outlook_directory_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1114.001 Local Email Collection Collection
Exploitation
DE.AE
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Finding (Notable) No
Creates Intermediate Finding (Risk Event) Yes
Anomaly detections generate Intermediate Findings (Risk Events). They do not generate a Finding (Notable) directly.

Implementation

To successfully implement this search, you must be ingesting data that records the file-system activity from your hosts to populate the Endpoint.Filesystem data model node. This is typically populated via endpoint detection-and-response product, such as Carbon Black, or by other endpoint data sources, such as Sysmon. The data used for this search is typically generated via logs that report file-system reads and writes.

Known False Positives

Administrators and users sometimes prefer backing up their email data by moving the email files into a different folder. These attempts will be detected by the search. You should confirm that the activity is legitimate and modify the search to add exclusions, as necessary.

Associated Analytic Story

Intermediate Findings

Message Entity Field Entity Type Risk Score
A new email file [$file_name$] was written to [$file_path$] on endpoint $dest$ by user $user$. dest system 20

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub |

Version: 13