What is PowerShell?
Microsoft's built-in administration language — and the most heavily used attack tool on Windows. It is signed, trusted, present everywhere, and can do essentially anything, so attackers rarely need to bring their own tools.
PowerShell is the Windows automation framework and, for the same reasons that make it useful to administrators, the most common execution technique in Windows intrusions. It can download and run code in memory without writing files to disk, interact with every part of the operating system and the directory, and reach cloud services, all through software Microsoft signs and every endpoint already has. Blocking it is rarely realistic because operations depends on it, so the practical posture is visibility and constraint rather than removal. Script block logging, module logging and transcription record what was actually executed, including obfuscated commands after deobfuscation; constrained language mode limits what PowerShell can do on machines that do not need the full capability; and application control policies restrict which scripts may run. For decision-makers this is the cleanest example of a general principle: the attacker's tooling is increasingly your tooling, so detection has to be about behaviour and intent, not about identifying foreign software.
Source: MITRE ATT&CK (T1059.001).
Practice it in a lab
Free, hands-on labs that teach PowerShell. 55 more labs also cover it.
- Your first PowerShell for defenders: inspect a Windows host (beginner, ~40 min)
- Your first Windows log hunt: spot password spraying, new admins and obfuscated PowerShell with DeepBlueCLI (beginner, ~40 min)
- Detect malicious PowerShell on your own Windows machine (intermediate, ~45 min)
- Detect malicious PowerShell with Script Block Logging (Event ID 4104) (intermediate, ~45 min)
- Recover an attacker's PowerShell commands from the PSReadLine history file (intermediate, ~60 min)
- Characterize fileless malware: PowerShell, WMI, and registry when nothing hits disk (advanced, ~50 min)
- See what any ordinary domain user can read, with built-in tools only (beginner, ~40 min)
- Audit Active Directory passwords with DSInternals before an attacker cracks them (intermediate, ~50 min)
Related terms
Related
- Your first PowerShell for defenders: inspect a Windows host
- Your first Windows log hunt: spot password spraying, new admins and obfuscated PowerShell with DeepBlueCLI
- Detect malicious PowerShell on your own Windows machine
- Detect malicious PowerShell with Script Block Logging (Event ID 4104)
- Recover an attacker's PowerShell commands from the PSReadLine history file
- Characterize fileless malware: PowerShell, WMI, and registry when nothing hits disk
- See what any ordinary domain user can read, with built-in tools only
- Audit Active Directory passwords with DSInternals before an attacker cracks them
- MITRE ATT&CK
- False positive
- Persistence
- Scheduled Task/Job
- Cybersecurity glossary
- Free cyber labs