Detect Outlook Rules in Elastic Security
Adversaries abuse Microsoft Outlook rules to achieve persistence and execute code. Malicious inbox rules can be configured to run a script or application when a specially crafted email is received. Rules are stored in the mailbox and persist across Outlook restarts and even OS reinstalls. The Ruler tool automates creation of malicious rules. Hidden inbox rules (stored without display names) are particularly stealthy.
MITRE ATT&CK
- Tactic
- Persistence
- Technique
- T1137 Office Application Startup
- Sub-technique
- T1137.005 Outlook Rules
- Canonical reference
- https://attack.mitre.org/techniques/T1137/005/
Elastic Detection Query
sequence by host.id with maxspan=5m
[process where event.type == "start"
and process.parent.name : "outlook.exe"
and process.name : ("cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe",
"mshta.exe", "rundll32.exe", "regsvr32.exe", "certutil.exe")]
// Standalone: Outlook spawning processes from user-writable directories
process where event.type == "start"
and process.parent.name : "outlook.exe"
and (
process.executable : ("*\\Users\\*", "*\\Temp\\*", "*\\AppData\\*", "*\\ProgramData\\*")
and not process.executable : "*\\Microsoft Office\\*"
)
// Standalone: Ruler tool detection
process where event.type == "start"
and (
process.name : "ruler.exe"
or (process.args : "--rules" and process.args : ("add", "--target"))
or process.command_line : "*ruler*rules*"
) Detects Outlook Rules persistence (T1137.005) via three patterns: (1) Outlook spawning known LOLBin/shell executables indicating rule-triggered execution, (2) Outlook launching processes from user-writable directories indicating 'run application' rule abuse, and (3) use of the Ruler attack tool for automated mailbox rule manipulation.
Data Sources
Required Tables
False Positives & Tuning
- Outlook add-ins or plugins that legitimately spawn child processes such as PDF readers, archiving tools, or antivirus scanners triggered by email attachments
- IT automation scripts that use Outlook COM automation and spawn helper processes for mail processing or archiving workflows
- Security awareness training platforms that send test phishing emails and use Ruler-like tooling in authorized red team exercises
Other platforms for T1137.005
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Create Malicious Outlook Inbox Rule via PowerShell (Exchange)
Expected signal: Security Event ID 4624 for Exchange PowerShell authentication. Office 365 Unified Audit Log: Operation=New-InboxRule with RunScript action. Sysmon EventCode 3 network connection to Exchange Online.
- Test 2Enumerate Inbox Rules for Hidden/Suspicious Entries
Expected signal: Sysmon EventCode 1 with powershell.exe executing Get-InboxRule. Exchange EWS audit log showing mailbox access from local machine.
- Test 3Test Ruler Tool Detection (Simulated Command)
Expected signal: Sysmon EventCode 1 with cmd.exe process. For actual Ruler execution: Image=ruler.exe, CommandLine containing '--rules' and '--trigger'. Sysmon EventCode 3 connection to Exchange EWS.
References (6)
- https://attack.mitre.org/techniques/T1137/005/
- https://silentbreaksecurity.com/malicious-outlook-rules/
- https://blog.compass-security.com/2018/09/hidden-inbox-rules-in-microsoft-exchange/
- https://github.com/sensepost/ruler
- https://github.com/sensepost/notruler
- https://docs.microsoft.com/en-us/office365/securitycompliance/detect-and-remediate-outlook-rules-forms-attack
Unlock Pro Content
Get the full detection package for T1137.005 including response playbook, investigation guide, and atomic red team tests.