PowerShell Snippets to Monitor

An inspector with a magnifying glass.
March 24, 2025 by Anthony Rosa

Introduction

PowerShell is both a friend and a foe to blue-teamers. PowerShell Remoting is the most secure way to manage systems, PowerShell is a stellar productivity tool, and it is essentially uninstallable anyways. However, as a native, powerful scripting platform, PowerShell can be used to support malicious actions. Therefore, it is important to adequately monitor.

Below are PowerShell snippets you should pay special attention to and set up alerts for. Now, you might be wondering why I didn't include popular PowerShell modules like Invoke-Obfuscation. The reason is because when researchers tested these modules, they found that they do not bypass detection (Mosch, 2025).

In fact, "all of the public bypasses themselves are signatured and flagged by AMSI itself, at least when implementing them in one of the mentioned scripting languages such as Powershell. So for all of them, it's necessary to manually modify or obfuscate the code so that the bypass itself is no longer flagged" (Mosch, 2025).

Therefore, the snippets I listed are more general and usually included in other malicious scripts. They are simple, non-regex based items, and thus implementable in all environments without requiring customization.

Snippets