Detection rules › Elastic

External IP Address Discovery via a Trusted Program

Time window
5m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies scripting utilities and commonly abused binary proxy programs making a DNS request to a known public IP address lookup web service. Malwares tend to perform this action to assess potential targets.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies scripting utilities and commonly abused binary proxy programs making a DNS request to a known public IP
address lookup web service. Malwares tend to perform this action to assess potential targets.
"""
id = "51894221-7657-4b56-9406-e080e19ad159"
license = "Elastic License v2"
name = "External IP Address Discovery via a Trusted Program"
os_list = ["windows"]
version = "1.0.38"

query = '''
sequence by process.entity_id with maxspan=5m
  [process where event.action == "start" and user.id like ("S-1-5-21*", "S-1-12-*") and
    (
     process.name : ("wscript.exe", "cscript.exe", "regsvr32.exe", "mshta.exe", "rundll32.exe", "vbc.exe",
                     "powershell.exe", "pwsh.exe", "msbuild.exe", "wmic.exe", "cmstp.exe", "RegAsm.exe",
                     "installutil.exe","RegSvcs.exe", "msxsl.exe", "xwizard.exe", "csc.exe", "curl.exe") or 
                     
     (process.name : "node.exe" and  process.Ext.relative_file_name_modify_time <= 300) or 
     
     process.executable : ("?:\\Program Files\\Java\\jre*\\bin\\javaw.exe",
                           "?:\\Program Files (x86)\\Java\\jre*\\bin\\javaw.exe",
                           "?:\\Program Files\\Java\\jre*\\bin\\java.exe",
                           "?:\\Program Files (x86)\\Java\\jre*\\bin\\java.exe",
                           "?:\\Windows\\Microsoft.NET\\*.exe")
     ) and
     not (process.name : "powershell.exe" and process.working_directory : "\\\\VMHOST\\Users\\*\\Downloads\\" and
          process.parent.executable : "\\Device\\Mup\\VMHOST\\*") and
     not process.command_line :  "\"C:\\Program Files\\PowerShell\\7\\pwsh.exe\""
   ]
  [dns where
    dns.question.name :
         (
          "ip-api.com",
          "checkip.dyndns.org",
          "api.ipify.org",
          "api.ipify.com",
          "whatismyip.akamai.com",
          "bot.whatismyipaddress.com",
          "ifcfg.me",
          "ident.me",
          "ipof.in",
          "ip.tyk.nu",
          "icanhazip.com",
          "curlmyip.com",
          "wgetip.com",
          "eth0.me",
          "ipecho.net",
          "ip.appspot.com",
          "api.myip.com",
          "geoiptool.com",
          "api.2ip.ua",
          "api.ip.sb",
          "ipinfo.io",
          "checkip.amazonaws.com",
          "wtfismyip.com",
          "iplogger.*",
          "freegeoip.net",
          "freegeoip.app",
          "ipinfo.io",
          "geoplugin.net",
          "myip.dnsomatic.com",
          "www.geoplugin.net",
          "api64.ipify.org",
          "ip4.seeip.org",
          "*.geojs.io",
          "*portmap.io",
          "api.2ip.ua",
          "api.db-ip.com",
          "geolocation-db.com",
          "httpbin.org",
          "myip.opendns.com"
         )
  ]
'''

min_endpoint_version = "8.4.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1016"
name = "System Network Configuration Discovery"
reference = "https://attack.mitre.org/techniques/T1016/"


[threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5m, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and user.id like ("S-1-5-21*", "S-1-12-*") and
    (
     process.name : ("wscript.exe", "cscript.exe", "regsvr32.exe", "mshta.exe", "rundll32.exe", "vbc.exe",
                     "powershell.exe", "pwsh.exe", "msbuild.exe", "wmic.exe", "cmstp.exe", "RegAsm.exe",
                     "installutil.exe","RegSvcs.exe", "msxsl.exe", "xwizard.exe", "csc.exe", "curl.exe") or 
                     
     (process.name : "node.exe" and  process.Ext.relative_file_name_modify_time <= 300) or 
     
     process.executable : ("?:\\Program Files\\Java\\jre*\\bin\\javaw.exe",
                           "?:\\Program Files (x86)\\Java\\jre*\\bin\\javaw.exe",
                           "?:\\Program Files\\Java\\jre*\\bin\\java.exe",
                           "?:\\Program Files (x86)\\Java\\jre*\\bin\\java.exe",
                           "?:\\Windows\\Microsoft.NET\\*.exe")
     ) and
     not (process.name : "powershell.exe" and process.working_directory : "\\\\VMHOST\\Users\\*\\Downloads\\" and
          process.parent.executable : "\\Device\\Mup\\VMHOST\\*") and
     not process.command_line :  "\"C:\\Program Files\\PowerShell\\7\\pwsh.exe\""
   ]

Stage 2: dns

[dns where
    dns.question.name :
         (
          "ip-api.com",
          "checkip.dyndns.org",
          "api.ipify.org",
          "api.ipify.com",
          "whatismyip.akamai.com",
          "bot.whatismyipaddress.com",
          "ifcfg.me",
          "ident.me",
          "ipof.in",
          "ip.tyk.nu",
          "icanhazip.com",
          "curlmyip.com",
          "wgetip.com",
          "eth0.me",
          "ipecho.net",
          "ip.appspot.com",
          "api.myip.com",
          "geoiptool.com",
          "api.2ip.ua",
          "api.ip.sb",
          "ipinfo.io",
          "checkip.amazonaws.com",
          "wtfismyip.com",
          "iplogger.*",
          "freegeoip.net",
          "freegeoip.app",
          "ipinfo.io",
          "geoplugin.net",
          "myip.dnsomatic.com",
          "www.geoplugin.net",
          "api64.ipify.org",
          "ip4.seeip.org",
          "*.geojs.io",
          "*portmap.io",
          "api.2ip.ua",
          "api.db-ip.com",
          "geolocation-db.com",
          "httpbin.org",
          "myip.opendns.com"
         )
  ]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.nameeqpowershell.exeexcludes:process.name field:"process.name" value:"powershell.exe"
process.parent.executablestarts_with\Device\Mup\VMHOST\excludes:process.parent.executable field:"process.parent.executable" value:"\Device\Mup\VMHOST\"
process.working_directorywildcard\\VMHOST\Users\*\Downloads\excludes:process.working_directory field:"process.working_directory" value:"\\VMHOST\Users\*\Downloads\"
process.command_lineeq"C:\Program Files\PowerShell\7\pwsh.exe"excludes:process.command_line

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dns.question.namewildcard
  • *.geojs.io
  • *portmap.io
  • api.2ip.ua
  • api.db-ip.com
  • api.ip.sb
  • api.ipify.com
  • api.ipify.org
  • api.myip.com
  • api64.ipify.org
  • bot.whatismyipaddress.com
  • checkip.amazonaws.com
  • checkip.dyndns.org
  • curlmyip.com
  • eth0.me
  • freegeoip.app
  • freegeoip.net
  • geoiptool.com
  • geolocation-db.com
  • geoplugin.net
  • httpbin.org
  • icanhazip.com
  • ident.me
  • ifcfg.me
  • ip-api.com
  • ip.appspot.com
  • ip.tyk.nu
  • ip4.seeip.org
  • ipecho.net
  • ipinfo.io
  • iplogger.*
  • ipof.in
  • myip.dnsomatic.com
  • myip.opendns.com
  • wgetip.com
  • whatismyip.akamai.com
  • wtfismyip.com
  • www.geoplugin.net
field:"QueryName" kind:wildcard
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.Ext.relative_file_name_modify_timele
  • 300 transforms: number corpus 9 (elastic 9)
field:"process.Ext.relative_file_name_modify_time" kind:le value:"300"
process.executablewildcard
  • ?:\Program Files (x86)\Java\jre*\bin\java.exe
  • ?:\Program Files (x86)\Java\jre*\bin\javaw.exe corpus 3 (elastic 3)
  • ?:\Program Files\Java\jre*\bin\java.exe
  • ?:\Program Files\Java\jre*\bin\javaw.exe corpus 3 (elastic 3)
  • ?:\Windows\Microsoft.NET\*.exe corpus 8 (elastic 8)
field:"Image" kind:wildcard
process.namewildcard
  • RegAsm.exe corpus 26 (elastic 24, splunk 2)
  • RegSvcs.exe corpus 23 (elastic 21, splunk 2)
  • cmstp.exe corpus 25 (elastic 25)
  • csc.exe corpus 12 (elastic 11, splunk 1)
  • cscript.exe corpus 67 (elastic 65, splunk 2)
  • curl.exe corpus 34 (elastic 31, splunk 3)
  • installutil.exe corpus 37 (elastic 32, splunk 5)
  • msbuild.exe corpus 39 (elastic 36, splunk 3)
  • mshta.exe corpus 84 (elastic 79, splunk 5)
  • msxsl.exe corpus 23 (elastic 22, splunk 1)
  • node.exe corpus 6 (elastic 6)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • pwsh.exe corpus 77 (elastic 48, splunk 29)
  • regsvr32.exe corpus 73 (elastic 68, splunk 5)
  • rundll32.exe corpus 126 (elastic 100, splunk 26)
  • vbc.exe corpus 9 (elastic 8, splunk 1)
  • wmic.exe corpus 66 (elastic 39, splunk 27)
  • wscript.exe corpus 83 (elastic 82, splunk 1)
  • xwizard.exe corpus 16 (elastic 16)
field:"process_name" kind:wildcard
user.idwildcard
  • S-1-12-* corpus 46 (elastic 46)
  • S-1-5-21* corpus 47 (elastic 47)
field:"user.id" kind:wildcard