PowerShell profile script written to a known profile path
Matches Sysmon file creation of a PowerShell profile script — profile.ps1 or a per-host Microsoft.PowerShell_profile.ps1/ISE/VSCode variant — landing in a WindowsPowerShell\ or PowerShell\ folder, the concrete half of AN1245 that a single event can carry; the analytic's other half, correlating the write with a later PowerShell launch that omits -NoProfile, spans two events and Sigma has no join for it. The match is anchored on the last two path segments rather than the full path because Documents is frequently OneDrive- or UNC-redirected, and a full-path match would silently miss every redirected profile. Both the per-user and the all-users ($PSHOME) locations are included, since either gives an adversary unattended code execution on every new PowerShell session. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0451, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full descriptionShow less
The detection
The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.
detection.yml
Sentinel · KQL
Run this as a search.
DeviceFileEvents| where (FolderPath endswith "\\WindowsPowerShell\\profile.ps1" or FolderPath endswith "\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1" or FolderPath endswith "\\WindowsPowerShell\\Microsoft.PowerShellISE_profile.ps1" or FolderPath endswith "\\WindowsPowerShell\\Microsoft.VSCode_profile.ps1" or FolderPath endswith "\\PowerShell\\profile.ps1" or FolderPath endswith "\\PowerShell\\Microsoft.PowerShell_profile.ps1" or FolderPath endswith "\\PowerShell\\Microsoft.VSCode_profile.ps1")
Splunk · SPL
Run this as a search.
index=* (TargetFilename="*\\WindowsPowerShell\\profile.ps1" OR TargetFilename="*\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1" OR TargetFilename="*\\WindowsPowerShell\\Microsoft.PowerShellISE_profile.ps1" OR TargetFilename="*\\WindowsPowerShell\\Microsoft.VSCode_profile.ps1" OR TargetFilename="*\\PowerShell\\profile.ps1" OR TargetFilename="*\\PowerShell\\Microsoft.PowerShell_profile.ps1" OR TargetFilename="*\\PowerShell\\Microsoft.VSCode_profile.ps1")Elastic · ES|QL
Run this as a search.
FROM logs-*| WHERE (TO_LOWER(file.path) LIKE "*\\\\windowspowershell\\\\profile.ps1" OR TO_LOWER(file.path) LIKE "*\\\\windowspowershell\\\\microsoft.powershell_profile.ps1" OR TO_LOWER(file.path) LIKE "*\\\\windowspowershell\\\\microsoft.powershellise_profile.ps1" OR TO_LOWER(file.path) LIKE "*\\\\windowspowershell\\\\microsoft.vscode_profile.ps1" OR TO_LOWER(file.path) LIKE "*\\\\powershell\\\\profile.ps1" OR TO_LOWER(file.path) LIKE "*\\\\powershell\\\\microsoft.powershell_profile.ps1" OR TO_LOWER(file.path) LIKE "*\\\\powershell\\\\microsoft.vscode_profile.ps1")
Wazuh · XML rule
Deploy to your manager — this is a rule, not a search.
<group name="sigma,windows,file_event,"> <!-- Rule ids must be unique on your manager; 100000+ is the user range. --> <rule id="100000" level="5"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="TargetFilename" type="pcre2">(?i)(\\WindowsPowerShell\\profile\.ps1$|\\WindowsPowerShell\\Microsoft\.PowerShell_profile\.ps1$|\\WindowsPowerShell\\Microsoft\.PowerShellISE_profile\.ps1$|\\WindowsPowerShell\\Microsoft\.VSCode_profile\.ps1$|\\PowerShell\\profile\.ps1$|\\PowerShell\\Microsoft\.PowerShell_profile\.ps1$|\\PowerShell\\Microsoft\.VSCode_profile\.ps1$)</field> <description>PowerShell profile script written to a known profile path</description> <mitre> <id>T1546.013</id> </mitre> </rule></group>
Verdicts · reactions · comments
Community
Verdicts from engineers who actually deployed it, and the conversation around it.
Nobody has run this in a real environment and said what happened.
Verdicts from engineers who deployed it
0 castNo verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.
Log in to report a verdict.
Log in to join the discussion.
No comments yet. Someone who deploys this will have something to say about it.