← Back to SOC feed Coverage →

Detects possible template injections in Office documents, particularly those that load content from external sources

yara HIGH signature-base
T1221
florian-roth
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at signature-base →
Retrieved: 2026-08-07T11:00:00Z · Confidence: medium

Hunt Hypothesis

This rule detects adversaries leveraging Office document template injection (T1221) to silently fetch and execute malicious payloads from external sources, potentially bypassing standard attachment scrutiny. SOC teams should proactively hunt for this behavior in Azure Sentinel because these remote content requests often evade traditional email security controls, serving as a critical early indicator of supply chain compromises or initial access attacks that could lead to lateral movement.

YARA Rule

rule EXPL_Office_TemplateInjection_Aug19 {
   meta:
      old_rule_name = "EXPL_Office_TemplateInjection"
      description = "Detects possible template injections in Office documents, particularly those that load content from external sources"
      author = "Florian Roth"
      reference = "https://attack.mitre.org/techniques/T1221/"
      date = "2019-08-22"
      modified = "2025-03-20"
      score = 75
      hash = "f2bdf3716b39d29a9c6c3b7b3355e935594b8d8e9149a784a59dc2381fa1628a"
      id = "2a7e1021-97be-510b-8826-d15ac06ed00e"
   strings:
      $x1 = /attachedTemplate" Target="http[s]?:\/\/[^"]{4,60}/ ascii

      $fp1 = ".sharepoint.com"  // this could cause false negatives if the malicious template is hosted on sharepoint
      $fp2 = ".office.com"  // this could cause false negatives if the malicious template is hosted on office.com
   condition:
      filesize < 20MB
      and $x1
      and not 1 of ($fp*)
}

Deployment Notes

This YARA rule can be deployed in the following contexts:

This rule contains 3 string patterns in its detection logic.

MITRE ATT&CK Context

References

False Positive Guidance

Here are 5 specific false positive scenarios for the “Template Injection in Office Documents” detection rule, including suggested filters and exclusions:

Original source: https://github.com/Neo23x0/signature-base/blob/main/yara/susp_office_template_injection.yar