MITRE ATT&CKtechnique
T1221 Template Injection
- Domain
- enterprise
- Tactics
- Stealth
- Platforms
- Windows
- Version
- 2.0
- Created
- 2018-10-17
Description
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.
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. 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. Examples have been seen in the wild where template injection was used to load malicious code containing an exploit.
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.
This technique may also enable Forced Authentication by injecting a SMB/HTTPS (or other credential prompting) URL and triggering an authentication attempt.
Related
Tactic · MITRE ATT&CK (1)
- TA0005 Stealth tactic
Referenced by MITRE ATT&CK · mitigates (4)
Referenced by MITRE ATT&CK · uses (12)
- G1054 MirrorFace group
- C0022 Operation Dream Job campaign
- C0001 Frankenstein campaign
- S0670 WarzoneRAT software (malware)
- G0142 Confucius group
- S0631 Chaes software (malware)
- G0100 Inception group
- G0081 Tropic Trooper group
- G0079 DarkHydrus group
- G0007 APT28 group
- G0035 Dragonfly group
- G0047 Gamaredon Group group
Referenced by CAPEC · att&ck technique (1)
- CAPEC-636 Hiding Malicious Data or Code within Files attack pattern
Referenced by Compliance · mitigates (16)
- CIS-13.8 Deploy a Network Intrusion Prevention Solution CIS Safeguard v8.1
- CIS-9.7 Deploy and Maintain Email Server Anti-Malware Protections CIS Safeguard v8.1
- NIST-CA-7 Continuous Monitoring NIST 800-53 control
- NIST-CM-2 Baseline Configuration NIST 800-53 control
- NIST-CM-6 Configuration Settings NIST 800-53 control
- NIST-CM-7 Least Functionality NIST 800-53 control
- NIST-CM-8 System Component Inventory NIST 800-53 control
- NIST-RA-5 Vulnerability Monitoring and Scanning NIST 800-53 control
- NIST-SC-44 Detonation Chambers NIST 800-53 control
- NIST-SC-7 Boundary Protection NIST 800-53 control
- NIST-SI-10 Information Input Validation NIST 800-53 control
- NIST-SI-2 Flaw Remediation NIST 800-53 control
- NIST-SI-3 Malicious Code Protection NIST 800-53 control
- NIST-SI-4 System Monitoring NIST 800-53 control
- NIST-SI-7 Software, Firmware, and Information Integrity NIST 800-53 control
- NIST-SI-8 Spam Protection NIST 800-53 control
References
- https://blog.talosintelligence.com/2017/07/template-injection.html Talos Template Injection July 2017
- https://github.com/ryhanson/phishery ryhanson phishery SEPT 2016
- http://blog.redxorblue.com/2018/07/executing-macros-from-docx-with-remote.html Redxorblue Remote Template Injection
- https://forum.anomali.com/t/credential-harvesting-and-malicious-file-delivery-using-microsoft-office-template-injection/2104 Anomali Template Injection MAR 2018
- https://docs.microsoft.com/previous-versions/office/developer/office-2007/aa338205(v=office.12) Microsoft Open XML July 2017
- https://ciberseguridad.blog/decodificando-ficheros-rtf-maliciosos/ Ciberseguridad Decoding malicious RTF files
- https://www.proofpoint.com/us/blog/threat-insight/injection-new-black-novel-rtf-template-inject-technique-poised-widespread Proofpoint RTF Injection
- https://blog.malwarebytes.com/threat-analysis/2017/10/decoy-microsoft-word-document-delivers-malware-through-rat/ MalwareBytes Template Injection OCT 2017
- https://www.sans.org/reading-room/whitepapers/testing/template-injection-attacks-bypassing-security-controls-living-land-38780 SANS Brian Wiltse Template Injection