Detectionmediumtest

Malicious PowerShell Keywords

Detects keywords from well-known PowerShell exploitation frameworks

Open in Detection LabConvert ruleBuild Package
Sean Metcalf (source), Florian Roth (Nextron Systems)Created 2017-03-05Updated 2023-06-20f62176f3-8128-4faa-bf6c-83261322e5ebwindows
Log Source
WindowsPowerShell Script
ProductWindows← raw: windows
CategoryPowerShell Script← raw: ps_script

Definition

Requirements: Script Block Logging must be enabled

Detection Logic
Detection Logic1 selector
detection:
    selection:
        ScriptBlockText|contains:
            - 'AdjustTokenPrivileges'
            - 'IMAGE_NT_OPTIONAL_HDR64_MAGIC'
            # - 'LSA_UNICODE_STRING'
            - 'Metasploit'
            - 'Microsoft.Win32.UnsafeNativeMethods'
            - 'Mimikatz'
            - 'MiniDumpWriteDump'
            - 'PAGE_EXECUTE_READ'
            - 'ReadProcessMemory.Invoke'
            - 'SE_PRIVILEGE_ENABLED'
            - 'SECURITY_DELEGATION'
            - 'TOKEN_ADJUST_PRIVILEGES'
            - 'TOKEN_ALL_ACCESS'
            - 'TOKEN_ASSIGN_PRIMARY'
            - 'TOKEN_DUPLICATE'
            - 'TOKEN_ELEVATION'
            - 'TOKEN_IMPERSONATE'
            - 'TOKEN_INFORMATION_CLASS'
            - 'TOKEN_PRIVILEGES'
            - 'TOKEN_QUERY'
    condition: selection
False Positives

Depending on the scripts, this rule might require some initial tuning to fit the environment

MITRE ATT&CK
Rule Metadata
Rule ID
f62176f3-8128-4faa-bf6c-83261322e5eb
Status
test
Level
medium
Type
Detection
Created
2017-03-05
Modified
2023-06-20
Path
rules/windows/powershell/powershell_script/posh_ps_malicious_keywords.yml
Raw Tags
attack.executionattack.t1059.001
View on GitHub