Detection rules › Sigma
Clear PowerShell History - PowerShell Module
Detects keywords that could indicate clearing PowerShell history
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth | T1070.003 Indicator Removal: Clear Command History |
Event coverage
| Provider | Event | Title |
|---|---|---|
| PowerShell | Event ID 4103 | Payload Context: ContextInfo User Data: UserData. |
Rule body yaml
title: Clear PowerShell History - PowerShell Module
id: f99276ad-d122-4989-a09a-d00904a5f9d2
related:
- id: dfba4ce1-e0ea-495f-986e-97140f31af2d
type: derived
status: test
description: Detects keywords that could indicate clearing PowerShell history
references:
- https://gist.github.com/hook-s3c/7363a856c3cdbadeb71085147f042c1a
author: Ilyas Ochkov, Jonhnathan Ribeiro, Daniil Yugoslavskiy, oscd.community
date: 2019-10-25
modified: 2022-12-02
tags:
- attack.stealth
- attack.t1070.003
logsource:
product: windows
category: ps_module
definition: 0ad03ef1-f21b-4a79-8ce8-e6900c54b65b
detection:
selection_1a_payload:
Payload|contains:
- 'del'
- 'Remove-Item'
- 'rm'
selection_1b_payload:
Payload|contains: '(Get-PSReadlineOption).HistorySavePath'
selection_payload_2:
Payload|contains|all:
- 'Set-PSReadlineOption'
- '–HistorySaveStyle' # not sure if the homoglyph –/- is intended, just checking for both
- 'SaveNothing'
selection_payload_3:
Payload|contains|all:
- 'Set-PSReadlineOption'
- '-HistorySaveStyle'
- 'SaveNothing'
condition: 1 of selection_payload_* or all of selection_1*
falsepositives:
- Legitimate PowerShell scripts
level: medium
Stages and Predicates
Stage 0: condition
1 of selection_payload_* or all of selection_1*Stage 1: selection_payload_2
selection_payload_2:
Payload|contains|all:
- 'Set-PSReadlineOption'
- '–HistorySaveStyle'
- 'SaveNothing'
Stage 2: selection_payload_3
selection_payload_3:
Payload|contains|all:
- 'Set-PSReadlineOption'
- '-HistorySaveStyle'
- 'SaveNothing'
Stage 3: selection_1a_payload
selection_1a_payload:
Payload|contains:
- 'del'
- 'Remove-Item'
- 'rm'
Stage 4: selection_1b_payload
selection_1b_payload:
Payload|contains: '(Get-PSReadlineOption).HistorySavePath'
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
Payload | match |
|