T1204.003

Malicious Image

Adversaries may rely on a user running a malicious image to facilitate execution. Amazon Web Services AMIs, Google Cloud Platform Images, Azure Images, and container runtimes such as Docker can be backdoored. Backdoored images may be uploaded to public repositories, and users may download and deploy an instance or container without realizing the image is malicious. This technique is commonly used to deploy cryptocurrency miners, backdoors, and data exfiltration tools. TeamTNT is a prominent threat actor known for publishing malicious Docker images to Docker Hub containing XMRig cryptocurrency miners and credential stealers. Adversaries may also typosquat popular image names to increase the likelihood of accidental deployment.

Microsoft Sentinel / Defender
kusto
let MinerProcessNames = dynamic(["xmrig", "xmrig-notls", "minerd", "cpuminer", "cryptonight", "nbminer", "t-rex", "lolminer", "ethminer", "cgminer", "bfgminer", "claymore", "phoenixminer", "teamtntbot"]);
let MiningPoolArgs = dynamic(["stratum+tcp://", "stratum+ssl://", "--donate-level", "-o pool.", "xmrpool", "supportxmr", "minexmr", "moneroocean", "hashvault", "nanopool"]);
let MiningPorts = dynamic([3333, 3334, 4444, 4445, 14444, 45560, 5555, 8333, 7777, 9999, 13333, 19999]);
let MiningPoolDomains = dynamic(["minexmr.com", "supportxmr.com", "nanopool.org", "f2pool.com", "antpool.com", "pool.minergate.com", "xmrpool.eu", "hashvault.pro", "moneroocean.stream", "xmr.pool"]);
// Branch 1: Cryptocurrency miner process execution on endpoints and container hosts
let MinerProcessExecution = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any (MinerProcessNames)
    or ProcessCommandLine has_any (MinerProcessNames)
    or ProcessCommandLine has_any (MiningPoolArgs)
| extend DetectionBranch = "CryptoMinerProcessExecution"
| extend AlertSeverity = "High"
| project
    EventTime = Timestamp,
    HostName = DeviceName,
    UserName = AccountName,
    ProcessName = FileName,
    CommandLine = ProcessCommandLine,
    ParentProcess = InitiatingProcessFileName,
    ParentCommandLine = InitiatingProcessCommandLine,
    DetectionBranch,
    AlertSeverity,
    AdditionalContext = strcat("ParentPID:", tostring(InitiatingProcessId), " SHA256:", SHA256);
// Branch 2: Outbound connections to known mining pool ports and domains
let MiningNetworkConnections = DeviceNetworkEvents
| where Timestamp > ago(24h)
| where (RemotePort in (MiningPorts) and RemoteIPType != "Private")
    or RemoteUrl has_any (MiningPoolDomains)
| where InitiatingProcessFileName !in~ ("firefox.exe", "chrome.exe", "msedge.exe", "brave.exe", "opera.exe", "iexplore.exe")
| extend DetectionBranch = "MiningPoolNetworkConnection"
| extend AlertSeverity = "High"
| project
    EventTime = Timestamp,
    HostName = DeviceName,
    UserName = InitiatingProcessAccountName,
    ProcessName = InitiatingProcessFileName,
    CommandLine = InitiatingProcessCommandLine,
    ParentProcess = InitiatingProcessParentFileName,
    ParentCommandLine = "",
    DetectionBranch,
    AlertSeverity,
    AdditionalContext = strcat("RemoteIP:", RemoteIP, " RemotePort:", tostring(RemotePort), " RemoteUrl:", RemoteUrl);
// Branch 3: Azure VM deployment from community gallery or unknown publisher image
let SuspiciousCloudImageDeploy = AzureActivity
| where TimeGenerated > ago(24h)
| where OperationNameValue =~ "MICROSOFT.COMPUTE/VIRTUALMACHINES/WRITE"
| where ActivityStatusValue =~ "Success"
| extend PropJson = parse_json(Properties)
| extend ImageRef = tostring(PropJson.requestBody)
| where ImageRef has_any ("communityGalleries", "sharedGalleries", "fromCommunityGalleryImageVersion")
    or (ImageRef !has_any ("MicrosoftWindowsServer", "Canonical", "RedHat", "SUSE", "Debian", "OpenLogic", "microsoftwindowsdesktop", "center-for-internet-security-inc")
        and isnotempty(ImageRef))
| extend DetectionBranch = "SuspiciousCloudImageDeployment"
| extend AlertSeverity = "Medium"
| project
    EventTime = TimeGenerated,
    HostName = ResourceGroup,
    UserName = Caller,
    ProcessName = "ARM VM Deployment",
    CommandLine = ImageRef,
    ParentProcess = CallerIpAddress,
    ParentCommandLine = "",
    DetectionBranch,
    AlertSeverity,
    AdditionalContext = strcat("SubscriptionId:", SubscriptionId, " Resource:", _ResourceId);
// Union all detection branches
union MinerProcessExecution, MiningNetworkConnections, SuspiciousCloudImageDeploy
| sort by EventTime desc
high severity medium confidence

Data Sources

Process: Process Creation Network Traffic: Network Connection Creation Cloud Service: Cloud Service Modification Microsoft Defender for Endpoint Azure Activity Logs

Required Tables

DeviceProcessEvents DeviceNetworkEvents AzureActivity

False Positives

  • Legitimate GPU compute or rendering workloads using non-standard network ports that overlap with mining pool port ranges
  • Authorized red team or penetration testing exercises deploying containers or VMs with miner tooling under a formal engagement
  • Internal benchmark and performance testing tools with process names similar to mining tools (e.g., t-rex, cgminer used for GPU stress testing)
  • DevOps data pipeline workers with names like 'ethminer' or 'cpuminer' used for internal job queue processing (not mining)
  • Legitimate third-party marketplace VM deployments for network appliances, security tools, or specialized workloads not from major known publishers

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections