T1137.002

Office Test

Adversaries abuse the Microsoft Office 'Office Test' registry key to load an arbitrary DLL every time an Office application starts. The keys HKCU\Software\Microsoft\Office test\Special\Perf and HKLM\Software\Microsoft\Office test\Special\Perf are not created during standard Office installations, making their presence a strong indicator of persistence. APT28 (Sofacy) has used this technique operationally.

Microsoft Sentinel / Defender
kusto
// T1137.002 — Office Test Registry Key persistence detection
// The 'Office Test' key is not present in default Office installations — any occurrence is suspicious
let OfficeTestPaths = dynamic([
  "Software\\Microsoft\\Office test\\Special\\Perf",
  "Software\\Microsoft\\Office test"
]);
// Part 1: Detect creation of Office Test registry key
let OfficeTestRegCreate = DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has_all ("Microsoft", "Office test")
| project Timestamp, DeviceName, AccountName, RegistryKey, RegistryValueName, RegistryValueData,
          InitiatingProcessFileName, InitiatingProcessCommandLine, ActionType;
// Part 2: Detect Office applications loading unexpected DLLs from user-writable locations
let OfficeUnexpectedDLL = DeviceImageLoadEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName in~ ("winword.exe", "excel.exe", "powerpnt.exe", "outlook.exe", "mspub.exe")
| where FolderPath has_any ("\\Users\\", "\\Temp\\", "\\AppData\\", "\\ProgramData\\", "\\Windows\\Temp\\")
| where not (FolderPath has_any ("\\Microsoft Office\\", "\\Microsoft\\Office\\", "\\AppData\\Local\\Microsoft\\"))
| project Timestamp, DeviceName, AccountName, FileName, FolderPath,
          InitiatingProcessFileName, InitiatingProcessCommandLine;
union OfficeTestRegCreate, OfficeUnexpectedDLL
| sort by Timestamp desc
high severity high confidence

Data Sources

Windows Registry: Registry Key Creation Windows Registry: Registry Value Modification Module: Module Load Microsoft Defender for Endpoint

Required Tables

DeviceRegistryEvents DeviceImageLoadEvents

False Positives

  • Microsoft internal developers using Office Test key for legitimate testing (extremely rare in production environments)
  • Security researchers or red teamers running controlled tests on isolated systems
  • Unusual corporate Office customization tools that happen to use this registry path (very uncommon)

Unlock Pro Content

Get the full detection package for T1137.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections