Malware of the Day – Comfoo
What is Malware of the Day?
Lab Setup
Malware: Comfoo
AKA: Comfoo RAT
Traffic Type: APT
Connection Type: Reverse HTTP
C2 Platform: Cobalt Strike
Origin of Sample: https://github.com/rsmudge/Malleable-C2-Profiles/blob/master/APT/comfoo.profile
Host Payload Delivery Method: Powershell one-liner
Target Host/Victim: 192.168.99.52 – Windows 10 x64
C2 Server: 68.183.138.51
Beacon Timing: 30s
Jitter: 20%
Brief
Our focus is on identifying and detecting network beaconing behavior. We are using AI-Hunter/RITA as our network threat and C2/beacon detection platform to visualize the network traffic generated from running the Comfoo malware replication. We encourage you to download and use the PCAP files included in the next section to analyze these files independently using your preferred threat hunt platform to test your detection capabilities.
This week we are looking at Comfoo, a malware that initially emerged ~10 years ago, however the methods and communication forms used by the Comfoo malware continue to be common methods observed in many different strains and adaptations of malware today.
The above screenshot is taken of the AI-Hunter Beacons module from a 24-hour traffic capture. The Comfoo traffic has been detected as a strong beacon signal of 90.20%.
In the green highlighted box is the beacon timing showing the number of connections of each interval of time in seconds. Here we can see the majority of the connection timing distributions are between 24 and 30 second intervals. We have multiple strong signals that spread out across this range.
Viewing the connections timing in a graph like this we can observe the jitter that has been introduced into the timing of a deviation of 20% from 30 seconds. This amount of jitter will most likely spoof most beacon detection tools that are looking for very rigid timing patterns. Note we have some outliers at 9-10 seconds, however, these consistent clusters of connection timings are still evidence of programmed machine communications and our threat hunt platform has picked this up.
In the red highlighted box above are the number of connections per hour (each blue block is a one-hour time frame). The consistency of the number of connections per hour is a tell-tale indicator of non-human behavior. Notice the flatness and uniformity of the hourly histogram. Normal users’ traffic will be much more random in nature and would display greater peaks and valleys in the graph over time.
Switching to the connections data size view (shown in the green highlighted box above), we can immediately see the majority of communications are the same data size. For this sample, we have a total of 10272 connections. 8919 of them with 743 byte payloads. This is obviously uniform and structured communications and is a solid representation of a potential C2 channel “heartbeat” of checking in for marching orders or to maintain persistence.
Normal users’ network communications will vary greatly in data size. The data size analysis is confirming these are programmed communications to be investigated.
A similar beacon analysis can be performed using our open-source framework RITA (Real Intelligence Threat Analytics). RITA detected the Comfoo sample traffic as a strong threat, giving it a score of 0.902 (90.2% beacon/threat). The network RITA is analyzing here is a malware lab and the Comfoo sample is definitely a threat to be investigated.
Capture Files
Because… PCAPs, or it didn’t happen. 😊
The following PCAP files are packet captures taken from our lab environment over a one-hour time frame and a 24-hour time frame. The files were generated using Wireshark from the target host and include normal Windows OS traffic and normal network broadcast traffic. They have not been edited. The PCAPs are safe, standard PCAP files and do not include any actual malware.
Comfoo 1 Hour Capture
comfoo_1hr.pcap (served by Dropbox)
Size: 1.55 MB
MD5 Checksum: 443569f9a370678d53274d825ebdb9f2
Comfoo 24 Hour Capture
comfoo_24hr.pcap (served by Dropbox)
Size: 41.4 MB
MD5 Checksum: 48f96e609f7e5052607d97437d701e04
Discussion
Want to talk about this or anything else concerning threat hunting? Want to share how good (or bad) other detection tools were able to detect this Comfoo sample?
Join our Discord server titled “Threat Hunter Community” to discuss topics surrounding threat hunting. We invite you to join our server here.
Additional Resources
https://www.zdnet.com/article/researchers-reveal-details-of-active-comfoo-cyberespionage-campaign/
https://otx.alienvault.com/pulse/588a86387de8ff2102a84c28
Until the next!
Keith’s appreciation for computing and processes originates from working with his first personal computer in 1982, a TI-99/4A. Keith sees himself as fortunate for the opportunity to apply his passion towards a career that assists in the advance of technology and continuing education.