Detectionmediumtest

PSScriptPolicyTest Creation By Uncommon Process

Detects the creation of the "PSScriptPolicyTest" PowerShell script by an uncommon process. This file is usually generated by Microsoft Powershell to test against Applocker.

Open in Detection LabConvert ruleBuild Package
Nasreddine BencherchaliCreated 2023-06-01Updated 2026-10-191027d292-dd87-4a1a-8701-2abe04d7783cwindows
Log Source
WindowsFile Event
ProductWindows← raw: windows
CategoryFile Event← raw: file_event

Events for file system activity including creation, modification, and deletion.

Detection Logic
Detection Logic6 selectors
detection:
    selection:
        TargetFilename|contains: '__PSScriptPolicyTest_'
    filter_main_powershell:
        Image:
            - 'C:\Program Files\PowerShell\7-preview\pwsh.exe'
            - 'C:\Program Files\PowerShell\7\pwsh.exe'
            - 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe'
            - 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
            - 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe'
            - 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe'
    filter_main_pwsh_preview:
        Image|contains:
            - 'C:\Program Files\WindowsApps\Microsoft.PowerShellPreview'
            - '\AppData\Local\Microsoft\WindowsApps\Microsoft.PowerShellPreview'
        Image|endswith: '\pwsh.exe'
    filter_main_generic:
        Image:
            - 'C:\Windows\System32\dsac.exe'
            - 'C:\Windows\System32\sdiagnhost.exe'
            - 'C:\Windows\System32\ServerManager.exe'
            - 'C:\Windows\System32\wsmprovhost.exe'
            - 'C:\Windows\SysWOW64\sdiagnhost.exe'
    filter_optional_gethelp:
        Image|startswith: 'C:\Program Files\WindowsApps\Microsoft.GetHelp_'
        Image|endswith: '\GetHelp.exe'
    filter_optional_citrix:
        Image|startswith:
            - 'C:\Program Files\Citrix\ConfigSync\'
            - 'C:\Program Files (x86)\Citrix\ConfigSync\'
        Image|endswith: '\ConfigSyncRun.exe'
    condition: selection and not 1 of filter_main_* and not 1 of filter_optional_*
False Positives
Unknown

False positive likelihood has not been assessed. Additional context may be needed during triage.

MITRE ATT&CK
Rule Metadata
Rule ID
1027d292-dd87-4a1a-8701-2abe04d7783c
Status
test
Level
medium
Type
Detection
Created
2023-06-01
Modified
2026-10-19
Path
rules/windows/file/file_event/file_event_win_ps_script_policy_test_creation_by_uncommon_process.yml
Raw Tags
attack.stealth
View on GitHub