Cross-source coverage
T1137.001 / ATT&CK
Office Application Startup: Office Template Macros
2 rules across 2 sources.
From MITRE ATT&CK 19.2
Adversaries may abuse Microsoft Office templates to obtain persistence on a compromised system. Microsoft Office contains templates that are part of common Office applications and are used to customize styles. The base templates within the application are used each time an application starts.
Office Visual Basic for Applications (VBA) macros can be inserted into the base template and used to execute code when the respective Office application starts in order to obtain persistence. Examples for both Word and Excel have been discovered and published. By default, Word has a Normal.dotm template created that can be modified to include a malicious macro. Excel does not have a template file created by default, but one can be added that will automatically be loaded. Shared templates may also be stored and pulled from remote locations.
Word Normal.dotm location:
C:\Users\<username>\AppData\Roaming\Microsoft\Templates\Normal.dotm
Excel Personal.xlsb location:
C:\Users\<username>\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB
Adversaries may also change the location of the base template to point to their own by hijacking the application's search order, e.g. Word 2016 will first look for Normal.dotm under C:\Program Files (x86)\Microsoft Office\root\Office16\, or by modifying the GlobalDotName registry key. By modifying the GlobalDotName registry key an adversary can specify an arbitrary location, file name, and file extension to use for the template that will be loaded on application startup. To abuse GlobalDotName, adversaries may first need to register the template as a trusted document or place it in a trusted location.
An adversary may need to enable macros to execute unrestricted depending on the system or enterprise security policy on use of macros.
- Tactics
- Persistence
- Platforms
- Office Suite · Windows
- Telemetry
-
WinEventLog:SysmonWinEventLog:Microsoft-Office-Alertsm365:unified
How MITRE says to detect it DET0519
Detect Persistence via Office Template Macro Injection or Registry Hijack
Windows Analytic 1436
Adversaries inject VBA macros into Office templates such as Normal.dotm or Personal.xlsb or redirect Office template load path via registry key (GlobalDotName) to gain persistence. Template macros trigger execution of malicious code on application startup.
WinEventLog:SysmonEventCode=11WinEventLog:SysmonEventCode=15WinEventLog:SysmonEventCode=1WinEventLog:SysmonEventCode=13, 14WinEventLog:Microsoft-Office-AlertsOffice application warning or alert on macro execution from template
Office Suite Analytic 1437
Malicious VBA macros embedded in base templates like Normal.dotm or Personal.xlsb are automatically loaded and executed at startup. Template path may be hijacked to load a remote or attacker-controlled template via GlobalDotName registry setting.
m365:unifiedSet-Mailbox, Set-MailboxPolicy, Set-TrustedLocation
elastic/detection-rules
1 rule| Detection | Severity | Format |
|---|---|---|
| Persistence via Microsoft Outlook VBA | Medium | Elastic TOML |
elastic/protections-artifacts
1 rule| Detection | Severity | Format |
|---|---|---|
| Office Application Startup via Template File Modification | Undefined | Elastic TOML |