Potential Hex Payload Execution
This rule detects potential hex payload execution on Linux systems. Adversaries may use hex encoding to obfuscate payloads and evade detection mechanisms.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2024/11/04"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/11/04"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule detects potential hex payload execution on Linux systems. Adversaries may use hex encoding to obfuscate payloads
11and evade detection mechanisms.
12"""
13from = "now-9m"
14index = ["logs-endpoint.events.process*"]
15language = "eql"
16license = "Elastic License v2"
17name = "Potential Hex Payload Execution"
18risk_score = 21
19rule_id = "0c1e8fda-4f09-451e-bc77-a192b6cbfc32"
20setup = """## Setup
21
22This rule requires data coming in from Elastic Defend.
23
24### Elastic Defend Integration Setup
25Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
26
27#### Prerequisite Requirements:
28- Fleet is required for Elastic Defend.
29- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
30
31#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
32- Go to the Kibana home page and click "Add integrations".
33- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
34- Click "Add Elastic Defend".
35- Configure the integration name and optionally add a description.
36- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
37- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
38- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
39- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
40For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
41- Click "Save and Continue".
42- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
43For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
44"""
45severity = "low"
46tags = [
47 "Domain: Endpoint",
48 "OS: Linux",
49 "Use Case: Threat Detection",
50 "Tactic: Defense Evasion",
51 "Tactic: Execution",
52 "Data Source: Elastic Defend",
53]
54timestamp_override = "event.ingested"
55type = "eql"
56query = '''
57process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
58 (process.name == "xxd" and process.args like ("-r*", "-p*")) or
59 (process.name like "python*" and process.command_line like "*fromhex*" and process.command_line like ("*decode*", "*encode*")) or
60 (process.name like "php*" and process.command_line like "*hex2bin*") or
61 (process.name like "ruby*" and process.command_line like "*].pack(\"H*\")*") or
62 (process.name like "perl*" and process.command_line like "*pack(\"H*\",*") or
63 (process.name like "lua*" and process.command_line like "*tonumber(cc, 16)*")
64)
65'''
66
67[[rule.threat]]
68framework = "MITRE ATT&CK"
69
70 [rule.threat.tactic]
71 name = "Defense Evasion"
72 id = "TA0005"
73 reference = "https://attack.mitre.org/tactics/TA0005/"
74
75 [[rule.threat.technique]]
76 name = "Obfuscated Files or Information"
77 id = "T1027"
78 reference = "https://attack.mitre.org/techniques/T1027/"
79
80 [[rule.threat.technique]]
81 name = "Deobfuscate/Decode Files or Information"
82 id = "T1140"
83 reference = "https://attack.mitre.org/techniques/T1140/"
84
85[[rule.threat]]
86framework = "MITRE ATT&CK"
87
88 [rule.threat.tactic]
89 name = "Execution"
90 id = "TA0002"
91 reference = "https://attack.mitre.org/tactics/TA0002/"
92
93 [[rule.threat.technique]]
94 id = "T1059"
95 name = "Command and Scripting Interpreter"
96 reference = "https://attack.mitre.org/techniques/T1059/"
97
98 [[rule.threat.technique.subtechnique]]
99 name = "Unix Shell"
100 id = "T1059.004"
101 reference = "https://attack.mitre.org/techniques/T1059/004/"
102
103 [[rule.threat.technique]]
104 name = "User Execution"
105 id = "T1204"
106 reference = "https://attack.mitre.org/techniques/T1204/"
107
108 [[rule.threat.technique.subtechnique]]
109 name = "Malicious File"
110 id = "T1204.002"
111 reference = "https://attack.mitre.org/techniques/T1204/002/"
Related rules
- Git Hook Created or Modified
- Git Hook Child Process
- Git Hook Command Execution
- Git Hook Egress Network Connection
- Suspicious APT Package Manager Execution