User Execution: Malicious Image

Adversaries may rely on a user running a malicious image to facilitate execution. Amazon Web Services (AWS) Amazon Machine Images (AMIs), Google Cloud Platform (GCP) Images, and Azure Images as well as popular container runtimes such as Docker can be backdoored. Backdoored images may be uploaded to a public repository via Upload Malware, and users may then download and deploy an instance or container from the image without realizing the image is malicious, thus bypassing techniques that specifically achieve Initial Access. This can lead to the execution of malicious code, such as code that executes cryptocurrency mining, in the instance or container.[1]

Adversaries may also name images a certain way to increase the chance of users mistakenly deploying an instance or container from the image (ex: Match Legitimate Name or Location).[2]

ID: T1204.003
Sub-technique of:  T1204
Tactic: Execution
Platforms: Containers, IaaS
Permissions Required: User
Contributors: Center for Threat-Informed Defense (CTID); Vishwas Manral, McAfee
Version: 1.1
Created: 30 March 2021
Last Modified: 26 August 2021

Procedure Examples

ID Name Description
G0139 TeamTNT

TeamTNT has relied on users to download and execute malicious Docker images.[3]

Mitigations

ID Mitigation Description
M1047 Audit

Audit images deployed within the environment to ensure they do not contain any malicious components.

M1045 Code Signing

Utilize a trust model such as Docker Content Trust with digital signatures to ensure runtime verification of the integrity and publisher of specific image tags.[4][5]

M1031 Network Intrusion Prevention

Network prevention intrusion systems and systems designed to scan and remove malicious downloads can be used to block activity.

M1017 User Training

Train users to be aware of the existence of malicious images and how to avoid deploying instances and containers from them.

Detection

ID Data Source Data Component Detects
DS0015 Application Log Application Log Content

Monitor logs from cloud platforms like AWS, GCP, or Azure to detect anomalies related to container or image execution. Look for unusual patterns or log events that deviate from typical behavior.

Analytic 1 - Unusual application logs indicating image execution anomalies.

sourcetype=application_log EventCode=1000 OR EventCode=1001| search log_level=ERROR OR log_level=WARNING OR message IN ("failed to pull image", "container crash", "unauthorized access")

DS0017 Command Command Execution

Monitor for suspicious commands related to image or container manipulation, especially commands run from users not typically associated with these tasks.

Analytic 1 - Unexpected command execution related to image files.

sourcetype=command_execution| search command IN ("docker pull", "docker run", "docker exec", "kubectl run", "gcloud container images list-tags", "aws ec2 run-instances")

DS0032 Container Container Creation

Track the deployment of new containers, especially from newly built images.

Container Start

Monitor the behavior of containers within the environment to detect anomalous behavior or malicious activity after users deploy from malicious images.

DS0007 Image Image Creation

Monitor the local image registry to make sure malicious images are not added.

DS0030 Instance Instance Creation

Monitor for newly constructed instances that may attempt to take advantage of a weakness in an Internet-facing computer or program using software, data, or commands in order to cause unintended or unanticipated behavior.

Instance Start

Monitor for the activation or invocation of an instance (ex: instance.start within GCP Audit Logs)

References