Overview

PowerShell is a powerful interactive command-line interface and scripting environment included in the Windows operating system. Adversaries can use PowerShell to perform a number of actions, including discovery of information and execution of code.

PowerShell may also be used to download and run executables from the Internet, which can be executed from disk or in memory without touching disk.

We have a separate blog which touches certain aspects of a malicious PowerShell script here - Decoding Malicious PowerShell Activity - A Case Study - Blog - Malware Questions - Sophos Community

A number of PowerShell-based offensive testing tools are available, including Empire, PowerSploit, PoshC2, and PSAttack.

PowerShell and Windows Events

On the host side of forensics, there are various places where we look for signs of suspicious PowerShell script or command execution whether it’s local or remote.

image.png

Application Event Logs

https://community.sophos.com/resized-image/__size/640x480/__key/communityserver-blogs-components-weblogfiles/00-00-00-00-28/2.png

Windows PowerShell.evtx

The field ‘HostApplication’ might display the encoded bits used such as:

powershell.exe -EncodedCommand VwByAGkAdABlAC0ASABvAHMAdAAgAC0ATwBiAGoAZQBjAHQAIAAiAEgAZQBsAGwAbwAsACAAdwBvAHIAbA BkACEAIgA7AA==

Microsoft-Windows-PowerShell/Operational.evtx

<aside> 💡

This is not applicable for PowerShell 2.0

</aside>