{"id":13665,"date":"2017-10-23T05:58:52","date_gmt":"2017-10-23T13:58:52","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/?p=13665"},"modified":"2020-02-20T13:40:49","modified_gmt":"2020-02-20T21:40:49","slug":"defending-against-powershell-attacks","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/defending-against-powershell-attacks\/","title":{"rendered":"Defending Against PowerShell Attacks"},"content":{"rendered":"<p><strong>[Updated Feb 20th, 2020 with latest guidance]<\/strong><\/p>\n<p>The security industry is ablaze with news about how PowerShell is being used by both commodity malware and attackers alike. Surely there\u2019s got to be a way to defend yourself against these attacks!<\/p>\n<p>There absolutely is. PowerShell is &#8211; by far &#8211; the most securable and security-transparent shell, scripting language, or programming language available.<\/p>\n<p>Our\u00a0recommendations are:<\/p>\n<ol>\n<li><strong>Deploy PowerShell v5.1 (or newer)<\/strong>, built into Windows 10. Alternatively, you can deploy the <a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=54616\">Windows Management Framework<\/a>, available\u00a0down to and including\u00a0Windows 7 \/ Windows Server\u00a02008r2.<\/li>\n<li><strong>Enable, and collect PowerShell logs<\/strong>, optionally\u00a0including Protected Event Logging. Incorporate these logs into your signatures, hunting, and incident response workflows.<\/li>\n<li><strong>Implement Just Enough Administration<\/strong> on high-value systems to eliminate or reduce unconstrained administrative access to those systems.<\/li>\n<li><strong>Deploy Device Guard \/ Application Control policies<\/strong>\u00a0to allow pre-approved administrative tasks to use the full capability of the PowerShell language, while limiting interactive and unapproved use to a limited subset of the PowerShell language.<\/li>\n<li><strong>Deploy Windows 10<\/strong> to give your antivirus provider full access to all content (including content generated or de-obfuscated at runtime)\u00a0processed by Windows Scripting Hosts including PowerShell.<\/li>\n<\/ol>\n<p>Some security professionals recommend disabling PowerShell as a method of risk mitigation. Microsoft\u2019s guidance on this falls into two areas:<\/p>\n<ol>\n<li><strong>Client systems<\/strong>. After initial infection (by a macro-enabled document or user double-clicking a malicious executable), malware sometimes uses PowerShell as one component of its attack chain. Microsoft\u2019s recommendation is not to block PowerShell completely, as PowerShell is required for many operating system and system management tasks. Microsoft\u2019s recommendation is to limit PowerShell to authorized users and administrators to mitigate the use by commodity malware, as described by point #4 above (\u201cDeploy Device Guard \/ Application Control Policies\u201d). If Windows Defender Application Control is not an option, security products that block PowerShell from unknown parent processes (such as Word, Excel) are a reasonable middle ground.<\/li>\n<li><strong>Server systems<\/strong>. Microsoft does not recommend blocking PowerShell on server systems. PowerShell is the most<a href=\"https:\/\/docs.microsoft.com\/powershell\/scripting\/learn\/remoting\/winrmsecurity\"> secure remote management technology<\/a>, and disabling PowerShell exposes the server to significant risks of <a href=\"http:\/\/aka.ms\/pth\">credential theft<\/a> enabled by other remote management technologies (such as Remote Desktop). PowerShell is also the primary management technology for server systems, so blocking PowerShell completely causes an unacceptable administrative burden using tools with little to no security transparency. Additionally, malicious post-exploitation use of PowerShell on a server system is primarily associated with an active adversary, rather than the static approach used by commodity malware on client systems. Without Application Control (as described by point #4 above), active adversaries simply use other scripting languages or custom tooling.<\/li>\n<\/ol>\n<p style=\"text-align: left;\">For further information about these steps and\u00a0solutions, please see the much more detailed presentation: &#8220;<a href=\"https:\/\/www.youtube.com\/watch?v=M5bkHUQy-JA\">Defending Against PowerShell Attacks<\/a>&#8220;.<\/p>\n<p><iframe title=\"Defending against PowerShell attacks - in theory, and in practice by Lee holmes\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/M5bkHUQy-JA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p>You can also download the slide deck used for this video: <a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/2017\/10\/Defending-Against-PowerShell-Attacks.pptx\">Defending-Against-PowerShell-Attacks<\/a>.<\/p>\n<p>For further details about PowerShell&#8217;s Security features, please see our post:\u00a0<a href=\"https:\/\/blogs.msdn.microsoft.com\/powershell\/2015\/06\/09\/powershell-the-blue-team\/\">PowerShell \u2665 the Blue Team<\/a>.\nFor\u00a0further details about implementing Just Enough Administration, please see <a href=\"http:\/\/aka.ms\/jeadocs\">http:\/\/aka.ms\/jeadocs<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>Lee Holmes [MSFT]\nLead Security Architect\nAzure Management<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Updated Feb 20th, 2020 with latest guidance] The security industry is ablaze with news about how PowerShell is being used by both commodity malware and attackers alike. Surely there\u2019s got to be a way to defend yourself against these attacks! There absolutely is. PowerShell is &#8211; by far &#8211; the most securable and security-transparent shell, [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"video","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13665","post","type-post","status-publish","format-video","has-post-thumbnail","hentry","category-powershell","post_format-post-format-video"],"acf":[],"blog_post_summary":"<p>[Updated Feb 20th, 2020 with latest guidance] The security industry is ablaze with news about how PowerShell is being used by both commodity malware and attackers alike. Surely there\u2019s got to be a way to defend yourself against these attacks! There absolutely is. PowerShell is &#8211; by far &#8211; the most securable and security-transparent shell, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/13665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=13665"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/13665\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=13665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=13665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=13665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}