Detectionmediumtest

Usage Of Web Request Commands And Cmdlets - ScriptBlock

Detects the use of various web request commands with commandline tools and Windows PowerShell cmdlets (including aliases) via PowerShell scriptblock logs

Open in Detection LabConvert ruleBuild Package
James PembertonCreated 2019-10-24Updated 2025-10-201139d2e2-84b1-4226-b445-354492eba8bawindows
Log Source
WindowsPowerShell Script
ProductWindows← raw: windows
CategoryPowerShell Script← raw: ps_script

Definition

Requirements: Script Block Logging must be enabled

Detection Logic
Detection Logic2 selectors
detection:
    selection:
        ScriptBlockText|contains:
            - '[System.Net.WebRequest]::create'
            - 'curl '
            - 'Invoke-RestMethod'
            - 'Invoke-WebRequest'
            - ' irm ' # Space before and after to avoid false positives with 'irm' as a substring
            - 'iwr '
            # - 'Net.WebClient' # There are various other rules that cover this, so it is commented out
            - 'Resume-BitsTransfer'
            - 'Start-BitsTransfer'
            - 'wget '
            - 'WinHttp.WinHttpRequest'
    filter:
        Path|startswith: 'C:\Packages\Plugins\Microsoft.GuestConfiguration.ConfigurationforWindows\'
    condition: selection and not filter
False Positives

Use of Get-Command and Get-Help modules to reference Invoke-WebRequest and Start-BitsTransfer.

Testing & Validation

Regression Tests

by frack113
Positive Detection Test1 matchevtx

Microsoft-Windows-PowerShell

MITRE ATT&CK
Rule Metadata
Rule ID
1139d2e2-84b1-4226-b445-354492eba8ba
Status
test
Level
medium
Type
Detection
Created
2019-10-24
Modified
2025-10-20
Path
rules/windows/powershell/powershell_script/posh_ps_web_request_cmd_and_cmdlets.yml
Raw Tags
attack.executionattack.t1059.001
View on GitHub