PowerShell Hunting and Detection
PowerShell Hunting and Detection
Author: Muhammed Talaat - Senior. Malware Researcher | DFIR Investigator | Threat Intelligence Analyst
LinkedIn: https://www.linkedin.com/in/muhammed-talaat-0x00/
Twitter: https://twitter.com/Muhammed_0x00
Personal Email: [email protected]
PowerShell Activities
Data Source Channel Category - Refers To Event ID Description | Comment
PowerShell Microsoft-Windows-PowerShell/Operational User started Application 4103 • records all the obfuscated commands as pipeline execution details.
host • Hunt the obfuscated commands and calls self -defined variables and system commands.
PowerShell Microsoft-Windows-PowerShell/Operational Script block contents 4104 • Execution of a remote PowerShell command.
• Captures the entire scripts that are executed by remote machines. For example, obfuscated scripts that
are decoded and executed at run time.
• If an event exceeds the maximum event log message size, script block logging will split the logged events
into multiple events and suspicious commands can be observed at the logging level of "warning".
PowerShell Windows PowerShell Application host started 400 • Indicates when a new PowerShell host process has started.
Examples:
Example:
Application Whitelisting
Data Source Channel Category - Refers To Event ID Description | Comment
Process Security A new process has been created 4688 • Logs details about new process creations within Windows.
• When you hunt with this Event ID pay attention to the Parent Process (Specifically when it's not "explorer.exe")
Examples:
Sysmon Logs
Data Source Channel Category - Refers To Event ID Description | Comment
Process Microsoft-Windows-Sysmon/Operational A new process has been 1 • Logs new process creations within Windows.
created • Provides context on the process execution.
Examples:
---------------------------------------------------------------------------------------------------------
Examples:
---------------------------------------------------------------------------------------------------------
Examples:
PowerShell Transcript
• For DFIR investigators they can look for transcript file if it was active.
• Transcript file is a .txt document located by default in the Documents directory, it records all PowerShell sessions. The
transcript file includes all command that the user types and all output that appears on the console.