Privileged Docker Container Creation

This rule leverages the new_terms rule type to identify the creation of a potentially unsafe docker container from an unusual parent process. Attackers can use the --privileged flag to create containers with escalated privileges, which can lead to trivial privilege escalation, docker escaping and persistence. access.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2024/07/10"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2024/11/07"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10This rule leverages the new_terms rule type to identify the creation of a potentially unsafe docker container from an
 11unusual parent process. Attackers can use the `--privileged` flag to create containers with escalated privileges, which
 12can lead to trivial privilege escalation, docker escaping and persistence. access.
 13"""
 14from = "now-9m"
 15index = ["logs-endpoint.events.process*"]
 16language = "kuery"
 17license = "Elastic License v2"
 18name = "Privileged Docker Container Creation"
 19risk_score = 21
 20rule_id = "a80d96cd-1164-41b3-9852-ef58724be496"
 21setup = """## Setup
 22This rule requires data coming in from Elastic Defend.
 23### Elastic Defend Integration Setup
 24Elastic 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.
 25#### Prerequisite Requirements:
 26- Fleet is required for Elastic Defend.
 27- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 28#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 29- Go to the Kibana home page and click "Add integrations".
 30- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 31- Click "Add Elastic Defend".
 32- Configure the integration name and optionally add a description.
 33- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 34- 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).
 35- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 36- 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.
 37For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 38- Click "Save and Continue".
 39- 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.
 40For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 41"""
 42severity = "low"
 43tags = [
 44    "Domain: Endpoint",
 45    "Domain: Container",
 46    "OS: Linux",
 47    "Use Case: Threat Detection",
 48    "Tactic: Execution",
 49    "Data Source: Elastic Defend",
 50]
 51timestamp_override = "event.ingested"
 52type = "new_terms"
 53
 54query = '''
 55host.os.type:linux and event.category:process and event.type:start and event.action:exec and process.name:docker and
 56process.args:(run and --privileged)
 57'''
 58
 59
 60[[rule.threat]]
 61framework = "MITRE ATT&CK"
 62[[rule.threat.technique]]
 63id = "T1059"
 64name = "Command and Scripting Interpreter"
 65reference = "https://attack.mitre.org/techniques/T1059/"
 66[[rule.threat.technique.subtechnique]]
 67id = "T1059.004"
 68name = "Unix Shell"
 69reference = "https://attack.mitre.org/techniques/T1059/004/"
 70
 71
 72[[rule.threat.technique]]
 73id = "T1609"
 74name = "Container Administration Command"
 75reference = "https://attack.mitre.org/techniques/T1609/"
 76
 77
 78[rule.threat.tactic]
 79id = "TA0002"
 80name = "Execution"
 81reference = "https://attack.mitre.org/tactics/TA0002/"
 82[[rule.threat]]
 83framework = "MITRE ATT&CK"
 84[[rule.threat.technique]]
 85id = "T1611"
 86name = "Escape to Host"
 87reference = "https://attack.mitre.org/techniques/T1611/"
 88
 89
 90[rule.threat.tactic]
 91id = "TA0004"
 92name = "Privilege Escalation"
 93reference = "https://attack.mitre.org/tactics/TA0004/"
 94
 95[rule.new_terms]
 96field = "new_terms_fields"
 97value = ["process.parent.executable"]
 98[[rule.new_terms.history_window_start]]
 99field = "history_window_start"
100value = "now-14d"

Related rules

to-top