Office Template Macros

T1137.001

Sub-technique of T1137 Office Application Startup.View on attack.mitre.org

About this technique

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:<br>
C:\Users\&lt;username&gt;\AppData\Roaming\Microsoft\Templates\Normal.dotm

Excel Personal.xlsb location:<br>
C:\Users\&lt;username&gt;\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.

Detection rules0

Rules on DetectionCode tagged with T1137.001.

Sigma0

No Sigma rules are mapped to this technique yet.

Splunk0

No Splunk rules are mapped to this technique yet.

Groups1

Software3

Campaigns1

Procedure examples5

Groups1

Used byProcedure example
GroupMuddyWater

MuddyWater has used a Word Template, Normal.dotm, for persistence.

Software3

Used byProcedure example
MalwareBackConfig

BackConfig has the ability to use hidden columns in Excel spreadsheets to store executable files or commands for VBA macros.

MalwareCobalt Strike

Cobalt Strike has the ability to use an Excel Workbook to execute additional code by enabling Office to trust macros and execute code without user permission.

MalwareROAMINGHOUSE

ROAMINGHOUSE has been loaded as a Word Template file when victims opened a decoy document placed in `%APPDATA%\Microsoft\Templates` alongside a ROAMINGHOUSE macro.

Campaigns1

Used byProcedure example
CampaignOperation AkaiRyū

During Operation AkaiRyū, MirrorFace loaded malicious Word templates containing VBA code leading to installation of UPPERCUT.

References5

  1. GlobalDotName Jun 2019 Open source
    Shukrun, S. (2019, June 2). Office Templates and GlobalDotName - A Stealthy Office Persistence Technique. Retrieved August 26, 2019.
  2. Hexacorn Office Template Macros Open source
    Hexacorn. (2017, April 17). Beyond good ol’ Run key, Part 62. Retrieved July 3, 2017.
  3. MSDN VBA in Office Open source
    Austin, J. (2017, June 6). Getting Started with VBA in Office. Retrieved July 3, 2017.
  4. Microsoft Change Normal Template Open source
    Microsoft. (n.d.). Change the Normal template (Normal.dotm). Retrieved July 3, 2017.
  5. enigma0x3 normal.dotm Open source
    Nelson, M. (2014, January 23). Maintaining Access with normal.dotm. Retrieved July 3, 2017.

Data from MITRE ATT&CK® (Enterprise). ATT&CK® is a registered trademark of The MITRE Corporation.