
CVE-2024-38819 Spring Framework 경로 탐색 취약점을 시연하는 실습형 랩입니다. 취약한 Spring Boot 배포와 패치된 Spring Boot 배포를 통해 보안 교육을 제공합니다.
이는 CVE-2024-38819에 대한 Cloud Foundry 준비 Spring Boot 데모입니다. 이 취약점은 기능적 정적 리소스 처리에서의 Spring Framework 경로 탐색 취약점입니다.
CVE-2024-38819는 Spring Framework에서 패치되었으며, Spring Boot에서 직접 패치된 것은 아닙니다.
Spring Boot는 애플리케이션이 사용하는 Spring Framework 종속성 버전을 관리하기 때문에 데모에서 여전히 중요합니다. 즉, Spring Boot 유지 관리 릴리스가 수정된 Framework 버전을 가져올 수 있지만, 취약한 코드 경로와 보안 수정은 Spring Framework의 WebFlux/WebMvc 기능적 정적 리소스 처리에 있습니다.
앱은 작은 고객 문서 금고 UI를 제공합니다. 공개 문서는 FileSystemResource와 함께 WebFlux.fn RouterFunctions.resources(...)를 사용하여 /files/**에서 제공되며, 이는 Spring 권고의 취약한 조건과 일치합니다. 시작 시 앱은 다음을 생성합니다:
비밀은 앱에서 생성되며 실제 자격 증명을 포함하지 않습니다.
이 실습 환경은 의도적으로 두 모드 모두에서 Spring Boot를 3.3.4로 유지하고 관리되는 Spring Framework 버전만 변경합니다:
| 모드 | Spring Boot | Spring Framework | 아티팩트 |
|---|
| 취약 | 3.3.4 | 6.1.13 | target/cve-2024-38819-vulnerable.jar |
| 패치됨 | 3.3.4 | 6.1.14 | target/cve-2024-38819-patched.jar |
patched Maven 프로파일은 다음을 설정합니다:
<spring-framework.version>6.1.14</spring-framework.version>
해당 프로파일이 없으면 Spring Boot 3.3.4는 Spring Framework 6.1.13을 관리하며, 이는 데모에 사용된 취약한 버전입니다.
두 데모 아티팩트를 빌드하세요:
scripts/build-artifacts.sh
이 명령은 두 개의 별도 배포 가능 jar를 생성합니다:
target/cve-2024-38819-vulnerable.jar
target/cve-2024-38819-patched.jar
mvn spring-boot:run
열기:
http://127.0.0.1:8080
제한된 증명 실행:
python3 scripts/prove-secret-exposure.py --expect vulnerable
예상 취약 결과:
RESULT: vulnerable behavior confirmed. The fake secret was served from outside the public file root.
패치된 모드 실행:
mvn -Ppatched spring-boot:run
그런 다음:
python3 scripts/prove-secret-exposure.py --expect patched
취약 버전 푸시:
scripts/cf-push-vulnerable.sh
이 명령은 target/cve-2024-38819-vulnerable.jar를 patch-your-spring-vulnerable로 배포합니다.
앱 라우트에 대해 증명 실행:
python3 scripts/prove-secret-exposure.py \
--target https://YOUR-VULNERABLE-ROUTE \
--allow-remote-demo \
--expect vulnerable
패치된 버전 푸시:
scripts/cf-push-patched.sh
이 명령은 target/cve-2024-38819-patched.jar를 patch-your-spring-patched로 배포합니다.
동일한 증명 실행:
python3 scripts/prove-secret-exposure.py \
--target https://YOUR-PATCHED-ROUTE \
--allow-remote-demo \
--expect patched
정리:
cf delete patch-your-spring-vulnerable -f -r
cf delete patch-your-spring-patched -f -r