Potentially Suspicious Powershell Script Execution From Temp Folder

Detects a potentially suspicious powershell script executions from temporary folder

Sigma rule (View on GitHub)

 1title: Potentially Suspicious Powershell Script Execution From Temp Folder
 2id: a6a39bdb-935c-4f0a-ab77-35f4bbf44d33
 3status: test
 4description: Detects a potentially suspicious powershell script executions from temporary folder
 5references:
 6    - https://www.microsoft.com/security/blog/2021/07/13/microsoft-discovers-threat-actor-targeting-solarwinds-serv-u-software-with-0-day-exploit/
 7author: Florian Roth (Nextron Systems), Max Altgelt (Nextron Systems), Tim Shelton
 8date: 2021-07-14
 9modified: 2026-02-17
10tags:
11    - attack.execution
12    - attack.t1059.001
13logsource:
14    category: process_creation
15    product: windows
16detection:
17    selection:
18        Image|endswith:
19            - '\powershell.exe'
20            - '\pwsh.exe'
21        CommandLine|contains:
22            - '\Windows\Temp'
23            - '\Temporary Internet'
24            - '\AppData\Local\Temp'
25            - '\AppData\Roaming\Temp'
26            - '%TEMP%'
27            - '%TMP%'
28            - '%LocalAppData%\Temp'
29    filter_optional_vscode:
30        CommandLine|contains: '-WindowStyle hidden -Verb runAs'
31    filter_optional_amazon_ec2:
32        CommandLine|contains: '\Windows\system32\config\systemprofile\AppData\Local\Temp\Amazon\EC2-Windows\'
33    filter_optional_generic:
34        CommandLine|contains:
35            - ' >'
36            - 'Out-File'
37            - 'ConvertTo-Json'
38    filter_optional_chocolatey_installer:
39        ParentImage:
40            - 'C:\Windows\System32\Msiexec.exe'
41            - 'C:\Windows\SysWOW64\Msiexec.exe'
42        Image|endswith: '\powershell.exe'
43        CommandLine|contains|all:
44            - '-NoProfile -ExecutionPolicy Bypass -Command'
45            - 'AppData\Local\Temp\'
46            - 'Install-Chocolatey.ps1'
47    condition: selection and not 1 of filter_optional_*
48falsepositives:
49    - Administrative scripts
50level: medium

References

Related rules

to-top