Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3535

Certain strings passed into StrSubstitutor can cause "infinite loop in property interpolation"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.17.2
    • None
    • Core
    • None

    Description

      I believe this is a similar issue to what's listed here, although there it is deemed fixed in 2.17.0: https://issues.apache.org/jira/browse/LOG4J2-3230

      Using Code Intelligence's fuzz testing tool (Jazzer), the exception was found by having the tool pass in generated strings to the replace method of the StrSubstitutor class. See also the message below:

      {{== Java Exception: java.lang.IllegalStateException: Infinite loop in property interpolation of ${k:$}ߤ{${$k:${$k}߀��$}����:$����$}����-: $k
              at org.apache.logging.log4j.core.lookup.StrSubstitutor.checkCyclicSubstitution(StrSubstitutor.java:1087)
              at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:1034)
              at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:1047)
              at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:912)
              at org.apache.logging.log4j.core.lookup.StrSubstitutor.replace(StrSubstitutor.java:467)
              at org.apache.logging.log4j.core.lookup.StrSubstitutor.replace(StrSubstitutor.java:451)
              at Log4jFuzzer.fuzzerTestOneInput(Log4jFuzzer.java:16)}}

       

      In the attachments I included some files that can be used to try and reproduce the issue. The lowercase crash file contains the input that the fuzzing tool passed into the method.

      Attachments

        1. Crash_e4372c5ba2ed2cdbd5d87cfd541a5bcae60fb274.java
          1 kB
          Pascal Koeiman
        2. crash-e4372c5ba2ed2cdbd5d87cfd541a5bcae60fb274
          0.1 kB
          Pascal Koeiman
        3. hhsJazzer.jar
          1.98 MB
          Pascal Koeiman
        4. log4j2.xml
          0.7 kB
          Pascal Koeiman

        Activity

          People

            Unassigned Unassigned
            PsclKmn Pascal Koeiman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: