Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 8479bdf

Browse files
authored
Merge pull request #247 from microsoft/mjmelone-patch-52
Create Detect Encoded Powershell.md
2 parents 37dd9d2 + fbb6129 commit 8479bdf

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Detect Encoded PowerShell
2+
3+
This query will detect encoded powershell based on the parameters passed during process creation. This query will also work if the PowerShell executable is renamed or tampered with since detection is based solely on a regex of the launch string.
4+
5+
## Query
6+
```
7+
DeviceProcessEvents
8+
| where ProcessCommandLine matches regex @'(\s+-((?i)encod?e?d?c?o?m?m?a?n?d?|e|en|enc|ec)\s).*([A-Za-z0-9+/]{50,}[=]{0,2})'
9+
| extend DecodedCommand = replace(@'\x00','', base64_decode_tostring(extract("[A-Za-z0-9+/]{50,}[=]{0,2}",0 , ProcessCommandLine)))
10+
```
11+
## Category
12+
This query can be used to detect the following attack techniques and tactics ([see MITRE ATT&CK framework](https://attack.mitre.org/)) or security configuration states.
13+
| Technique, tactic, or state | Covered? (v=yes) | Notes |
14+
|------------------------|----------|-------|
15+
| Initial access | | |
16+
| Execution | v | |
17+
| Persistence | | |
18+
| Privilege escalation | | |
19+
| Defense evasion | | |
20+
| Credential Access | | |
21+
| Discovery | | |
22+
| Lateral movement | | |
23+
| Collection | | |
24+
| Command and control | | |
25+
| Exfiltration | | |
26+
| Impact | | |
27+
| Vulnerability | | |
28+
| Misconfiguration | | |
29+
| Malware, component | | |
30+
31+
## Contributor info
32+
**Contributor:** Michael Melone
33+
**GitHub alias:** mjmelone
34+
**Organization:** Microsoft
35+
**Contact info:** @PowershellPoet

0 commit comments

Comments
 (0)