Base64 Decoded Payload Piped to Interpreter

This rule detects when a base64 decoded payload is piped to an interpreter on Linux systems. Adversaries may use base64 encoding to obfuscate data and pipe it to an interpreter to execute malicious code. This technique may be used to evade detection by host- or network-based security controls.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2025/02/21"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2025/02/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10This rule detects when a base64 decoded payload is piped to an interpreter on Linux systems. Adversaries may use
 11base64 encoding to obfuscate data and pipe it to an interpreter to execute malicious code. This technique may
 12be used to evade detection by host- or network-based security controls.
 13"""
 14from = "now-9m"
 15index = ["logs-endpoint.events.process*"]
 16language = "eql"
 17license = "Elastic License v2"
 18name = "Base64 Decoded Payload Piped to Interpreter"
 19risk_score = 47
 20rule_id = "5bdad1d5-5001-4a13-ae99-fa8619500f1a"
 21setup = """## Setup
 22
 23This rule requires data coming in from Elastic Defend.
 24
 25### Elastic Defend Integration Setup
 26Elastic 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.
 27
 28#### Prerequisite Requirements:
 29- Fleet is required for Elastic Defend.
 30- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 31
 32#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 33- Go to the Kibana home page and click "Add integrations".
 34- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 35- Click "Add Elastic Defend".
 36- Configure the integration name and optionally add a description.
 37- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 38- 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).
 39- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 40- 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.
 41For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 42- Click "Save and Continue".
 43- 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.
 44For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 45"""
 46severity = "medium"
 47tags = [
 48    "Domain: Endpoint",
 49    "OS: Linux",
 50    "Use Case: Threat Detection",
 51    "Tactic: Defense Evasion",
 52    "Tactic: Execution",
 53    "Data Source: Elastic Defend",
 54]
 55timestamp_override = "event.ingested"
 56type = "eql"
 57query = '''
 58sequence by host.id, process.parent.entity_id with maxspan=3s
 59  [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
 60    (process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16") and process.command_line like~ "*-*d*") or
 61    (process.name == "openssl" and process.args == "enc" and process.args in ("-d", "-base64", "-a")) or
 62    (process.name like "python*" and
 63    (process.args == "base64" and process.args in ("-d", "-u", "-t")) or
 64    (process.args == "-c" and process.args like "*base64*" and process.command_line like~ "*b64decode*")
 65    ) or
 66    (process.name like "perl*" and process.command_line like~ "*decode_base64*") or
 67    (process.name like "ruby*" and process.args == "-e" and process.command_line like~ "*Base64.decode64*")
 68  )]
 69 [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.name like~ (
 70    "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "python*", "perl*", "ruby*", "lua*", "php*"
 71 )]
 72'''
 73
 74[[rule.threat]]
 75framework = "MITRE ATT&CK"
 76
 77  [rule.threat.tactic]
 78  name = "Defense Evasion"
 79  id = "TA0005"
 80  reference = "https://attack.mitre.org/tactics/TA0005/"
 81
 82    [[rule.threat.technique]]
 83    name = "Obfuscated Files or Information"
 84    id = "T1027"
 85    reference = "https://attack.mitre.org/techniques/T1027/"
 86
 87    [[rule.threat.technique]]
 88    name = "Deobfuscate/Decode Files or Information"
 89    id = "T1140"
 90    reference = "https://attack.mitre.org/techniques/T1140/"
 91
 92[[rule.threat]]
 93framework = "MITRE ATT&CK"
 94
 95  [rule.threat.tactic]
 96  name = "Execution"
 97  id = "TA0002"
 98  reference = "https://attack.mitre.org/tactics/TA0002/"
 99
100    [[rule.threat.technique]]
101    id = "T1059"
102    name = "Command and Scripting Interpreter"
103    reference = "https://attack.mitre.org/techniques/T1059/"
104
105      [[rule.threat.technique.subtechnique]]
106      name = "Unix Shell"
107      id = "T1059.004"
108      reference = "https://attack.mitre.org/techniques/T1059/004/"
109
110    [[rule.threat.technique]]
111    name = "User Execution"
112    id = "T1204"
113    reference = "https://attack.mitre.org/techniques/T1204/"
114
115      [[rule.threat.technique.subtechnique]]
116      name = "Malicious File"
117      id = "T1204.002"
118      reference = "https://attack.mitre.org/techniques/T1204/002/"

Related rules

to-top