Exporting Exchange Mailbox via PowerShell

Identifies the use of the Exchange PowerShell cmdlet, New-MailBoxExportRequest, to export the contents of a primary mailbox or archive to a .pst file. Adversaries may target user email to collect sensitive information.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/12/15"
  3integration = ["endpoint", "windows", "system", "sentinel_one_cloud_funnel", "m365_defender"]
  4maturity = "production"
  5min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
  6min_stack_version = "8.13.0"
  7updated_date = "2024/09/23"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Identifies the use of the Exchange PowerShell cmdlet, New-MailBoxExportRequest, to export the contents of a primary
 13mailbox or archive to a .pst file. Adversaries may target user email to collect sensitive information.
 14"""
 15false_positives = ["Legitimate exchange system administration activity."]
 16from = "now-9m"
 17index = [
 18    "logs-endpoint.events.process-*",
 19    "winlogbeat-*",
 20    "logs-windows.*",
 21    "endgame-*",
 22    "logs-system.security*",
 23    "logs-sentinel_one_cloud_funnel.*",
 24    "logs-m365_defender.event-*",
 25]
 26language = "eql"
 27license = "Elastic License v2"
 28name = "Exporting Exchange Mailbox via PowerShell"
 29note = """## Triage and analysis
 30
 31### Investigating Exporting Exchange Mailbox via PowerShell
 32
 33Email mailboxes and their information can be valuable assets for attackers. Company mailboxes often contain sensitive information such as login credentials, intellectual property, financial data, and personal information, making them high-value targets for malicious actors.
 34
 35The `New-MailBoxExportRequest` cmdlet is used to begin the process of exporting contents of a primary mailbox or archive to a .pst file. Note that this is done on a per-mailbox basis and this cmdlet is available only in on-premises Exchange.
 36
 37Attackers can abuse this functionality in preparation for exfiltrating contents, which is likely to contain sensitive and strategic data.
 38
 39#### Possible investigation steps
 40
 41- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 42- Investigate other alerts associated with the user/host during the past 48 hours.
 43- Investigate the export operation:
 44  - Identify the user account that performed the action and whether it should perform this kind of action.
 45  - Contact the account owner and confirm whether they are aware of this activity.
 46  - Check if this operation was approved and performed according to the organization's change management policy.
 47  - Retrieve the operation status and use the `Get-MailboxExportRequest` cmdlet to review previous requests.
 48  - By default, no group in Exchange has the privilege to import or export mailboxes. Investigate administrators that assigned the "Mailbox Import Export" privilege for abnormal activity.
 49- Investigate if there is a significant quantity of export requests in the alert timeframe. This operation is done on a per-mailbox basis and can be part of a mass export.
 50- If the operation was completed successfully:
 51  - Check if the file is on the path specified in the command.
 52  - Investigate if the file was compressed, archived, or retrieved by the attacker for exfiltration.
 53
 54### False positive analysis
 55
 56- This mechanism can be used legitimately. Analysts can dismiss the alert if the administrator is aware of the activity and it is done with proper approval.
 57
 58### Response and remediation
 59
 60- Initiate the incident response process based on the outcome of the triage.
 61- If the involved host is not the Exchange server, isolate the host to prevent further post-compromise behavior.
 62- Use the `Remove-MailboxExportRequest` cmdlet to remove fully or partially completed export requests.
 63- Prioritize cases that involve personally identifiable information (PII) or other classified data.
 64- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
 65- Review the privileges of users with the "Mailbox Import Export" privilege to ensure that the least privilege principle is being followed.
 66- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 67- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 68- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
 69"""
 70references = [
 71    "https://www.volexity.com/blog/2020/12/14/dark-halo-leverages-solarwinds-compromise-to-breach-organizations/",
 72    "https://docs.microsoft.com/en-us/powershell/module/exchange/new-mailboxexportrequest?view=exchange-ps",
 73    "https://www.elastic.co/security-labs/siestagraph-new-implant-uncovered-in-asean-member-foreign-ministry",
 74]
 75risk_score = 47
 76rule_id = "6aace640-e631-4870-ba8e-5fdda09325db"
 77setup = """## Setup
 78
 79If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 80events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 81Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 82`event.ingested` to @timestamp.
 83For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 84"""
 85severity = "medium"
 86tags = [
 87    "Domain: Endpoint",
 88    "OS: Windows",
 89    "Use Case: Threat Detection",
 90    "Tactic: Collection",
 91    "Tactic: Execution",
 92    "Resources: Investigation Guide",
 93    "Data Source: Elastic Endgame",
 94    "Data Source: Elastic Defend",
 95    "Data Source: SentinelOne",
 96    "Data Source: Microsoft Defender for Endpoint",
 97    "Data Source: System",
 98]
 99timestamp_override = "event.ingested"
100type = "eql"
101
102query = '''
103process where host.os.type == "windows" and event.type == "start" and
104  process.name: ("powershell.exe", "pwsh.exe", "powershell_ise.exe") and
105  process.command_line : ("*MailboxExportRequest*", "*-Mailbox*-ContentFilter*")
106'''
107
108
109[[rule.threat]]
110framework = "MITRE ATT&CK"
111[[rule.threat.technique]]
112id = "T1005"
113name = "Data from Local System"
114reference = "https://attack.mitre.org/techniques/T1005/"
115
116[[rule.threat.technique]]
117id = "T1114"
118name = "Email Collection"
119reference = "https://attack.mitre.org/techniques/T1114/"
120[[rule.threat.technique.subtechnique]]
121id = "T1114.002"
122name = "Remote Email Collection"
123reference = "https://attack.mitre.org/techniques/T1114/002/"
124
125
126
127[rule.threat.tactic]
128id = "TA0009"
129name = "Collection"
130reference = "https://attack.mitre.org/tactics/TA0009/"
131[[rule.threat]]
132framework = "MITRE ATT&CK"
133[[rule.threat.technique]]
134id = "T1059"
135name = "Command and Scripting Interpreter"
136reference = "https://attack.mitre.org/techniques/T1059/"
137[[rule.threat.technique.subtechnique]]
138id = "T1059.001"
139name = "PowerShell"
140reference = "https://attack.mitre.org/techniques/T1059/001/"
141
142
143
144[rule.threat.tactic]
145id = "TA0002"
146name = "Execution"
147reference = "https://attack.mitre.org/tactics/TA0002/"

Triage and analysis

Investigating Exporting Exchange Mailbox via PowerShell

Email mailboxes and their information can be valuable assets for attackers. Company mailboxes often contain sensitive information such as login credentials, intellectual property, financial data, and personal information, making them high-value targets for malicious actors.

The New-MailBoxExportRequest cmdlet is used to begin the process of exporting contents of a primary mailbox or archive to a .pst file. Note that this is done on a per-mailbox basis and this cmdlet is available only in on-premises Exchange.

Attackers can abuse this functionality in preparation for exfiltrating contents, which is likely to contain sensitive and strategic data.

Possible investigation steps

  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Investigate the export operation:
    • Identify the user account that performed the action and whether it should perform this kind of action.
    • Contact the account owner and confirm whether they are aware of this activity.
    • Check if this operation was approved and performed according to the organization's change management policy.
    • Retrieve the operation status and use the Get-MailboxExportRequest cmdlet to review previous requests.
    • By default, no group in Exchange has the privilege to import or export mailboxes. Investigate administrators that assigned the "Mailbox Import Export" privilege for abnormal activity.
  • Investigate if there is a significant quantity of export requests in the alert timeframe. This operation is done on a per-mailbox basis and can be part of a mass export.
  • If the operation was completed successfully:
    • Check if the file is on the path specified in the command.
    • Investigate if the file was compressed, archived, or retrieved by the attacker for exfiltration.

False positive analysis

  • This mechanism can be used legitimately. Analysts can dismiss the alert if the administrator is aware of the activity and it is done with proper approval.

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • If the involved host is not the Exchange server, isolate the host to prevent further post-compromise behavior.
  • Use the Remove-MailboxExportRequest cmdlet to remove fully or partially completed export requests.
  • Prioritize cases that involve personally identifiable information (PII) or other classified data.
  • Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
  • Review the privileges of users with the "Mailbox Import Export" privilege to ensure that the least privilege principle is being followed.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

References

Related rules

to-top