{
  "technique_id": "T1609",
  "name": "Container Administration Command",
  "priority": "high",
  "status": "draft",
  "version": "0.1.0",
  "last_reviewed": "2026-07-23",
  "generated_by": "SOC Response Atlas by Basyrix",
  "tactics": [
    "Execution"
  ],
  "platforms": [
    "Containers"
  ],
  "summary": "Adversaries may abuse a container administration service to execute commands within a container. A container administration service such as the Docker daemon, the Kubernetes API server, or the kubelet may allow remote management of containers within an environment. In Docker, adversaries may specify an entrypoint during container deployment that executes a script or command, or they may use a command such as <code>docker exec</code> to execute a command within a running container...",
  "soc_recommendation": "Investigate Container Administration Command activity in the context of Execution: confirm scope, affected host/identity, and whether it matches expected administrative behaviour before deciding this is benign.",
  "d3fend_mappings": [
    {
      "id": "D3-NTA",
      "name": "Network Traffic Analysis",
      "relationship": "detect",
      "practical_action": "Monitor for Network Traffic Analysis indicators relevant to this technique.",
      "tooling": [
        "Sentinel",
        "Defender for Endpoint"
      ]
    }
  ],
  "investigation_steps": {
    "microsoft": [
      "Review Defender for Endpoint / Defender XDR alerts and timeline for the affected host or identity.",
      "Check Sentinel analytics rules and incidents correlated with this technique.",
      "Review Entra ID sign-in and audit logs if the technique involves an identity or cloud resource."
    ],
    "generic": [
      "Confirm whether the observed container administration command activity matches expected administrative or application behaviour.",
      "Identify the host, account, or resource where the activity occurred and its business criticality.",
      "Check for related alerts before and after this activity to reconstruct the broader intrusion timeline.",
      "Real detection reference: \"Kubernetes Pod Exec Cloud Instance Metadata Access\" -- Detects Kubernetes pod exec sessions whose decoded command line references cloud instance metadata endpoints or equivalent hostnames and paths..."
    ]
  },
  "evidence_to_collect": [
    "Host or resource affected",
    "Account or identity involved",
    "Timestamp of the activity",
    "Related process, file, or network artifact",
    "Any preceding or follow-on alerts"
  ],
  "response_actions": [
    {
      "name": "Contain the affected host or account",
      "category": "Containment",
      "risk": "Medium",
      "automation_safe": false,
      "approval_required": true,
      "tool": "Defender for Endpoint / Entra ID",
      "notes": "Requires approval -- confirm malicious intent before isolating a host or disabling an account."
    },
    {
      "name": "Collect and preserve evidence",
      "category": "Investigation",
      "risk": "Low",
      "automation_safe": true,
      "approval_required": false,
      "tool": "Defender for Endpoint",
      "notes": "Safe -- read-only evidence collection."
    }
  ],
  "queries": {
    "kql": [
      {
        "name": "Starting point for T1609",
        "description": "Generic starting query -- tune to the specific data source relevant to this technique.",
        "query": "DeviceEvents\n| where TimeGenerated > ago(24h)\n| where ActionType has \"<tune to T1609>\""
      }
    ],
    "spl": [],
    "esql": [
      {
        "name": "a8e7d6c5-b4a3-2918-0f9e-8d7c6b5a4032 — Kubernetes Pod Exec Cloud Instance Metadata Access",
        "description": "(ESQL) Detects Kubernetes pod exec sessions whose decoded command line references cloud instance metadata endpoints or equivalent hostnames and paths... (Source: Elastic's official detection-rules repository (Elastic License v2).)",
        "query": "FROM logs-kubernetes.audit_logs-* metadata _id, _index, _version\n| WHERE kubernetes.audit.objectRef.subresource == \"exec\"\n  AND kubernetes.audit.requestURI LIKE \"*command=*\"\n| EVAL decoded_uri = URL_DECODE(kubernetes.audit.requestURI)\n| GROK decoded_uri \"%{DATA}/exec\\\\?%{DATA:raw_commands}&(?:container|stdin|stdout|stderr)=%{GREEDYDATA}\"\n| EVAL command = REPLACE(raw_commands, \"command=\", \"\")\n| EVAL command = REPLACE(command, \"&\", \" \")\n| EVAL Esql.executed_command = REPLACE(command, \"\\\\+\", \" \")\n| WHERE Esql.executed_command IS NOT NULL \n  AND Esql.executed_command RLIKE \"\"\".*(169\\.254\\.169\\.254|2852039166|0xa9fea9fe|/latest/api/token|/latest/meta-data|/latest/user-data|/latest/dynamic/instance-identity|computeMetadata/v1|metadata\\.google\\.internal|metadata/identity/oauth2/token|metadata/instance).*\"\"\"\n| EVAL Esql.cloud_target = CASE(\n    Esql.executed_command RLIKE \"\"\".*(169\\.254\\.169\\.254|2852039166|0xa9fea9fe|/latest/meta-data|/latest/api/token|/latest/user-data|/latest/dynamic).*\"\"\", \"AWS_IMDS\",\n    Esql.executed_command RLIKE \"\"\".*(computeMetadata/v1|metadata\\.google\\.internal).*\"\"\", \"GCP_METADATA\",\n    Esql.executed_command RLIKE \"\"\".*metadata/identity/oauth2/token.*\"\"\", \"AZURE_IMDS\",\n    \"UNKNOWN\"\n  )\n| EVAL Esql.is_credential_theft = CASE(\n    Esql.executed_command RLIKE \"\"\".*(security-credentials|/api/token|oauth2/token|service-accounts/.*/token).*\"\"\", \"yes\",\n    \"recon\"\n  )\n| KEEP *"
      },
      {
        "name": "b2c3d4e5-f6a7-4890-b1c2-d3e4f5a60789 — Kubernetes Pod Exec Sensitive File or Credential Path Access",
        "description": "(ESQL) Detects Kubernetes pod exec sessions whose decoded command line references high-value host or in-cluster paths and material types: mounted service account or platform tokens, kubelet and control-plane configuration areas, host identity stores, root dot-directories for cloud and kubeconfig material, common private-key and keystore extensions, process environment dumps, and configuration filenames s.. (Source: Elastic's official detection-rules repository (Elastic License v2).)",
        "query": "from logs-kubernetes.audit_logs-* metadata _id, _index, _version\n| WHERE kubernetes.audit.objectRef.subresource == \"exec\"\n  AND kubernetes.audit.requestURI LIKE \"*command=*\"\n| EVAL decoded_uri = URL_DECODE(kubernetes.audit.requestURI)\n| GROK decoded_uri \"%{DATA}/exec\\\\?%{DATA:raw_commands}&(?:container|stdin|stdout|stderr)=%{GREEDYDATA}\"\n| EVAL command = REPLACE(raw_commands, \"command=\", \"\")\n| EVAL command = REPLACE(command, \"&\", \" \")\n| EVAL Esql.executed_command = REPLACE(command, \"\\\\+\", \" \")\n| WHERE Esql.executed_command IS NOT NULL \n  AND Esql.executed_command RLIKE \"\"\".*(/var/run/secrets/|/etc/kubernetes/|/var/lib/kubelet/|/etc/shadow|/etc/passwd|/etc/sudoers|(/root|/home/[^/]+)/\\.(ssh|aws|azure|kube|config/gcloud)|\\.p12|\\.pem|\\.key|\\.jks|\\.keystore|/etc/.*\\.conf.*(password|secret|key|token|credential)|/proc/.*/environ).*\"\"\"\n  AND NOT Esql.executed_command RLIKE \"\"\".*/etc/resolv\\.conf.*\"\"\"\n| EVAL Esql.access_type = CASE(\n    Esql.executed_command RLIKE \"\"\".*/var/run/secrets/eks\\.amazonaws\\.com.*\"\"\", \"AWS_IRSA_TOKEN\",\n    Esql.executed_command RLIKE \"\"\".*/var/run/secrets/azure/tokens/.*\"\"\", \"AZURE_WORKLOAD_IDENTITY_TOKEN\",\n    Esql.executed_command RLIKE \"\"\".*/var/run/secrets/tokens/gcp-ksa/.*\"\"\", \"GCP_WORKLOAD_IDENTITY_TOKEN\",\n    Esql.executed_command RLIKE \"\"\".*/var/run/secrets/kubernetes\\.io/serviceaccount/token.*\"\"\", \"K8S_SA_TOKEN\",\n    Esql.executed_command RLIKE \"\"\".*/var/run/secrets/.*\"\"\", \"MOUNTED_SECRET\",\n    Esql.executed_command RLIKE \"\"\".*\\.(p12|pem|key|jks|keystore).*\"\"\", \"CERTIFICATE_OR_KEY\",\n    Esql.executed_command RLIKE \"\"\".*/etc/kubernetes/.*\"\"\", \"K8S_CONFIG\",\n    Esql.executed_command RLIKE \"\"\".*/var/lib/kubelet/.*\"\"\", \"KUBELET_CONFIG\",\n    Esql.executed_command RLIKE \"\"\".*/etc/shadow.*\"\"\", \"HOST_CREDENTIALS\",\n    Esql.executed_command RLIKE \"\"\".*/etc/passwd.*\"\"\", \"USER_ENUMERATION\",\n    Esql.executed_command RLIKE \"\"\".*/etc/sudoers.*\"\"\", \"SUDOERS_ACCESS\",\n    Esql.executed_command RLIKE \"\"\".*(/root|/home)/\\.(ssh|aws|azure|kube|config/gcloud).*\"\"\", \"USER_CREDENTIALS\",\n    Esql.executed_command RLIKE \"\"\".*/proc/.*/environ.*\"\"\", \"PROCESS_ENV_SECRETS\",\n    Esql.executed_command RLIKE \"\"\".*/etc/.*\\.conf.*(password|secret|key|token|credential).*\"\"\", \"EMBEDDED_CONFIG_SECRET\",\n    \"OTHER_SENSITIVE\"\n  )\n| KEEP *"
      }
    ]
  },
  "automation": {
    "safe": [
      "Add recommendation as Sentinel incident comment.",
      "Run enrichment queries.",
      "Create ServiceNow SecOps task."
    ],
    "approval_required": [
      "Contain or disable the affected host/account.",
      "Any change to production configuration."
    ]
  },
  "escalation_criteria": [
    "Container Administration Command activity observed on a privileged account or critical system.",
    "Activity follows or precedes other suspicious behaviour in the same investigation.",
    "Automated triage cannot confidently rule out malicious intent."
  ],
  "false_positive_considerations": [
    "Legitimate administrative or maintenance activity matching this pattern.",
    "Approved security testing or red team exercise.",
    "Known benign software producing similar telemetry."
  ],
  "confluence": {
    "title": "T1609 - Container Administration Command Response Guidance",
    "labels": [
      "mitre",
      "attack",
      "d3fend",
      "secops",
      "basyrix"
    ],
    "sections": [
      "summary",
      "d3fend_mappings",
      "investigation_steps",
      "response_actions",
      "queries",
      "automation",
      "escalation_criteria",
      "false_positive_considerations"
    ]
  }
}