Detection rules › Sigma

Disable Powershell Command History

Status
test
Severity
high
Log source
category ps_script, product windows
Author
Ali Alwashali
Source
github.com/SigmaHQ/sigma

Detects scripts or commands that disabled the Powershell command history by removing psreadline module

Known false positives

  • Legitimate script that disables the command history

MITRE ATT&CK coverage

Telemetry coverage

Rule body

title: Disable Powershell Command History
id: 602f5669-6927-4688-84db-0d4b7afb2150
status: test
description: Detects scripts or commands that disabled the Powershell command history by removing psreadline module
references:
    - https://twitter.com/DissectMalware/status/1062879286749773824
author: Ali Alwashali
date: 2022-08-21
tags:
    - attack.stealth
    - attack.t1070.003
logsource:
    product: windows
    category: ps_script
    definition: 'Requirements: Script Block Logging must be enabled'
detection:
    selection:
        ScriptBlockText|contains|all:
            - Remove-Module
            - psreadline
    condition: selection
falsepositives:
    - Legitimate script that disables the command history
level: high

Stages and Predicates

Stage 0: condition

selection

Stage 1: selection

selection:
    ScriptBlockText|contains|all:
        - Remove-Module
        - psreadline

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
ScriptBlockTextmatch
  • Remove-Module
  • psreadline
field:"ScriptBlockText" kind:match