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

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

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

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

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
SC3010-Computer-Security — Struts2와 PowerShell을 사용하여 CVE-2017-5638 OGNL Injection 취약점을 재현 | Kitploit
도구/GitHubGitHub/aipeacs/sc3010-computer-security
Static AnalysisVulnerability AnalysisCode AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationPayload DevelopmentLabs & PracticeArchived
GitHubaipeacs/sc3010-computer-security

SC3010-Computer-Security

3개월 전아직 검토되지 않음

인기

모두 보기 →

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

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

Struts2와 PowerShell을 사용하여 CVE-2017-5638 OGNL Injection 취약점을 재현

저장소 보기

SC3010-Computer-Security — CVE-2017-5638 공격 재현

이 저장소는 SC3010 컴퓨터 보안 과정 프로젝트의 일부입니다.
CVE-2017-5638, Apache Struts 2(버전 2.3.52.3.31 및 2.52.5.10)의 치명적인 원격 코드 실행 취약점을 재현합니다. 이 취약점은 2017년 Equifax 데이터 유출 사건에서 악용되어 약 1억 4700만 명의 개인 기록을 유출한 것으로 유명합니다.

이 취약점은 단일 설계 결함에서 비롯됩니다. Apache Struts가 multipart/form-data 업로드 요청을 파싱하지 못할 때, Content-Type 헤더의 원시 값을 (살균 처리 없이) 오류 메시지에 포함시켜 문자열로 만든 후 OGNL 표현식 평가기에 전달합니다. 따라서 Content-Type 헤더 내에 OGNL 표현식을 넣은 공격자는 서버 측에서 Tomcat 프로세스 사용자 권한으로 이를 실행하게 됩니다.

이 저장소는 다음을 포함합니다:

  • 파일 업로드 엔드포인트가 있는 작동하는 취약한 Java/Maven 서버 (Struts2 2.3.28)
  • 전체 주입 → RCE 체인을 보여주는 PowerShell 익스플로잇 스크립트
  • 호출 체인의 각 단계를 매핑한 Apache Struts 2.3.28의 주석이 달린 참조 소스 파일

배경 지식

  • OGNL 주입은 어떻게 작동하나요?

저장소 구조

root@kitploit:~
SC3010-Computer-Security/
├── simulation/
│   ├── backend/          # Vulnerable Apache Struts2 2.3.28 server (Java/Maven)
│   └── attack-script/    # Exploit script for CVE-2017-5638
│       └── exploit_cve_2017_5638.ps1   # PowerShell (cross-platform)
├── struts-src-code/          # Apache Struts2 reference source + legal notices
│   ├── licenses/             # LICENSE, NOTICE, and component licenses
│   └── src/
│       ├── struts2-core/     # Request pipeline classes + vulnerable JakartaMultiPartRequest
│       ├── xwork2/           # ActionContext.java, OgnlUtil.java
│       └── ognl/             # OgnlContext.java
├── diagrams/                 # State-machine + sequence diagrams, annotated OGNL payload
└── _notes/                   # Background reading

익스플로잇 시뮬레이션

  • 설정 및 사용 방법은 simulation/README.md를 참조하세요.

공격 상태 머신 다이어그램

아래 다이어그램은 Struts2 요청 파이프라인의 각 결정 분기를 보여줍니다. 빨간색 경로는 공격자가 강제로 따르는 경로이고, 회색 → ... 분기는 익스플로잇 중에 적용되지 않는 안전한 경로입니다.

root@kitploit:~
flowchart TD
    Start([Attacker sends HTTP POST /upload.action<br/>Content-Type: &#37;&#123;OGNL_PAYLOAD&#125;.multipart/form-data])
    Start --> PIPE

    PIPE["<b>Struts2 filter → wrap → parse pipeline</b><br/>doFilter() → PrepareOperations.wrapRequest()<br/>→ Dispatcher.wrapRequest() → new MultiPartRequestWrapper()"]
    PIPE --> D_CT{"Content-Type contains<br/>&quot;multipart/form-data&quot;?"}
    D_CT -- "No → normal request ..." --> OUT_NORM([non-upload path ...])
    D_CT -- "Yes (attacker appends<br/>.multipart/form-data to payload)" --> PARSE

    PARSE[/"<b>JakartaMultiPartRequest.parse()</b><br/>→ Commons FileUpload.parseRequest()"/]
    PARSE --> D_VALID{"FileUpload can parse<br/>Content-Type?"}
    D_VALID -- "Yes → normal file upload ..." --> OUT_OK([files extracted, action executes ...])
    D_VALID -- "No — malformed Content-Type<br/>throws InvalidContentTypeException<br/>(message = raw Content-Type string)" --> CATCH

    CATCH["parse() catch block<br/>calls buildErrorMessage(e, &#123;&#125;)"]
    CATCH --> FIND

    FIND[/"<b>buildErrorMessage()</b><br/>→ LocalizedTextUtil.findText(class, errorKey, locale, e.getMessage(), args)"/]
    FIND --> D_KEY{"Resource bundle has key<br/>struts.messages.upload.error.*?"}
    D_KEY -- "Yes → safe localised message ..." --> OUT_SAFE([error displayed safely ...])
    D_KEY -- "No — falls back to<br/>e.getMessage() as the default<br/>(attacker's raw Content-Type)" --> TRANSLATE

    TRANSLATE["TextParseUtil.translateVariables()<br/>scans string for &#37;&#123;...&#125; expressions"]
    TRANSLATE --> D_OGNL{"String contains<br/>&#37;&#123;...&#125; OGNL expression?"}
    D_OGNL -- "No → plain error string ..." --> OUT_PLAIN([safe error message ...])
    D_OGNL -- "Yes — evaluates OGNL<br/>inside attacker content" --> SANDBOX

    SANDBOX[/"<b>OGNL sandbox bypass</b><br/>#ognlUtil.getExcludedClasses().clear()<br/>#ognlUtil.getExcludedPackageNames().clear()"/]
    SANDBOX --> ACCESS

    ACCESS[/"<b>Unrestricted reflection</b><br/>#context.setMemberAccess(DEFAULT_MEMBER_ACCESS)"/]
    ACCESS --> RCE

    RCE[/"<b>RCE</b><br/>Runtime.getRuntime().exec(cmd)"/]
    RCE --> Done([Command executed as Tomcat process user])

    style Start fill:#d32f2f,color:#fff
    style Done fill:#d32f2f,color:#fff
    style OUT_NORM fill:#9e9e9e,color:#fff
    style OUT_OK fill:#9e9e9e,color:#fff
    style OUT_SAFE fill:#9e9e9e,color:#fff
    style OUT_PLAIN fill:#9e9e9e,color:#fff
    style SANDBOX fill:#b71c1c,color:#fff
    style ACCESS fill:#b71c1c,color:#fff
    style RCE fill:#b71c1c,color:#fff
    style CATCH fill:#e65100,color:#fff
    style TRANSLATE fill:#e65100,color:#fff

분기 설명이 포함된 전체 상태 머신은 diagrams/cve-2017-5638-state-machine.md를 참조하세요.
시퀀스 다이어그램 보기 및 주석이 달린 OGNL 페이로드 분석은 diagrams/cve-2017-5638-attack-chain.md를 참조하세요.


타사 소프트웨어 고지

이 저장소는 학술적 보안 연구 목적으로 Apache Struts 2.3.28 소스 코드의 일부를 재현합니다.

Apache Struts는 Copyright © 2000–2016 The Apache Software Foundation입니다.
Apache License, Version 2.0에 따라 라이선스가 부여됩니다.
라이선스 사본은 struts-src-code/licenses/LICENSE.txt에서 확인할 수 있습니다.
Apache License에서 요구하는 전체 저작권 표시는 struts-src-code/licenses/NOTICE.txt에 있습니다.

Apache Struts 2는 각각 자체 라이선스가 적용되는 추가 타사 구성 요소를 번들로 포함합니다:

구성 요소라이선스 파일
OGNL (Object-Graph Navigation Library)

출처 참조:

  • apache/struts @ STRUTS_2_3_28 — Struts2 코어 및 XWork
  • jkuhnert/ognl — OGNL 3.0.x
  • Gemini — 일반 OGNL 언어에 대한 자문
도구 다운로드
struts-src-code/licenses/OGNL-LICENSE.txt
XWorkstruts-src-code/licenses/XWORK-LICENSE.txt
FreeMarkerstruts-src-code/licenses/FREEMARKER-LICENSE.txt