T1574.012

COR_PROFILER

Adversaries abuse the .NET Common Language Runtime (CLR) profiling API via the COR_PROFILER and COR_ENABLE_PROFILING environment variables to load malicious DLLs into every .NET process. Setting COR_ENABLE_PROFILING=1 and COR_PROFILER={CLSID} causes any .NET application to load the registered COM profiler DLL. Starting with .NET 4.0, the COR_PROFILER_PATH variable can directly specify the DLL path without COM registration, enabling in-memory persistence. Blue Mockingbird used wmic.exe to set these registry variables system-wide, loading a malicious DLL into .NET processes. The Invisi-Shell tool uses this technique to bypass PowerShell logging. DarkTortilla malware checks for COR_ENABLE_PROFILING to detect sandbox analysis.

Microsoft Sentinel / Defender
kusto
let CORProfilerKeys = dynamic([
  "COR_ENABLE_PROFILING",
  "COR_PROFILER",
  "COR_PROFILER_PATH",
  "CORECLR_ENABLE_PROFILING",
  "CORECLR_PROFILER",
  "CORECLR_PROFILER_PATH"
]);
DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has "Environment"
| where RegistryValueName in~ (CORProfilerKeys)
| where not(InitiatingProcessFileName in~ ("msiexec.exe", "svchost.exe", "services.exe"))
| project Timestamp, DeviceName, AccountName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessFileName
| sort by Timestamp desc
| union (
    DeviceProcessEvents
    | where Timestamp > ago(24h)
    | where ProcessCommandLine has_any (CORProfilerKeys)
    | project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName
)
| sort by Timestamp desc
high severity high confidence

Data Sources

Windows Registry: Registry Key Modification Process: Process Creation Microsoft Defender for Endpoint

Required Tables

DeviceRegistryEvents DeviceProcessEvents

False Positives

  • Legitimate .NET profiling tools (dotMemory, dotTrace, JetBrains Rider) that set COR_PROFILER during development sessions
  • Performance monitoring platforms (Dynatrace, New Relic, AppDynamics) that inject .NET agents via COR_PROFILER
  • Code coverage tools (OpenCover, Coverlet) used in CI/CD pipelines that use COR_PROFILER for instrumentation
  • Visual Studio diagnostic and performance profiling sessions

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections