{"id":75456,"date":"2017-11-13T05:54:13","date_gmt":"2017-11-13T13:54:13","guid":{"rendered":"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/?p=75456"},"modified":"2023-05-15T23:00:33","modified_gmt":"2023-05-16T06:00:33","slug":"detecting-reflective-dll-loading-with-windows-defender-atp","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/security\/blog\/2017\/11\/13\/detecting-reflective-dll-loading-with-windows-defender-atp\/","title":{"rendered":"Detecting reflective DLL loading with Windows Defender ATP"},"content":{"rendered":"
Today’s attacks put emphasis on leaving little, if any, forensic evidence to maintain stealth and achieve persistence. Attackers use methods that allow exploits to stay resident within an exploited process or migrate to a long-lived process without ever creating or relying on a file on disk. In recent blogs we described how attackers use basic cross-process migration<\/a> or advanced techniques like atom bombing and process hollowing<\/a> to avoid detection.<\/p>\n Reflective Dynamic-Link Library (DLL) loading, which can load a DLL into a process memory without using the Windows loader, is another method used by attackers.<\/p>\n In-memory DLL loading was first described in 2004 by Skape and JT<\/a>, who illustrated how one can patch the Windows loader to load DLLs from memory instead of from disk. In 2008, Stephen Fewer<\/a> of Harmony Security introduced the reflective DLL loading process that loads a DLL into a process without being registered with the process. Modern attacks now use this technique to avoid detection.<\/p>\n Reflective DLL loading isn\u2019t trivial\u2014it requires writing the DLL into memory and then resolving its imports and\/or relocating it. To reflectively load DLLs, one needs to author one\u2019s own custom loader.<\/p>\n However, attackers are still motivated to not use the Windows loader, as most legitimate applications would, for two reasons:<\/p>\n A crucial aspect of reflectively loading a DLL is to have executable memory available for the DLL code. This can be accomplished by taking existing memory and changing its protection flags or by allocating new executable memory. Memory procured for DLL code is the primary signal we use to identify reflective DLL loading.<\/p>\n In Windows 10 Creators Update, we instrumented function calls related to procuring executable memory, namely VirtualAlloc<\/em> and VirtualProtect<\/em>, which generate signals for Windows Defender Advanced Threat Protection (Windows Defender ATP<\/a>). Based on this instrumentation, we\u2019ve built a model that detects reflective DLL loading in a broad range of high-risk processes, for example, browsers and productivity software.<\/p>\n The model takes a two-pronged approach:<\/p>\n This model shows that we can use memory events as the primary signal for detecting reflective DLL loading. In our real model, we incorporate a broad set of other features, such as allocation size, allocation history, thread information, allocation flags, etc. We also consider the fact that application behavior varies greatly because of other factors like plugins, so we add other behavioral signals like network connection behavior to increase the effectiveness of our detection.<\/p>\n Let\u2019s show how Windows Defender ATP can detect reflective DLL loading used with a common technique in modern threats: social engineering. In this attack, the target victim opens a Microsoft Word document from a file share. The victim is tricked into running a macro code.<\/p>\n When the macro code runs, the Microsoft Word process reaches out to the command-and-control (C&C) server specified by the attacker, and receives the content of the DLL to be reflectively loaded. Once the DLL is reflectively loaded, it connects to the C&C and provides command line access to the victim machine.<\/p>\n Note that the DLL is not part of the original document and does not ever touch the disk. Other than the initial document with the small macro snippet, the rest of the attack happens in memory. Memory forensics reveals that there are several larger RWX sections mapped into the Microsoft Word process without a corresponding DLL. These are the memory sections where the reflectively loaded DLL resides.<\/p>\n Windows Defender ATP identifies the memory allocations as abnormal and raises an alert. Windows Defender ATP provides context on the document, along with information on command-and-control communication, which can allow security operations personnel to assess the scope of the attack and start containing the breach.<\/p>\n Microsoft Office 365 Advanced Threat Protection protects customers against similar attacks dynamic behavior matching. In attacks like this, SecOps personnel would see an Office 365 ATP behavioral detection on Office 365\u2019s Threat Explorer page.<\/p>\n Windows 10 continues to strengthen defense capabilities against the full range of modern attacks. In this blog post, we illustrated how Windows Defender ATP<\/a> detects the reflective DLL loading technique. Security operations personnel can use the alerts in Windows Defender ATP to quickly identify and respond to attacks in corporate networks.<\/p>\n Windows Defender Advanced ATP is a post-breach solution that alerts SecOps personnel about hostile activity. Windows Defender ATP uses rich security data, advanced behavioral analytics, and machine learning to detect the invariant techniques used in attacks. Enhanced instrumentation and detection capabilities in Windows Defender ATP can better expose covert attacks.<\/p>\n Windows Defender ATP also provides detailed event timelines and other contextual information that SecOps teams can use to understand attacks and quickly respond. The improved functionality in Windows Defender ATP enables them to isolate the victim machine and protect the rest of the network.<\/p>\n For more information about Windows Defender ATP<\/a>, check out its features and capabilities.<\/a><\/p>\n To test how Windows Defender ATP can help your organization detect, investigate, and respond to advanced attacks, sign up for a free trial<\/a><\/strong>.<\/p>\n Christian Seifert<\/em><\/strong><\/p>\n Windows Defender ATP Research<\/em><\/p>\n <\/a><\/p>\n Questions, concerns, or insights on this story? Join discussions at the Microsoft community<\/a> and Windows Defender Security Intelligence<\/a>.<\/p>\n Follow us on Twitter @WDSecurity<\/a> and Facebook Windows Defender Security Intelligence<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" Today’s attacks put emphasis on leaving little, if any, forensic evidence to maintain stealth and achieve persistence. Attackers use methods that allow exploits to stay resident within an exploited process or migrate to a long-lived process without ever creating or relying on a file on disk. In recent blogs we described how attackers use basic […]<\/p>\n","protected":false},"author":61,"featured_media":89402,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"_classifai_error":"","footnotes":""},"content-type":[3662],"topic":[3685],"products":[3690,3694],"threat-intelligence":[],"tags":[3819],"coauthors":[1968],"class_list":["post-75456","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","content-type-news","topic-siem-and-xdr","products-microsoft-defender","products-microsoft-defender-for-endpoint","tag-windows"],"yoast_head":"\n\n
Instrumentation and detection<\/h2>\n
\n
Detecting reflective DLL Loading<\/h2>\n
Conclusion: Windows Defender ATP uncovers in-memory attacks<\/h2>\n
\nTalk to us<\/strong><\/h4>\n