powershell.exe

Overview

powershell.exe is the executable for Windows PowerShell, the automation and scripting environment built on the .NET Framework.

It provides:

PowerShell is used heavily by administrators, developers, management platforms, security tools, and attackers.

Expected Characteristics

Expected Location

Expected Parent

Common examples include:

Typical Profile

Why This Matters

PowerShell is one of the most flexible and capable execution environments available on Windows.

Its legitimate use is widespread.

Its abuse is equally widespread.

Attackers commonly use powershell.exe for:

Modern attacks frequently avoid writing payloads to disk and instead rely entirely on PowerShell executing content directly in memory.

Investigation Objective

Determine:

  1. Whether the parent process is expected
  2. Whether the command line is legitimate
  3. Whether the observed behaviour aligns with normal administration or automation
  4. Whether PowerShell is being used as part of a larger attack chain

The command line is often the single most important artefact during a PowerShell investigation.

Normal Behaviour

Characteristics

Path

Signature

Parent Processes

Common examples include:

Command Line

Legitimate PowerShell usage usually contains:

Modules

Common legitimate examples include:

Typical Activity

Expected Behavioural Characteristics

PowerShell commonly:

In many desktop environments, PowerShell usage should be relatively infrequent.

On servers and administrator workstations it may be entirely normal.

Abuse Patterns

Suspicious Parent Processes

Investigate PowerShell launched by:

mshta.exe

rundll32.exe

regsvr32.exe

wscript.exe

cscript.exe

dllhost.exe

winword.exe

excel.exe

outlook.exe

browser processes

These relationships are frequently observed in phishing and malware execution chains.

Remote Content Retrieval

Investigate command lines containing:

DownloadString

DownloadFile

Invoke-WebRequest

Invoke-RestMethod

Net.WebClient

URLs within command lines frequently indicate staging or payload delivery.

Encoded Commands

Investigate usage of:

-EncodedCommand

-enc

Particularly when combined with:

Encoded commands are not automatically malicious, but they significantly increase investigative priority.

Obfuscated Execution

Look for:

Examples include:

IEX

Invoke-Expression

and extensive manipulation of strings before execution.

In-Memory Execution

Investigate PowerShell loading:

Many modern payloads never touch disk.

Hidden Execution

Investigate:

-WindowStyle Hidden

-NoProfile

-ExecutionPolicy Bypass

particularly when appearing together.

These combinations frequently indicate attempts to reduce visibility.

Persistence and Escalation Activity

Investigate commands modifying:

PowerShell is frequently used to establish persistence after initial compromise.

Detection Opportunities

Command-Line Analytics

The command line is often the highest-value source of telemetry.

Monitor for:

Rare PowerShell command lines should generally receive priority attention.

Parent Process Analysis

Investigate PowerShell launched by:

Parent context often determines legitimacy.

Script Block Logging

Where available, enable:

These often provide visibility beyond the original command line.

Child Process Monitoring

Investigate PowerShell spawning:

cmd.exe

rundll32.exe

mshta.exe

regsvr32.exe

wscript.exe

cscript.exe

and other LOLBins.

Chained LOLBin execution is a common attacker technique.

Network Analytics

Monitor for:

PowerShell frequently serves as the bridge between execution and command-and-control activity.

Hunting Opportunities

Useful hunting pivots include:

Focus on behaviour uncommon within your own environment.

False Positives

PowerShell generates a significant number of legitimate alerts because many enterprise systems depend on it.

Common Legitimate Scenarios

Examples include:

Cloud Administration

Examples include:

These workflows frequently use PowerShell.

DevOps and Development

Examples include:

These systems often generate extensive PowerShell activity.

Validation Questions

Check:

Determine whether execution aligns with known operational workflows.

Estate-Wide Context

Legitimate PowerShell activity often:

Hardening Recommendations

Constrained Language Mode

Where appropriate, evaluate:

These controls can reduce PowerShell abuse opportunities.

Script Signing

Require script signing where operationally feasible.

Benefits include:

Application Control

Consider:

Restrict execution of unapproved tools and scripts.

Enable Comprehensive Logging

Implement:

Visibility is often more valuable than prevention alone.

Reduce Administrative Exposure

Limit:

Many PowerShell attack paths depend on elevated permissions.

Defensive Validation

Test:

Controls should be validated against realistic tradecraft rather than simple demonstrations.

Triage Checklist

Identity and Integrity

Lineage and Behaviour

Script and Content Analysis

Network and Operational Context

Escalation Considerations

Escalate immediately if:

ATT&CK References

Windows Processes

PowerShell

MITRE ATT&CK