Detect Container Service in CrowdStrike LogScale
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/
LogScale Detection Query
// T1543.005 — Container Service Persistence and Privilege Escalation
// Signal 1: Container run with suspicious flags
#event_simpleName=ProcessRollup2
| ImageFileName = /(?i)(docker|podman|nerdctl)$/
| CommandLine = /(?i)\srun\s/
| CommandLine = /(--restart.{0,3}always|--privileged|--pid[=\s]host|--net[=\s]host|--network[=\s]host|--cap-add[=\s](SYS_ADMIN|ALL)|-v\s+\/[^:]*:\/|--volume\s+\/[^:]*:\/|--device\s+\/dev\/(mem|kmem))/
| PersistenceFlag := if(CommandLine = /--restart.{0,3}always/, "true", "false")
| PrivilegedFlag := if(CommandLine = /(--privileged|--pid[=\s]host|--net[=\s]host|--network[=\s]host|--cap-add[=\s](SYS_ADMIN|ALL))/, "true", "false")
| HostMountFlag := if(CommandLine = /(-v\s+\/[^:]*:\/|--volume\s+\/[^:]*:\/|--device\s+\/dev\/(mem|kmem))/, "true", "false")
| RiskScore := if(PersistenceFlag="true", 1, 0) + if(PrivilegedFlag="true", 1, 0) + if(HostMountFlag="true", 1, 0)
| AttackPattern := case {
PersistenceFlag="true" AND PrivilegedFlag="true" => "CRITICAL: Persistent privileged container — auto-restart with full host kernel access" ;
PersistenceFlag="true" AND HostMountFlag="true" => "CRITICAL: Persistent container with host root filesystem mount" ;
PrivilegedFlag="true" AND HostMountFlag="true" => "HIGH: Privileged container with host root filesystem access" ;
PersistenceFlag="true" => "MEDIUM: Container persistence via restart=always policy" ;
PrivilegedFlag="true" => "HIGH: Container privilege escalation or host escape via capability flags" ;
HostMountFlag="true" => "HIGH: Host root filesystem bind mount — full host file read/write" ;
default => "MEDIUM: Suspicious container configuration"
}
| ContainerRuntime := replace("(?i).*(docker|podman|nerdctl)$", "\\1", ImageFileName)
| select([@timestamp, ComputerName, UserName, ImageFileName, CommandLine, ParentImageFileName, ParentCommandLine, PersistenceFlag, PrivilegedFlag, HostMountFlag, RiskScore, AttackPattern, ContainerRuntime])
| sort(field=@timestamp, order=desc)
// Signal 2: Container exec spawning interactive shell
| union [
#event_simpleName=ProcessRollup2
| ImageFileName = /(?i)(docker|podman|nerdctl)$/
| CommandLine = /(?i)\sexec\s/
| CommandLine = /(\/bin\/(bash|sh|zsh)|\s-i\s|sh\s-c\s)/
| not(ParentImageFileName = /(containerd|dockerd|containerd-shim)/)
| PersistenceFlag := "false"
| PrivilegedFlag := "false"
| HostMountFlag := "false"
| RiskScore := 1
| AttackPattern := "MEDIUM: Interactive shell exec into running container — potential lateral movement or post-exploitation"
| ContainerRuntime := replace("(?i).*(docker|podman|nerdctl)$", "\\1", ImageFileName)
| select([@timestamp, ComputerName, UserName, ImageFileName, CommandLine, ParentImageFileName, ParentCommandLine, PersistenceFlag, PrivilegedFlag, HostMountFlag, RiskScore, AttackPattern, ContainerRuntime])
] CrowdStrike LogScale CQL detection for T1543.005 container service persistence and privilege escalation. Uses ProcessRollup2 events to identify docker, podman, and nerdctl processes executing run commands with dangerous flags (--restart=always, --privileged, --pid=host, --net=host, --cap-add) or host filesystem bind mounts. Also detects interactive shell exec into running containers. Combines both signals via union for unified analyst view with risk scoring.
Data Sources
Required Tables
False Positives & Tuning
- CrowdStrike Falcon sensor container itself may generate similar process telemetry when the Falcon sensor DaemonSet is deployed with privileged access to collect kernel-level telemetry
- Legitimate Kubernetes CSI driver pods, CNI plugin DaemonSets (Calico, Cilium, Flannel), and storage provisioners that require --privileged mode for kernel module access
- Automated blue team validation tools (Atomic Red Team, Caldera, VECTR) running T1543.005 test cases in authorized security testing environments
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.
- 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.
- 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.
- 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.
- 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.
- 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.
References (12)
- https://attack.mitre.org/techniques/T1543/005/
- https://blog.aquasec.com/teamtnt-reemerged-with-new-aggressive-cloud-campaign
- https://blog.aquasec.com/leveraging-kubernetes-rbac-to-backdoor-clusters
- https://gtfobins.github.io/gtfobins/docker/
- https://docs.docker.com/config/containers/start-containers-automatically/
- https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
- https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/
- https://blog.appsecco.com/kubernetes-namespace-breakout-using-insecure-host-path-volume-part-1-b382f2a6e216
- https://www.redhat.com/sysadmin/podman-run-pods-systemd-services
- https://falco.org/docs/rules/default-macros/
- https://learn.microsoft.com/en-us/azure/aks/monitor-aks
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1543.005/T1543.005.md
Unlock Pro Content
Get the full detection package for T1543.005 including response playbook, investigation guide, and atomic red team tests.