Execution · ATT&CK v20
T1059.001 Command and Scripting Interpreter: PowerShell
A Execution technique. Running the attacker’s code on a system.
- T1059.001Technique ID
- ExecutionTactic
- 16Places taught
What the attacker does
The attacker runs PowerShell to download and run code, often hidden or encoded so the command line says little. It is on every Windows machine and can do almost anything.
How it shows up in the logs
- PowerShell 4104 (script block logging) with the decoded script, and 4103 (module logging).
- Command lines with -EncodedCommand, -w hidden, IEX, DownloadString, Invoke-WebRequest or FromBase64String.
- An unusual parent: Office, a browser, explorer.exe from the Run box, a web server process.
Questions to ask in triage
- What does the script actually do once decoded?
- What started PowerShell?
- Did it download or connect anywhere, and is that destination known bad?
Read T1059.001 on attack.mitre.org
A sub-technique of T1059.
Where you meet it in CyberSim
Detection rules in the shift
Alerts tagged with this technique, the way Sentinel tags an analytics rule.
- Encoded PowerShell command line
- Encoded PowerShell spawned by Office
In the L3 war room
- A macro on the finance laptop launched hidden PowerShell beaconing to the C2.
- A macro on the finance laptop launched hidden PowerShell that started beaconing to the C2 server.
In the detection lab
Write the rule yourself.
- Office application spawning a shell
In the theory
- Process trees: parent and child
- PowerShell logging and encoded commands
- Living off the land
- ClickFix: the user runs it themselves
- Anatomy of a detection rule
In the hands-on labs
A simulated machine in your browser.
In the cases
Part of the answer in 4 investigations, in these learning paths:
Which case is not said here: finding it is the case.
In the glossary
More Execution techniques
- T1047 Windows Management Instrumentation
- T1059.004 Command and Scripting Interpreter: Unix Shell
- T1059.007 Command and Scripting Interpreter: JavaScript
- T1072 Software Deployment Tools
- T1204.002 User Execution: Malicious File
- T1204.004 User Execution: Malicious Copy and Paste
- T1204.005 User Execution: Malicious Library
- T1569.002 System Services: Service Execution
- T1698 Indirect Prompt Injection
Source: MITRE ATT&CK T1059.001, tactic TA0002.