Cozy Duke
Cozy Duke
2
Introduction
This attack scenario replicates an "in the wild" infection of the CozyDuke (aka CozyBear, CozyCar or “Office Monkeys”) Trojan. This
Trojan has been known to target high-profile organizations via spear-phishing campaigns. It delivers its payloads via compromised web
servers. These initial payloads provide anti-detection routines and a vector to download the second stage that provides typical trojan
functionality such as command execution interfaces, screen captures, file transfers, system information exfiltration, etc. In this scenario we
will use AMP for Endpoints to discover the malicious activity and find all associated secondary infections.
Important! In the following scenario the policy for the AMP for Endpoints Connector was set to audit-only mode to show the full range of
actions malicious files could take and how each action is recorded and displayed by AMP for Endpoints.
1
The Attack
The attack is an email phishing campaign that entices the user to click a link to download a ZIP archive containing a malicious executable
file. Once downloaded, the file uses an Adobe Flash icon to appear benign. When the user opens the file it plays a flash movie while their
machine is infected with the CozyDuke Trojan. In order to appear legitimate CozyDuke drops a signed AMD executable, which it then uses
to load its own malicious DLL files on execution using DLL search path abuse. These events are simple to identify within the console as
will be demonstrated.
In a typical scenario these download links point to web servers that have been previously compromised by attackers that are then used as a
delivery vector for their malicious files and communications.
2
Detection and Remediation
When you log in to the AMP for Endpoints Console the first page you see is the Dashboard Overview. This page shows you recent file and
network detection events from your Connectors. It’s a convenient summary of the major trouble spots in your AMP for Endpoints
deployment that allows you to perform triage to determine which computers are in most need of immediate attention.
The Indications of Compromise on the Dashboard Overview helps with triage by listing computers with multiple events or separate events
that correlate with certain types of infections. In our scenario we see that the top computers with indications of compromise have
experienced file detections.
Since computers at the top of the list are considered to have more severe compromise indicators than those lower on the list, we’ll start at
the top. Click the information icon next to the computer name in the list and select Device Trajectory to begin the incident response process.
Tracing Backwards
When we first look at the Device Trajectory for this computer, we immediately see obvious signs that it has been compromised since there
are five red entries in the file list on the left, indicating known malware detections.
In the most recent events - those furthest to the right - we see a large number of network connections being made by a seemingly benign
executable 'amdocl_as32.exe'. Although the executable itself appears to be marked 'clean' (highlighted in green) the file is being launched
by a malicious executable called 'player.exe' being detected as 'W32.Generic:CozyDukeB.18fx.1201'.
3
Detection and Remediation
If we continue to trace back further we see three other malicious files called 'aticaldd.dll' (detected as W32.0DC7438BE5-100.SBX.VIOC.),
'amdhcp32.dll' (detected as W32.Generic:KCX.18fv.1201.), and 'atiumdag.dll' (detected as W32.Generic:Cozer.18fv.1201.) being created
by 'player.exe'.
The files are suspicious in and of themselves as they are detected, however, DLLs being dropped show another malware technique. If we
look at the paths of the DLL files and the dropped clean file we see they all reside within the
c:\users\administrator\appdata\roaming\ati_subsystem\ directory.
This indicates the clean file being dropped is being used by the malware authors to launch malicious DLL files. This is commonly known
as "DLL search path abuse" in which the original author of the clean (typically signed) software does not check the authenticity of the shared
libraries it is loading within its search path and in turn can be used to load anything (including malicious files).
If we continue to trace back further we see the initial creation and execution of our 'player.exe' file. It was created and executed by another
malicious file that is called 'monkeys.swf.exe' being detected as 'W32.GenericKD:CozyDukeB.18f0.1201.'.
We also see that this file was created by 'explorer.exe' - another common and clean Windows executable. 'Explorer.exe' on Windows serves
a number of purposes, including having the ability to decompress archived files. If we look further in the past we see the creation of the file
'monkeys[1].zip' by Internet Explorer. This is indicative that the file was downloaded from the Internet.
4
Detection and Remediation
Prior to this, Internet Explorer made a connection to 'http://sanjosemaristas.com/monkeys.zip' which confirms this suspicion.
What the above demonstrates is the attack scenario that involves a user clicking and downloading an executable within a zip file from a
clicked link (in this case a spear-phishing email link), decompressing the file using 'explorer.exe', and the execution of the archived file. The
further connections made by 'amdocl_as32.exe' are also being made to the same compromised server, this is indicative of command and
control communications.
Remediation
In order to prevent any further CnC communications, a remdiation step would include the blacklisting of IP address 188.120.225.17. The
next step would include identifying any further infections of CozyDuke within your enterprise. In order to do this you can upload the
CozyDukePersistDetected.ioc Endpoint IOC and perform a scheduled, or on-demand Endpoint IOC Flash Scan. The Endpoint IOC
provided checks for Windows registry run keys that are known to be used by the CozyFuke trojan, namely
'Microsoft\Windows\CurrentVersion\Run\atibtmon_Plugin' which contains a reference to the 'amdocl_as32.exe' executable providing the
aformentioned malicious DLL as a parameter 'atiumdag.dll'. It also verifies the presence of the 'aitumdag.dll' file on the filesystem within
the 'ATI_Subsystem' directory.