Adversaries may leverage the COR_PROFILER environment variable to hijack the execution flow of programs that load the .NET CLR. The COR_PROFILER is a .NET Framework feature which allows developers to specify an unmanaged (or external of .NET) profiling DLL to be loaded into each .NET process that loads the Common Language Runtime (CLR). These profilers are designed to monitor, troubleshoot, and debug managed code executed by the .NET CLR.(Citation: Microsoft Profiling Mar 2017)(Citation: Microsoft COR_PROFILER Feb 2013)
The COR_PROFILER environment variable can be set at various scopes (system, user, or process) resulting in different levels of influence. System and user-wide environment variable scopes are specified in the Registry, where a Component Object Model (COM) object can be registered as a profiler DLL. A process scope COR_PROFILER can also be created in-memory without modifying the Registry. Starting with .NET Framework 4, the profiling DLL does not need to be registered as long as the location of the DLL is specified in the COR_PROFILER_PATH environment variable.(Citation: Microsoft COR_PROFILER Feb 2013)
Adversaries may abuse COR_PROFILER to establish persistence that executes a malicious DLL in the context of all .NET processes every time the CLR is invoked. The COR_PROFILER can also be used to elevate privileges (ex: Bypass User Account Control) if the victim .NET process executes at a higher permission level, as well as to hook and Impair Defenses provided by .NET processes.(Citation: RedCanary Mockingbird May 2020)(Citation: Red Canary COR_PROFILER May 2020)(Citation: Almond COR_PROFILER Apr 2019)(Citation: GitHub OmerYa Invisi-Shell)(Citation: subTee .NET Profilers May 2017)
View in MITRE ATT&CK®Capability ID | Capability Description | Mapping Type | ATT&CK ID | ATT&CK Name |
---|---|---|---|---|
AC-2 | Account Management | Protects | T1574.012 | COR_PROFILER |
AC-3 | Access Enforcement | Protects | T1574.012 | COR_PROFILER |
AC-5 | Separation of Duties | Protects | T1574.012 | COR_PROFILER |
AC-6 | Least Privilege | Protects | T1574.012 | COR_PROFILER |
CM-5 | Access Restrictions for Change | Protects | T1574.012 | COR_PROFILER |
CM-7 | Least Functionality | Protects | T1574.012 | COR_PROFILER |
IA-2 | Identification and Authentication (organizational Users) | Protects | T1574.012 | COR_PROFILER |
SI-10 | Information Input Validation | Protects | T1574.012 | COR_PROFILER |
SI-7 | Software, Firmware, and Information Integrity | Protects | T1574.012 | COR_PROFILER |
action.malware.variety.Disable controls | Disable or interfere with security controls | related-to | T1574.012 | Hijack Execution Flow: COR_PROFILER |