On Monday May 28, 2018, during routine operations, Cofense Intelligence™ identified traits across several campaigns that indicated they were linked. In fact, this discovery helped to reveal a sprawling criminal enterprise that uses linked infrastructure to host nearly 100 domains, along with corresponding malware campaigns.
At the early stages of the investigation, it was not possible to tell whether the similarities were the fingerprints of a specific actor or group, or if they were simply the artifacts of an email-templating kit, many of which are sold on the Dark Web. Scraping a little dirt away from the surface, the link between the campaigns seemed to be more than the mere residue of an automated toolkit.
Not only did the emails share traits, but the malware being delivered used an interconnected C2 infrastructure. With a combination of OSINT, freely available tools and proprietary infrastructure, Cofense Intelligence was able to pivot from a single indicator of compromise, to uncover a widespread criminal network.
Note: all ‘From’ fields depicted in this blog were spoofed by the attacker.
Table 1 lists the six campaigns and their respective subject lines.
|11802||RE: Bank Account Re-Confirmation URGENT!!!||Pony|
|11799||Re: Freight Remittance||Pony|
|11798||RE: CONFIRM REMITTANCE||Pony|
|11797||RE: Problem with intermediary bank||Pony|
Table 1: Details of the campaigns that began the unmasking of this infrastructure
Despite there being a small amount of narrative overlap, each of these are generic enough to easily be construed as ‘just another Pony campaign’. The filenames used by these campaigns are as generic and distinct as the subject lines, as shown in Table 2.
Table 2: The files used across the six initial campaigns
A tighter correlation was starting to emerge. Threat IDs 11802, 11801, 11880 11799, and 11797 all had filenames suffixed with a mock double-extension of _pdf.exe, or .pdf.zip.
Although a pattern can be discerned between about 83% of the campaigns, the omission of the final piece of the puzzle – namely Threat ID 11800 – there is far more to observe and correlate. The headers for these messages provided yet another clue to their origin.
Figures 1 through 6 show example message headers for each of the campaigns.
Figure 1: Example message header from Threat ID 11797
Figure 2: Example message header from Threat ID 11798
Figure 3: Example message header from Threat ID 11799
Figure 4: Example message header from Threat ID 117800
Figure 5: Example message header from Threat ID 11801
Figure 6: Example message header from Threat ID 11802 with forged from domains highlighted
What can we glean from these message headers? An incredible amount of data. The first thing that should be noted is these messages all originated from servers running Exim MTA. In March of 2018, a critical vulnerability – 2018-6789 – allowed Remote Code Execution (RCE) on any version of Exim prior to 4.9.1. Although 5 out of 6 MTAs involved in these campaigns report as running version 4.9.1 – the version in which 2018-6789 was fixed – it’s almost certain that these servers were compromised prior to the patch being applied, and that the persistence mechanism injected into the compromised server is still functional.
There are several other circumstantial pieces of evidence in the header content:
- The To: field is always set to ‘undisclosed-recipients;’
- The messages all contain a single hop (one received from Header) or are proxied through a same-origin front end (the messages in campaign 11797 use SquirrelMail as an interface with Exim)
- Except for 11797, all messages use a RoundCube User Agent
- Many header fields contain the same random, faked email address or email address-like structure
Although programmatically difficult to describe with any accuracy, the email addresses, X-Sender, and Message ID fields all follow a very distinct pattern: a series of hex characters, an ‘@’ symbol, more hex characters, a dot, then a gTLD or ccTLD. Given the limited sample size, we can loosely describe this pattern with a regular expression: [a-f0-9][email protected][a-f0-9]+\.[a-z.]+
Parsing our example messages, we get a clearer understanding of these structures, as seen in Figure 7.
Figure 7: Spoofed message headers containing random, hex-based email address and domains
Each individual element that we’ve discussed so far could be dismissed as circumstantial. To that end, we can begin working backwards, from an IoC chosen from Table 3, to a Threat ID, and associated messages.
|Threat ID||Block Data||Type||Impact|
Table 3: IoCs associate with the six campaigns
Of note are the multiple different overlaps in the data. Threat IDs 11797, 11800, and 11801 share a domain. 11802, 11801, 11800, 11799, and 11797 all adhere to the same URL structure. Unfortunately, neither of these overlaps are conclusive nor ubiquitous throughout our data set. There is, however, a single node that will give us the perfect platform from which to pivot: the resolved IP address for each domain, is the same:
185[.]6[.]242[.]251 is the final stitch that secures the tapestry of these campaigns. Given the ease with which internet resources can be obtained by malicious actors, and the sheer number of candidates available, having the same IP used to house infrastructure across six campaigns removes any doubt about this being a coincidence.
This IP functions as a pivot from which we can invert our previous efforts – in which we identified a campaign or campaigns and followed the trail until we reached an IoC – such that we can obtain campaign IDs from a single node.
We can now identify 48 distinct campaigns launched between 2018-04-13 12:45:03 and 2018-05-28 10:53:17. These campaigns served either Pony or Loki directly. Table 4 details a small subset of these findings.
|Threat ID||Block Data||IP||Family|
Table 4: Some additional campaigns identified after pivoting from 185[.]6[.]242[.]251
These campaigns included malicious files as seen in Table 5.
Table 5: Companion malicious files to Table 4
Figures 8 through 10 provide example message headers for these campaigns.
Figure 8: Example message header from Threat ID 11729
Figure 9: Example message header from Threat ID 11741
Figure 10: Example message header from Threat ID 11780
Messages in Threat IDs 11729 and 11740 show significant similarities with our initial six campaign message sets. Messages in 11780, however, are distinct from the observed consistencies in other campaigns. Despite being linked by the IP address, this campaign clearly bears no similarities with the other campaigns. This is likely because the actors controlling this campaign channel kept their tactics diverse, or the web server being used to host the C2s is shared among threat actors.
Where Do We Go From Here?
Despite demonstrating impressive correlation between Cofense™-identified campaigns, there is much more we can do to further investigate this infrastructure. Most importantly is to perform a Reverse DNS lookup to find domains hosted on an IP. Using an rDNS on our node, we can see what other sites may be lurking there. Table 6 details just such a lookup.
|Domain||IP||Email Address/Domain Count||Date Registered|
|Stauniverseqp[.]com||185[.]6[.]242[.]251||Grace[.][email protected][.]ru 25 domains||2018-04-04|
|Theonlygoodman[.]com||185[.]6[.]242[.]251||[email protected][.]com 2 domains||2017-07-04|
|Domainsender[.]info||185[.]6[.]242[.]251||[email protected][.]com 15 domains||2017-11-19|
|tiwana[.]website||185[.]6[.]242[.]251||[email protected][.]com 6 domains||2018-01-18|
|Sunnynaturelstone[.]com||185[.]6[.]242[.]251||Soft[.][email protected][.]ru 79 domains||2018-04-12|
|Uniqscans[.]com||185[.]6[.]242[.]251||[email protected][.]com 42 domains||2017-09-03|
Table 6: A small subset domains hosted on our node, as found during our rDNS pivot on 185[.]6[.]242[.]251
At the time of writing, there are 24 domains that resolve to 185[.]6[.]242[.]251. Of these, 19 are registered with Freemail addresses; 5 are registered with WhoIs privacy guards. Drilling down into these email addresses reveals 206 additional domains. These domains directly correspond to 28 separate campaigns, as far back as May 22, 2017. This brings the total number of linked campaigns to 96.
Understanding the way threats interact is a key component of responsive, and in many cases, predictive analytics. By discovering a unique feature and pivoting intelligently, it’s possible to uncover a veritable mountain of data from a single, initial node. Adding in recursion can, for all intents and purposes, lead to an infinitely connected series of domains, IPs, URLs, and files. Intelligence deliverables, then, aren’t just about what one directly observes; they’re about inference, judgement, and tenacity.
Here’s a visualization of the data points in this blog:
For a comprehensive analysis of the past year in malware, plus a look ahead, view the 2018 Cofense Malware Review.