Potential Suspicious PowerShell Module File Created
Detects the creation of a new PowerShell module in the first folder of the module directory structure "\WindowsPowerShell\Modules\malware\malware.psm1". This is somewhat an uncommon practice as legitimate modules often includes a version folder.
Detection logic
selection
TargetFilename|endswith:
- \\WindowsPowerShell\\Modules\\*\.ps
- \\WindowsPowerShell\\Modules\\*\.dllCondition
selectionRaw YAML
title: Potential Suspicious PowerShell Module File Created
id: e8a52bbd-bced-459f-bd93-64db45ce7657
status: test
description: Detects the creation of a new PowerShell module in the first folder of the module directory structure "\WindowsPowerShell\Modules\malware\malware.psm1". This is somewhat an uncommon practice as legitimate modules often includes a version folder.
references:
- Internal Research
- https://learn.microsoft.com/en-us/powershell/scripting/developer/module/understanding-a-windows-powershell-module?view=powershell-7.3
author: Nasreddine Bencherchali (Nextron Systems)
date: 2023-05-09
tags:
- attack.persistence
logsource:
category: file_event
product: windows
detection:
selection:
TargetFilename|endswith:
# Note: Don't include PowerShell 7 as it has default modules that don't follow this logic
- '\\WindowsPowerShell\\Modules\\*\.ps'
- '\\WindowsPowerShell\\Modules\\*\.dll'
condition: selection
falsepositives:
- False positive rate will vary depending on the environments. Additional filters might be required to make this logic usable in production.
level: mediumFalse positives
- False positive rate will vary depending on the environments. Additional filters might be required to make this logic usable in production.
References
Similar rules
Creation Exe for Service with Unquoted Path
highwindows · Same logsource category (file_event)
Creation Of Non-Existent System DLL
mediumwindows · Same logsource category (file_event)
Creation of WerFault.exe/Wer.dll in Unusual Folder
mediumwindows · Same logsource category (file_event)
CVE-2024-1708 - ScreenConnect Path Traversal Exploitation
mediumwindows · Same logsource category (file_event)