Possible Persistence Through PowerShell User Profile Via Add-Content (via ps_script)

This rule detects calls to "Add-Content" cmdlet to modify the content of the user profile and potentially adding anomalous commands for persistence

SigmamediumWindowsv1
sigma
title: Possible Persistence Through PowerShell User Profile Via Add-Content (via ps_script)
id: f14d0bcc-370a-5491-94bd-70f3839cf6c3
status: stable
description: This rule detects calls to "Add-Content" cmdlet to modify the content of the user profile and potentially adding anomalous commands for persistence
references:
    - https://attack.mitre.org/techniques/T1546/013/
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1546.013/T1546.013.md
author: Huntrule Team
date: 2026-03-09
tags:
    - attack.persistence
    - attack.privilege-escalation
    - attack.t1546.013
logsource:
    product: windows
    category: ps_script
    definition: 'Requirements: Script Block Logging must be enabled'
detection:
    selection_add:
        ScriptBlockText|contains: 'Add-Content $profile'
    selection_options:
        ScriptBlockText|contains:
            - '-Value "IEX '
            - '-Value "Invoke-Expression'
            - '-Value "Invoke-WebRequest'
            - '-Value "Start-Process'
            - "-Value 'IEX "
            - "-Value 'Invoke-Expression"
            - "-Value 'Invoke-WebRequest"
            - "-Value 'Start-Process"
    condition: all of selection_*
falsepositives:
    - Unknown
level: medium

Known false positives

  • Unknown

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.