title: PowerShell lancé avec une commande encodée (préfixes de -EncodedCommand)
id: c90a658a-4717-40f5-afb7-074a7ce0ba97
status: experimental
description: |
  Détecte powershell.exe ou pwsh.exe lancé avec -EncodedCommand ou l'une de ses
  abréviations (-e, -ec, -en, -enc…), y compris avec / ou un tiret Unicode.
references:
  - https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pwsh
  - https://attack.mitre.org/techniques/T1059/001/
author: PurpleLog
date: 2026-10-17
tags:
  - attack.execution
  - attack.t1059.001
  - attack.stealth
  - attack.t1027.010
logsource:
  category: process_creation
  product: windows
detection:
  selection_img:
    - Image|endswith:
        - '\powershell.exe'
        - '\pwsh.exe'
    # Un powershell.exe renommé garde son nom d'origine dans les métadonnées PE
    - OriginalFileName:
        - 'PowerShell.EXE'
        - 'pwsh.dll'
  selection_cli:
    # windash étend « - » à /, –, — et ―
    CommandLine|windash|contains:
      - ' -e '
      - ' -ec '
      - ' -en'
  condition: all of selection_*
falsepositives:
  - Agents de déploiement et de supervision qui passent leurs scripts encodés (SCCM, Intune, certains RMM)
level: medium
