MITRE ATT&CK / Techniques / T1221

Template Injection

ID
T1221
Tactics
TA0005 Stealth
Platforms
Windows
Data sources
Process Creation, Network Connection Creation
Source
attack.mitre.org
MITRE last modified
12 May 2026

Adversaries may create or modify references in user document templates to conceal malicious code or force authentication attempts. For example, Microsoft’s Office Open XML (OOXML) specification defines an XML-based format for Office documents (.docx, xlsx, .pptx) to replace older binary formats (.doc, .xls, .ppt). OOXML files are packed together ZIP archives compromised of various XML files, referred to as parts, containing properties that collectively define how a document is rendered.[3]

Properties within parts may reference shared public resources accessed via online URLs. For example, template properties may reference a file, serving as a pre-formatted document blueprint, that is fetched when the document is loaded.

Adversaries may abuse these templates to initially conceal malicious code to be executed via user documents. Template references injected into a document may enable malicious payloads to be fetched and executed when the document is loaded.[4] These documents can be delivered via other techniques such as Phishing and/or Taint Shared Content and may evade static detections since no typical indicators (VBA macro, script, etc.) are present until after the malicious payload is fetched.[5] Examples have been seen in the wild where template injection was used to load malicious code containing an exploit.[6]

Adversaries may also modify the *\template control word within an .rtf file to similarly conceal then download malicious code. This legitimate control word value is intended to be a file destination of a template file resource that is retrieved and loaded when an .rtf file is opened. However, adversaries may alter the bytes of an existing .rtf file to insert a template control word field to include a URL resource of a malicious payload.[7][8]

This technique may also enable Forced Authentication by injecting a SMB/HTTPS (or other credential prompting) URL and triggering an authentication attempt.[1][9][10]

Detection

Mitigations (4)

M1017 User Training

Train users to identify social engineering techniques and spearphishing emails that could be used to deliver malicious documents.

M1031 Network Intrusion Prevention

Network/Host intrusion prevention systems, antivirus, and detonation chambers can be employed to prevent documents from fetching and/or executing malicious payloads.[1]

M1042 Disable or Remove Feature or Program

Consider disabling Microsoft Office macros/active content to prevent the execution of malicious payloads in documents [2], though this setting may not mitigate the Forced Authentication use for this technique.

M1049 Antivirus/Antimalware

Network/Host intrusion prevention systems, antivirus, and detonation chambers can be employed to prevent documents from fetching and/or executing malicious payloads.[1]

Groups (8)

Software (2)

References

  1. Anomali Template Injection MAR 2018
  2. Microsoft Disable Macros
  3. Microsoft Open XML July 2017
  4. SANS Brian Wiltse Template Injection
  5. Redxorblue Remote Template Injection
  6. MalwareBytes Template Injection OCT 2017
  7. Proofpoint RTF Injection
  8. Ciberseguridad Decoding malicious RTF files
  9. Talos Template Injection July 2017
  10. ryhanson phishery SEPT 2016