Elastic medium stable eql

Suspicious Windows Powershell Arguments

Identifies the execution of PowerShell with suspicious argument values. This behavior is often observed during malware installation leveraging PowerShell.

View Source

Detection Logic

process where host.os.type == "windows" and event.type == "start" and
 process.name : "powershell.exe" and

  not (
    ?user.id == "S-1-5-18" and
    /* Don't apply the user.id exclusion to Sysmon for compatibility */
    not data_stream.dataset : ("windows.sysmon_operational", "windows.sysmon")
  ) and

  not process.parent.executable : (
        "?:\\Program Files\\*.exe",
        "?:\\Program Files (x86)\\*.exe"
  ) and

  (
    process.command_line : (
          "*^*^*^*^*^*^*^*^*^*",
          "*`*`*`*`*",
          "*+*+*+*+*+*+*",
          "*[char[]](*)*-join*",
          "*Base64String*",
          "*[*Convert]*",
          "*.Compression.*",
          "*-join($*",
          "*MemoryStream*",
          "*WriteAllBytes*",
          "* -enc *",
          "* -ec *",
          "* /e *",
          "* /enc *",
          "* /ec *",
          "*WebClient*",
          "*DownloadFile*",
          "*DownloadString*",
          "* iex*",
          "* iwr*",
          "* aQB3AHIAIABpA*",
          "*Reflection.Assembly*",
          "*Assembly.GetType*",
          "*$env:temp\\*start*",
          "*powercat*",
          "*nslookup -q=txt*",
          "*$host.UI.PromptForCredential*",
          "*Net.Sockets.TCPClient*",
          "*curl *;Start*",
          "powershell.exe \"<#*",
          "*ssh -p *",
          "*http*
| iex*",
          "*@SSL\\DavWWWRoot\\*.ps1*",
          "*.lnk*.Seek(0x*",
          "*[string]::join(*",
          "*[Array]::Reverse($*",
          "* hidden $(gc *",
          "*=wscri& set*",
          "*http'+'s://*",
          "*.content
| i''Ex*",
          "*//:sptth*",
          "*//:ptth*",
          "*h''t''t''p*",
          "*'tp'':''/'*",
          "*$env:T\"E\"MP*",
          "*;cmd /c $?",
          "*s''t''a''r*",
          "*$*=Get-Content*AppData*.SubString(*$*",
          "*=cat *AppData*.substring(*);*$*",
          "*-join'';*
| powershell*",
          "*.Content;sleep *
| powershell*",
          "*h\''t\''tp:\''*",
          "*-e aQB3AHIAIABp*",
          "*iwr *https*).Content*",
          "*$env:computername*http*",
          "*;InVoKe-ExpRESsIoN $COntent.CONTENt;*",
          "*WebClient*example.com*",
          "*=iwr $*;iex $*",
          "*ServerXmlHttp*IEX*",
          "*XmlDocument*IEX*"
    ) or

    (
      process.command_line : "*.replace*" and
      /* exclude known process and network inventory collection patterns */
      not process.command_line : (
        "*Get-CimInstance -Class Win32_Process*ConvertTo-Csv*Select-Object*$_.Replace*",
        "*function replace_unallowed*$s.replace*Get-Counter*Network Adapter*"
      )
    ) or

    (process.args : "-c" and process.args : "&{'*") or

    (process.args : "-Outfile" and process.args : "Start*") or

    (process.args : "-bxor" and process.args : "0x*") or

    process.args : "$*$*;set-alias" or

    process.args == "-e" or

    // ATHPowerShellCommandLineParameter
    process.args : ("-EncodedCommandParamVariation", "-UseEncodedArguments", "-CommandParamVariation") or

    (
      process.parent.name : ("explorer.exe", "cmd.exe") and
      process.command_line : ("*-encodedCommand*", "*Invoke-webrequest*", "*WebClient*", "*Reflection.Assembly*"))
    ) and
    not process.command_line : (
      "*Use-Icinga -Minimal*",
      "*& {$j = sajb {Add-Type -AssemblyName*"
    )

Field Validations

Loading…

Comments (0)

Loading comments...