Detectionmediumtest

Suspicious IO.FileStream

Open a handle on the drive volume via the \\.\ DOS device path specifier and perform direct access read of the first few bytes of the volume.

Open in Detection LabConvert ruleBuild Package
François HubautCreated 2022-01-09Updated 2022-03-0570ad982f-67c8-40e0-a955-b920c2fa05cbwindows
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|all:
            - New-Object
            - IO.FileStream
            - '\\\\.\\'
    condition: selection
False Positives

Legitimate PowerShell scripts

Testing & Validation

Regression Tests

by frack113
Positive Detection Test1 matchevtx

Microsoft-Windows-PowerShell

Rule Metadata
Rule ID
70ad982f-67c8-40e0-a955-b920c2fa05cb
Status
test
Level
medium
Type
Detection
Created
2022-01-09
Modified
2022-03-05
Path
rules/windows/powershell/powershell_script/posh_ps_susp_iofilestream.yml
Raw Tags
attack.stealthattack.t1070.003
View on GitHub