Persistence via PowerShell profileedit

Identifies the creation or modification of a PowerShell profile. PowerShell profile is a script that is executed when PowerShell starts to customize the user environment, which can be abused by attackers to persist in a environment where PowerShell is common.

Rule type: eql

Rule indices:

  • winlogbeat-*
  • logs-endpoint.events.*
  • logs-windows.*

Severity: medium

Risk score: 47

Runs every: 5 minutes

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100

References:

Tags:

  • Elastic
  • Host
  • Windows
  • Threat Detection
  • Persistence

Version: 1

Added (Elastic Stack release): 8.6.0

Rule authors: Elastic

Rule license: Elastic License v2

Rule queryedit

file where event.type != "deletion" and file.path :
("?:\\Users\\*\\Documents\\WindowsPowerShell\\*",
"?:\\Users\\*\\Documents\\PowerShell\\*",
"?:\\Windows\\System32\\WindowsPowerShell\\*") and file.name :
("profile.ps1", "Microsoft.Powershell_profile.ps1")

Threat mappingedit

Framework: MITRE ATT&CKTM