T1543.005 Elastic Security · Elastic

Detect Container Service in Elastic Security

Adversaries may create or modify container or container cluster management tools that run as daemons, agents, or services on individual hosts. These include software for creating and managing individual containers, such as Docker and Podman, as well as container cluster node-level agents such as kubelet. By modifying these services, an adversary may achieve persistence or escalate their privileges on a host. Common abuse patterns include using 'docker run' or 'podman run' with the '--restart=always' directive to configure a container to persistently restart after daemon restarts or host reboots, using '--privileged', '--pid=host', or '--net=host' flags to break container isolation and gain access to the underlying host kernel, bind-mounting the root filesystem ('-v /:/') to read or modify host files, and leveraging Kubernetes DaemonSets to deploy malicious containers persistently across all current and future cluster nodes. Threat actor groups including TeamTNT have exploited exposed Docker APIs to deploy cryptomining and backdoor containers with restart=always policies. Privilege escalation via docker group membership is documented in GTFOBins and widely exploited in post-exploitation scenarios.

MITRE ATT&CK

Tactic
Persistence Privilege Escalation
Technique
T1543 Create or Modify System Process
Sub-technique
T1543.005 Container Service
Canonical reference
https://attack.mitre.org/techniques/T1543/005/

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by host.id with maxspan=5m
  [process where event.type == "start" and
   process.name in ("docker", "podman", "nerdctl") and
   process.args : "run" and
   (
     process.args : "--restart=always" or
     process.args : "--restart" and process.args : "always" or
     process.args : "--privileged" or
     process.args : "--pid=host" or
     process.args : "--net=host" or
     process.args : "--network=host" or
     process.args : "--cap-add=SYS_ADMIN" or
     process.args : "--cap-add=ALL" or
     process.args : "-v" and process.args : "/:/" or
     process.args : "--volume" and process.args : "/:/" or
     process.args : "--device" and process.args : "/dev/mem" or
     process.args : "--device" and process.args : "/dev/kmem"
   )]
until [process where event.type == "end" and process.name in ("docker", "podman", "nerdctl")]

/* Standalone container exec shell detection */
any where event.category == "process" and event.type == "start" and
  process.name in ("docker", "podman", "nerdctl") and
  process.args : "exec" and
  process.args : ("/bin/bash", "/bin/sh", "/bin/zsh", "bash", "sh") and
  not process.parent.name in ("containerd", "dockerd", "containerd-shim")
high severity high confidence

Detects container service abuse for persistence and privilege escalation (T1543.005). Monitors docker, podman, and nerdctl run commands with dangerous flags including --restart=always for persistence, --privileged/--pid=host/--net=host/--cap-add for privilege escalation, and -v /:/ for host filesystem bind mounts. Also detects interactive shell exec into running containers indicating post-exploitation activity.

Data Sources

Linux Auditd via Elastic AgentElastic Endpoint SecurityFleet-managed Elastic Agents on container hosts

Required Tables

logs-endpoint.events.process-*auditbeat-*filebeat-*

False Positives & Tuning

  • Legitimate DevOps workflows using --privileged for Docker-in-Docker (DinD) CI/CD pipelines such as Jenkins, GitLab Runner, or GitHub Actions self-hosted runners
  • Container orchestration tools (Ansible, Chef, Puppet) that legitimately exec into containers for configuration management and health checks
  • Security scanning tools (Trivy, Falco, Anchore) that mount host filesystems read-only for vulnerability assessment or runtime monitoring
Download portable Sigma rule (.yml)

Other platforms for T1543.005


Testing Methodology

Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Docker Container Persistence via restart=always

    Expected signal: Linux auditd EXECVE: type=EXECVE with a0=docker, a1=run, a2=-d, a3=--restart=always, a4=--name, a5=df00tech-persist-test. MDE DeviceProcessEvents: FileName=docker, ProcessCommandLine contains 'run' and '--restart=always'. Expected PersistenceFlag=true, PrivilegedFlag=false, HostMountFlag=false, RiskScore=1.

  2. Test 2Privileged Container Execution with Host PID Namespace

    Expected signal: Linux auditd EXECVE: type=EXECVE with args containing 'docker', 'run', '--privileged', '--pid=host'. MDE DeviceProcessEvents: ProcessCommandLine contains '--privileged' and '--pid=host'. PrivilegedFlag=true, RiskScore=1.

  3. Test 3Container with Host Root Filesystem Bind Mount

    Expected signal: Linux auditd EXECVE: args containing 'docker', 'run', '-v', '/:/host-root:ro'. MDE DeviceProcessEvents: ProcessCommandLine contains '-v /:/host-root'. HostMountFlag triggers on '-v /:/'. RiskScore=1.

  4. Test 4Combined Persistent Privileged Container (Critical Combination)

    Expected signal: Linux auditd EXECVE: args contain 'docker', 'run', '-d', '--restart=always', '--privileged', '--name', 'df00tech-critical-test'. MDE DeviceProcessEvents: ProcessCommandLine contains '--restart=always' and '--privileged'. PersistenceFlag=true, PrivilegedFlag=true, RiskScore=2.

  5. Test 5Kubernetes DaemonSet Creation for Cluster-Wide Persistence

    Expected signal: Kubernetes API server audit log: verb=create, objectRef.resource=daemonsets, objectRef.namespace=default, objectRef.name=df00tech-persist-daemonset, responseStatus.code=201. AzureDiagnostics Category=kube-audit or AKSAuditAdmin table: DaemonSet creation event with requesting user and full object spec.

Unlock Pro Content

Get the full detection package for T1543.005 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections