Detection of PowerShell Web Request Commands via ScriptBlock Logging
This brief documents the usage of PowerShell cmdlets and command-line tools for web-based data retrieval, often leveraged by attackers for stage-two payload delivery or data exfiltration.
Triage facts
Revision 2- Applicability
- Windows
- Evidence
- Unknown
- Severity
- Medium
- Action
- Elevated
- Sources
- 3 public sources
- Freshness
- Revision 2Sep 1, 12:19 UTC
- Detection
- 1 rule
- Source quality
- B2Likely
Revision history 1 entry · Revision 2
- Revision 2
Repaired a legacy canonical identity collision
Changed: slug
Attackers frequently utilize built-in Windows PowerShell cmdlets and command-line utilities to perform web requests, facilitating the download of malicious payloads or the exfiltration of sensitive data. Because these utilities are native to the Windows environment, they are often used as living-off-the-land techniques to blend in with legitimate administrative activity. PowerShell ScriptBlock logging provides visibility into the execution of these commands even when aliases are used. Monitoring for specific commands such as Invoke-WebRequest, Invoke-RestMethod, BitsTransfer, and third-party tools like curl and wget allows security operations teams to detect suspicious external network interactions initiated by PowerShell.
Impact
Successful abuse of these cmdlets can lead to unauthorized code execution, the introduction of secondary malware, and the exfiltration of internal data to attacker-controlled infrastructure. These techniques are common in both initial stage deployment and post-exploitation command-and-control communication.
Recommendation
- Enable PowerShell ScriptBlock Logging (Event ID 4104) across all Windows endpoints to capture full script content.
- Deploy the provided Sigma rule to your SIEM to monitor for suspicious web request activity.
- Establish a baseline for legitimate administrative scripts that utilize these cmdlets and add them to the filter block to reduce false positives.
- Integrate the identified cmdlets and command aliases into your threat hunting program to investigate anomalous external network connections originating from non-browser processes.
Immediate actions
Enable PowerShell Script Block Logging (Event 4104) on critical assets.
Threat Hunt
Search for high-frequency usage of iwr/Invoke-WebRequest from non-administrative service accounts.
Data: Event ID 4104
Detection coverage 1
Usage Of Web Request Commands And Cmdlets - ScriptBlock
mediumDetects the use of various web request commands with commandline tools and Windows PowerShell cmdlets via PowerShell scriptblock logs
Detection queries are available on the platform. Get full rules →