Detection rule
Potential Data Exfiltration Activity Via CommandLine Tools
Overview
Detects the use of various CLI utilities exfiltrating data via web requests
- Rule id
7d1aaf3d-4304-425c-b7c3-162055e0b3ab- ATT&CK techniques
- T1059.001 Command and Scripting Interpreter: PowerShell
- Severity
- High
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- n0n, The Gentlemen, qilin, Akira, safepay, rhysida, Play, nightspire, majinahanashi
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- SIEM-validatedRun in a real SIEM, with a recorded result.
1 of 1 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.
Detection logic and queries
Queries are shown exactly as generated. Test them in your environment before you deploy them.
Sigma
Sigma (YAML) · 7d1aaf3d-4304-425c-b7c3-162055e0b3ab
title: Potential Data Exfiltration Activity Via CommandLine Tools
id: 7d1aaf3d-4304-425c-b7c3-162055e0b3ab
status: test
description: Detects the use of various CLI utilities exfiltrating data via web requests
references:
- https://www.sentinelone.com/blog/living-off-windows-defender-lockbit-ransomware-sideloads-cobalt-strike-through-microsoft-security-tool/
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-08-02
modified: 2026-12-01
tags:
- attack.execution
- attack.t1059.001
logsource:
category: process_creation
product: windows
detection:
selection_iwr:
Image|endswith:
- '\powershell_ise.exe'
- '\powershell.exe'
- '\pwsh.exe'
- '\cmd.exe'
CommandLine|contains:
- 'curl '
- 'Invoke-RestMethod'
- 'Invoke-WebRequest'
- 'irm '
- 'iwr '
- 'wget '
CommandLine|contains|all:
- ' -ur' # Shortest possible version of the -uri flag
- ' -me' # Shortest possible version of the -method flag
- ' -b'
- ' POST '
selection_curl:
Image|endswith: '\curl.exe'
CommandLine|contains: '--ur' # Shortest possible version of the --uri flag
selection_curl_data:
CommandLine|contains:
- ' -d ' # Shortest possible version of the --data flag
- ' --data '
selection_wget:
Image|endswith: '\wget.exe'
CommandLine|contains:
- '--post-data'
- '--post-file'
payloads:
- CommandLine|re|i:
- 'net\s+view'
- 'sc\s+query'
- CommandLine|contains:
- 'Get-Content'
- 'GetBytes'
- 'hostname'
- 'ifconfig'
- 'ipconfig'
- 'netstat'
- 'nltest'
- 'qprocess'
- 'systeminfo'
- 'tasklist'
- 'ToBase64String'
- 'whoami'
- CommandLine|contains|all:
- 'type '
- ' > '
- ' C:\'
condition: (selection_iwr or all of selection_curl* or selection_wget) and payloads
falsepositives:
- Unlikely
level: high
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_susp_data_exfiltration_via_cli/info.ymlQRadar AQL
IBM QRadar AQL (hunting query)Hunting query
Hunting search for the Log Activity tab or the API. It is not a QRadar rule.
AQL search for the Log Activity tab or the API. It is NOT a deployable QRadar rule: real-time detection in QRadar is a CRE (Custom Rule Engine) rule, for which this build only writes a design specification (qradar_cre).
SELECT * FROM events WHERE devicetype=12 AND ((((LOWER("Process Path") LIKE '%\powershell_ise.exe' OR LOWER("Process Path") LIKE '%\powershell.exe' OR LOWER("Process Path") LIKE '%\pwsh.exe' OR LOWER("Process Path") LIKE '%\cmd.exe') OR (LOWER("Process Name") LIKE '%\powershell_ise.exe' OR LOWER("Process Name") LIKE '%\powershell.exe' OR LOWER("Process Name") LIKE '%\pwsh.exe' OR LOWER("Process Name") LIKE '%\cmd.exe')) AND (LOWER(Command) LIKE '%curl %' OR LOWER(Command) LIKE '%invoke-restmethod%' OR LOWER(Command) LIKE '%invoke-webrequest%' OR LOWER(Command) LIKE '%irm %' OR LOWER(Command) LIKE '%iwr %' OR LOWER(Command) LIKE '%wget %') AND (LOWER(Command) LIKE '% -ur%' AND LOWER(Command) LIKE '% -me%' AND LOWER(Command) LIKE '% -b%' AND LOWER(Command) LIKE '% post %')) OR (((LOWER("Process Path") LIKE '%\curl.exe' OR LOWER("Process Name") LIKE '%\curl.exe') AND LOWER(Command) LIKE '%--ur%') AND (LOWER(Command) LIKE '% -d %' OR LOWER(Command) LIKE '% --data %')) OR ((LOWER("Process Path") LIKE '%\wget.exe' OR LOWER("Process Name") LIKE '%\wget.exe') AND (LOWER(Command) LIKE '%--post-data%' OR LOWER(Command) LIKE '%--post-file%'))) AND ((Command MATCHES '(?i)net\s+view' OR Command MATCHES '(?i)sc\s+query') OR (LOWER(Command) LIKE '%get-content%' OR LOWER(Command) LIKE '%getbytes%' OR LOWER(Command) LIKE '%hostname%' OR LOWER(Command) LIKE '%ifconfig%' OR LOWER(Command) LIKE '%ipconfig%' OR LOWER(Command) LIKE '%netstat%' OR LOWER(Command) LIKE '%nltest%' OR LOWER(Command) LIKE '%qprocess%' OR LOWER(Command) LIKE '%systeminfo%' OR LOWER(Command) LIKE '%tasklist%' OR LOWER(Command) LIKE '%tobase64string%' OR LOWER(Command) LIKE '%whoami%') OR (LOWER(Command) LIKE '%type %' AND LOWER(Command) LIKE '% > %' AND LOWER(Command) LIKE '% c:\%'))QRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: Potential Data Exfiltration Activity Via CommandLine Tools- Rule type
- Event rule (Local)
- Log source types
- Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1
Building blocks
BB:OffSet7:Potential Data Exfiltration Activity Via Command:selection_iwr(match)All test lines must match (AND).Process Path / Process Nameends with:\powershell_ise.exe,\powershell.exe,\pwsh.exe,\cmd.exeCommandcontains:curl,Invoke-RestMethod,Invoke-WebRequest,irm,iwr,wgetCommandcontains:-ur,-me,-b,POST
BB:OffSet7:Potential Data Exfiltration Activity Via Command:selection_curl(match)All test lines must match (AND).Process Path / Process Nameends with:\curl.exeCommandcontains:--ur
BB:OffSet7:Potential Data Exfiltration Activity Via Command:selection_curl_data(match)All test lines must match (AND).Commandcontains:-d,--data
BB:OffSet7:Potential Data Exfiltration Activity Via Command:selection_wget(match)All test lines must match (AND).Process Path / Process Nameends with:\wget.exeCommandcontains:--post-data,--post-file
BB:OffSet7:Potential Data Exfiltration Activity Via Command:payloads(match)Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.Commandmatches the regular expression:net\s+view,sc\s+queryCommandcontains:Get-Content,GetBytes,hostname,ifconfig,ipconfig,netstat,nltest,qprocess,systeminfo,tasklist,ToBase64String,whoamiCommandcontains:type,>,C:\
Main rule, option A (building blocks)
- when the event(s) were detected by one or more of these log source types:
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1 - when an event matches the condition built from these building blocks:
(BB:OffSet7:Potential Data Exfiltration Activity Via Command:selection_iwr OR (ALL of [BB:OffSet7:Potential Data Exfiltration Activity Via Command:selection_curl, BB:OffSet7:Potential Data Exfiltration Activity Via Command:selection_curl_data]) OR BB:OffSet7:Potential Data Exfiltration Activity Via Command:selection_wget) AND BB:OffSet7:Potential Data Exfiltration Activity Via Command:payloads
Main rule, option B (AQL filter test)
- when the event matches this AQL filter query:
devicetype=12 AND ((((LOWER("Process Path") LIKE '%\powershell_ise.exe' OR LOWER("Process Path") LIKE '%\powershell.exe' OR LOWER("Process Path") LIKE '%\pwsh.exe' OR LOWER("Process Path") LIKE '%\cmd.exe') OR (LOWER("Process Name") LIKE '%\powershell_ise.exe' OR LOWER("Process Name") LIKE '%\powershell.exe' OR LOWER("Process Name") LIKE '%\pwsh.exe' OR LOWER("Process Name") LIKE '%\cmd.exe')) AND (LOWER(Command) LIKE '%curl %' OR LOWER(Command) LIKE '%invoke-restmethod%' OR LOWER(Command) LIKE '%invoke-webrequest%' OR LOWER(Command) LIKE '%irm %' OR LOWER(Command) LIKE '%iwr %' OR LOWER(Command) LIKE '%wget %') AND (LOWER(Command) LIKE '% -ur%' AND LOWER(Command) LIKE '% -me%' AND LOWER(Command) LIKE '% -b%' AND LOWER(Command) LIKE '% post %')) OR (((LOWER("Process Path") LIKE '%\curl.exe' OR LOWER("Process Name") LIKE '%\curl.exe') AND LOWER(Command) LIKE '%--ur%') AND (LOWER(Command) LIKE '% -d %' OR LOWER(Command) LIKE '% --data %')) OR ((LOWER("Process Path") LIKE '%\wget.exe' OR LOWER("Process Name") LIKE '%\wget.exe') AND (LOWER(Command) LIKE '%--post-data%' OR LOWER(Command) LIKE '%--post-file%'))) AND ((Command MATCHES '(?i)net\s+view' OR Command MATCHES '(?i)sc\s+query') OR (LOWER(Command) LIKE '%get-content%' OR LOWER(Command) LIKE '%getbytes%' OR LOWER(Command) LIKE '%hostname%' OR LOWER(Command) LIKE '%ifconfig%' OR LOWER(Command) LIKE '%ipconfig%' OR LOWER(Command) LIKE '%netstat%' OR LOWER(Command) LIKE '%nltest%' OR LOWER(Command) LIKE '%qprocess%' OR LOWER(Command) LIKE '%systeminfo%' OR LOWER(Command) LIKE '%tasklist%' OR LOWER(Command) LIKE '%tobase64string%' OR LOWER(Command) LIKE '%whoami%') OR (LOWER(Command) LIKE '%type %' AND LOWER(Command) LIKE '% > %' AND LOWER(Command) LIKE '% c:\%'))
Rule response
- Severity 7, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)
Limitations
- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.
Splunk
Splunk SPLSearch
Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.
| rex field=CommandLine "(?<CommandLineMatch>(?i)net\\s+view)"
| eval CommandLineCondition=if(isnotnull(CommandLineMatch), "true", "false")
| rex field=CommandLine "(?<CommandLineMatch2>(?i)sc\\s+query)"
| eval CommandLineCondition2=if(isnotnull(CommandLineMatch2), "true", "false")
| search (((Image IN ("*\\powershell_ise.exe", "*\\powershell.exe", "*\\pwsh.exe", "*\\cmd.exe")) (CommandLine IN ("*curl *", "*Invoke-RestMethod*", "*Invoke-WebRequest*", "*irm *", "*iwr *", "*wget *")) CommandLine="* -ur*" CommandLine="* -me*" CommandLine="* -b*" CommandLine="* POST *") OR (Image="*\\curl.exe" CommandLine="*--ur*" (CommandLine IN ("* -d *", "* --data *"))) OR (Image="*\\wget.exe" (CommandLine IN ("*--post-data*", "*--post-file*")))) (CommandLineCondition="true" OR CommandLineCondition2="true" OR CommandLine IN ("*Get-Content*", "*GetBytes*", "*hostname*", "*ifconfig*", "*ipconfig*", "*netstat*", "*nltest*", "*qprocess*", "*systeminfo*", "*tasklist*", "*ToBase64String*", "*whoami*") OR (CommandLine="*type *" CommandLine="* > *" CommandLine="* C:\\*"))Splunk savedsearches.conf stanzaScheduled search template
Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.
[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now
[Potential Data Exfiltration Activity Via CommandLine Tools]
description = Detects the use of various CLI utilities exfiltrating data via web requests
search = \
| rex field=CommandLine "(?<CommandLineMatch>(?i)net\\s+view)" \
| eval CommandLineCondition=if(isnotnull(CommandLineMatch), "true", "false") \
| rex field=CommandLine "(?<CommandLineMatch2>(?i)sc\\s+query)" \
| eval CommandLineCondition2=if(isnotnull(CommandLineMatch2), "true", "false") \
| search (((Image IN ("*\\powershell_ise.exe", "*\\powershell.exe", "*\\pwsh.exe", "*\\cmd.exe")) (CommandLine IN ("*curl *", "*Invoke-RestMethod*", "*Invoke-WebRequest*", "*irm *", "*iwr *", "*wget *")) CommandLine="* -ur*" CommandLine="* -me*" CommandLine="* -b*" CommandLine="* POST *") OR (Image="*\\curl.exe" CommandLine="*--ur*" (CommandLine IN ("* -d *", "* --data *"))) OR (Image="*\\wget.exe" (CommandLine IN ("*--post-data*", "*--post-file*")))) (CommandLineCondition="true" OR CommandLineCondition2="true" OR CommandLine IN ("*Get-Content*", "*GetBytes*", "*hostname*", "*ifconfig*", "*ipconfig*", "*netstat*", "*nltest*", "*qprocess*", "*systeminfo*", "*tasklist*", "*ToBase64String*", "*whoami*") OR (CommandLine="*type *" CommandLine="* > *" CommandLine="* C:\\*"))Microsoft Sentinel
Microsoft Sentinel KQL (ASIM)Hunting query
Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.
imProcessCreate
| where (((TargetProcessName endswith "\\powershell_ise.exe" or TargetProcessName endswith "\\powershell.exe" or TargetProcessName endswith "\\pwsh.exe" or TargetProcessName endswith "\\cmd.exe") and (TargetProcessCommandLine contains "curl " or TargetProcessCommandLine contains "Invoke-RestMethod" or TargetProcessCommandLine contains "Invoke-WebRequest" or TargetProcessCommandLine contains "irm " or TargetProcessCommandLine contains "iwr " or TargetProcessCommandLine contains "wget ") and (TargetProcessCommandLine contains " -ur" and TargetProcessCommandLine contains " -me" and TargetProcessCommandLine contains " -b" and TargetProcessCommandLine contains " POST ")) or ((TargetProcessName endswith "\\curl.exe" and TargetProcessCommandLine contains "--ur") and (TargetProcessCommandLine contains " -d " or TargetProcessCommandLine contains " --data ")) or (TargetProcessName endswith "\\wget.exe" and (TargetProcessCommandLine contains "--post-data" or TargetProcessCommandLine contains "--post-file"))) and ((TargetProcessCommandLine matches regex "(?i)net\\s+view" or TargetProcessCommandLine matches regex "(?i)sc\\s+query") or (TargetProcessCommandLine contains "Get-Content" or TargetProcessCommandLine contains "GetBytes" or TargetProcessCommandLine contains "hostname" or TargetProcessCommandLine contains "ifconfig" or TargetProcessCommandLine contains "ipconfig" or TargetProcessCommandLine contains "netstat" or TargetProcessCommandLine contains "nltest" or TargetProcessCommandLine contains "qprocess" or TargetProcessCommandLine contains "systeminfo" or TargetProcessCommandLine contains "tasklist" or TargetProcessCommandLine contains "ToBase64String" or TargetProcessCommandLine contains "whoami") or (TargetProcessCommandLine contains "type " and TargetProcessCommandLine contains " > " and TargetProcessCommandLine contains " C:\\"))Defender XDR
Microsoft Defender XDR KQLHunting query
Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.
DeviceProcessEvents
| where (((FolderPath endswith "\\powershell_ise.exe" or FolderPath endswith "\\powershell.exe" or FolderPath endswith "\\pwsh.exe" or FolderPath endswith "\\cmd.exe") and (ProcessCommandLine contains "curl " or ProcessCommandLine contains "Invoke-RestMethod" or ProcessCommandLine contains "Invoke-WebRequest" or ProcessCommandLine contains "irm " or ProcessCommandLine contains "iwr " or ProcessCommandLine contains "wget ") and (ProcessCommandLine contains " -ur" and ProcessCommandLine contains " -me" and ProcessCommandLine contains " -b" and ProcessCommandLine contains " POST ")) or ((FolderPath endswith "\\curl.exe" and ProcessCommandLine contains "--ur") and (ProcessCommandLine contains " -d " or ProcessCommandLine contains " --data ")) or (FolderPath endswith "\\wget.exe" and (ProcessCommandLine contains "--post-data" or ProcessCommandLine contains "--post-file"))) and ((ProcessCommandLine matches regex "(?i)net\\s+view" or ProcessCommandLine matches regex "(?i)sc\\s+query") or (ProcessCommandLine contains "Get-Content" or ProcessCommandLine contains "GetBytes" or ProcessCommandLine contains "hostname" or ProcessCommandLine contains "ifconfig" or ProcessCommandLine contains "ipconfig" or ProcessCommandLine contains "netstat" or ProcessCommandLine contains "nltest" or ProcessCommandLine contains "qprocess" or ProcessCommandLine contains "systeminfo" or ProcessCommandLine contains "tasklist" or ProcessCommandLine contains "ToBase64String" or ProcessCommandLine contains "whoami") or (ProcessCommandLine contains "type " and ProcessCommandLine contains " > " and ProcessCommandLine contains " C:\\"))Elastic
Elastic Lucene (ECS)Hunting query
Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.
(((process.executable:(*\\powershell_ise.exe OR *\\powershell.exe OR *\\pwsh.exe OR *\\cmd.exe)) AND (process.command_line:(*curl\ * OR *Invoke\-RestMethod* OR *Invoke\-WebRequest* OR *irm\ * OR *iwr\ * OR *wget\ *)) AND (process.command_line:*\ \-ur* AND process.command_line:*\ \-me* AND process.command_line:*\ \-b* AND process.command_line:*\ POST\ *)) OR ((process.executable:*\\curl.exe AND process.command_line:*\-\-ur*) AND (process.command_line:(*\ \-d\ * OR *\ \-\-data\ *))) OR (process.executable:*\\wget.exe AND (process.command_line:(*\-\-post\-data* OR *\-\-post\-file*)))) AND ((process.command_line:/.*([nN][eE][tT]\s+[vV][iI][eE][wW]).*/ OR process.command_line:/.*([sS][cC]\s+[qQ][uU][eE][rR][yY]).*/) OR (process.command_line:(*Get\-Content* OR *GetBytes* OR *hostname* OR *ifconfig* OR *ipconfig* OR *netstat* OR *nltest* OR *qprocess* OR *systeminfo* OR *tasklist* OR *ToBase64String* OR *whoami*)) OR (process.command_line:*type\ * AND process.command_line:*\ \>\ * AND process.command_line:*\ C\:\\*))Elastic EQL (ECS)Hunting query
EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.
any where (((process.executable like~ ("*\\powershell_ise.exe", "*\\powershell.exe", "*\\pwsh.exe", "*\\cmd.exe")) and (process.command_line like~ ("*curl *", "*Invoke-RestMethod*", "*Invoke-WebRequest*", "*irm *", "*iwr *", "*wget *")) and (process.command_line:"* -ur*" and process.command_line:"* -me*" and process.command_line:"* -b*" and process.command_line:"* POST *")) or ((process.executable:"*\\curl.exe" and process.command_line:"*--ur*") and (process.command_line like~ ("* -d *", "* --data *"))) or (process.executable:"*\\wget.exe" and (process.command_line like~ ("*--post-data*", "*--post-file*")))) and ((process.command_line regex~ ".*(net\\s+view).*" or process.command_line regex~ ".*(sc\\s+query).*") or (process.command_line like~ ("*Get-Content*", "*GetBytes*", "*hostname*", "*ifconfig*", "*ipconfig*", "*netstat*", "*nltest*", "*qprocess*", "*systeminfo*", "*tasklist*", "*ToBase64String*", "*whoami*")) or (process.command_line:"*type *" and process.command_line:"* > *" and process.command_line:"* C:\\*"))Elastic ES|QL (ECS)Hunting query
ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.
from * metadata _id, _index, _version | where ((ends_with(process.executable, "\\powershell_ise.exe") or ends_with(process.executable, "\\powershell.exe") or ends_with(process.executable, "\\pwsh.exe") or ends_with(process.executable, "\\cmd.exe")) and (process.command_line like "*curl *" or process.command_line like "*Invoke-RestMethod*" or process.command_line like "*Invoke-WebRequest*" or process.command_line like "*irm *" or process.command_line like "*iwr *" or process.command_line like "*wget *") and process.command_line like "* -ur*" and process.command_line like "* -me*" and process.command_line like "* -b*" and process.command_line like "* POST *" or ends_with(process.executable, "\\curl.exe") and process.command_line like "*--ur*" and (process.command_line like "* -d *" or process.command_line like "* --data *") or ends_with(process.executable, "\\wget.exe") and (process.command_line like "*--post-data*" or process.command_line like "*--post-file*")) and (process.command_line rlike ".*([nN][eE][tT]\\s+[vV][iI][eE][wW]).*" or process.command_line rlike ".*([sS][cC]\\s+[qQ][uU][eE][rR][yY]).*" or process.command_line like "*Get-Content*" or process.command_line like "*GetBytes*" or process.command_line like "*hostname*" or process.command_line like "*ifconfig*" or process.command_line like "*ipconfig*" or process.command_line like "*netstat*" or process.command_line like "*nltest*" or process.command_line like "*qprocess*" or process.command_line like "*systeminfo*" or process.command_line like "*tasklist*" or process.command_line like "*ToBase64String*" or process.command_line like "*whoami*" or process.command_line like "*type *" and process.command_line like "* > *" and process.command_line like "* C:\\\\*")Required telemetry
- Log source
product: windows · category: process_creation- Fields used
CommandLineImage
False positives
- Unlikely
Investigation and response
No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.
References
Author and attribution
- Author
- Nasreddine Bencherchali (Nextron Systems)
- Source
- SigmaHQ ·
rules/windows/process_creation/proc_creation_win_susp_data_exfiltration_via_cli.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2