Detection rules › Elastic

Hexadecimal IP Command-Line Argument

Source
github.com/elastic/protections-artifacts

This rule detects the execution of processes with command-line arguments that contain hexadecimal representations of an IP addresses/domain. This behavior may indicate an attempt to obfuscate the command-line arguments, potentially for malicious purposes.

MITRE ATT&CK coverage

TacticTechniques
Stealth

Rule body

[rule]
description = """
This rule detects the execution of processes with command-line arguments that contain hexadecimal representations of an
IP addresses/domain. This behavior may indicate an attempt to obfuscate the command-line arguments, potentially for
malicious purposes.
"""
id = "00e564c5-5b7d-427a-8892-fb4238cb895f"
license = "Elastic License v2"
name = "Hexadecimal IP Command-Line Argument"
os_list = ["linux"]
reference = ["https://asec.ahnlab.com/en/57635/"]
version = "1.0.5"

query = '''
process where event.type == "start" and event.action == "exec" and process.parent.executable != null and (
  process.executable like ("./*", "/boot/*", "/dev/shm/*", "/run/*", "/var/run/*", "/tmp/*", "/var/tmp/*") or
  process.name like ("curl", "wget", ".*", "python*", "perl*", "ruby*", "php*", "lua*", "node*")
) and
process.command_line like~ ("*http://0x*", "*https://0x*") and
not (
  (
    process.executable like "/usr/bin/php*" and
    process.parent.executable == "/usr/bin/timeout" and
    process.args == "/var/tools/koalaping/bin/ping.php"
  ) or
  (
    process.executable == "/usr/local/bin/php" and
    process.parent.executable == "/usr/bin/bash" and
    process.args == "/usr/local/bin/wp"
  )
)
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"

[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.parent.executable != null and (
  process.executable like ("./*", "/boot/*", "/dev/shm/*", "/run/*", "/var/run/*", "/tmp/*", "/var/tmp/*") or
  process.name like ("curl", "wget", ".*", "python*", "perl*", "ruby*", "php*", "lua*", "node*")
) and
process.command_line like~ ("*http://0x*", "*https://0x*") and
not (
  (
    process.executable like "/usr/bin/php*" and
    process.parent.executable == "/usr/bin/timeout" and
    process.args == "/var/tools/koalaping/bin/ping.php"
  ) or
  (
    process.executable == "/usr/local/bin/php" and
    process.parent.executable == "/usr/bin/bash" and
    process.args == "/usr/local/bin/wp"
  )
)

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.command_linewildcard
  • *http://0x*
  • *https://0x*
field:"CommandLine" kind:wildcard
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /run/*
  • /tmp/*
  • /var/run/*
  • /var/tmp/*
field:"Image" kind:wildcard
process.namewildcard
  • .*
  • curl
  • lua*
  • node*
  • perl*
  • php*
  • python*
  • ruby*
  • wget
field:"process_name" kind:wildcard
process.parent.executableis_not_null
  • (no value, null check)
field:"ParentImage" kind:is_not_null