DET-102 · human · confidence High
PowerShell Script Logging
Module, script block, and transcription logging record what PowerShell ran.
These logs are off by default and set by Group Policy. Script Block Logging (Event 4104) captures the code, including decoded content. Module Logging records pipeline details. Transcription saves input and output to text files. For insiders they show data collection scripts, mass file reads, mail exports, and attempts to clear history. Send them centrally and protect the transcript share.
- Data sources
- PowerShell Operational log (4103, 4104)Transcript files
- Platforms
- Windows
Logic
EventCode=4104 | search ScriptBlockText IN (*Compress-Archive*, *Get-ChildItem -Recurse*, *Invoke-WebRequest*, *Remove-Item*PSReadLine*, *Export-Mailbox*, *New-MailboxExportRequest*) | table _time host UserID ScriptBlockText
False positives
Admin scripts and software deployments. Allowlist by signed script hash.
Catches 17 techniques
- TAM-H-ACT-015Installing Malware From Inside
- TAM-H-ACT-022Moving Data Over Other Links
- TAM-H-CVR-005Clearing the Logs
- TAM-H-CVR-009Deleting Windows Shadow Copies
- TAM-H-CVR-016Hiding Shell History
- TAM-H-CVR-030Setting Traps for Investigators
- TAM-H-CVR-034Smuggling Data Inside Other Files
- TAM-H-CVR-036Switching Off the Recorder
- TAM-H-CVR-041Using Trusted Tools Against the Defenders
- TAM-H-STG-016Gaining Higher Rights
- TAM-H-STG-020Hopping to New Systems
- TAM-H-STG-025Leaving Something Behind
- TAM-H-STG-028Mapping Who Has What
- TAM-H-STG-041Pulling Files Down
- TAM-H-STG-043Reading the Registry
- TAM-H-STG-051Sizing Up a Machine
- TAM-H-STG-059Unpacking Hidden Payloads