Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4014

Malformed/pathological/malicious input can lead to infinite looping



    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0 JBIG2
    • Fix Version/s: 3.0.0 JBIG2
    • Component/s: JBIG2
    • Labels:


      Tilman Hausherr writes

      See this issue:


      look for "pdfium-loop2.pdf".

      I haven't created an issue, because this could be relevant to security.

      To reproduce the bug with PDFBox, do this:

      PDDocument document = PDDocument.load(new
      new PDFRenderer(document).renderImage(0);

      For maven you need


      and of course jbig2.

      An analysis shows that two circumstances contribute to the problem:

      1. T.88 section E.2.10 specifies that MQ encoded data can be minimized if trailing data contains "just boring stuff, i.e. 1-bits". Thus, an infinite sequence of MQ encoded decisions can be encoded in a finite number of bytes.
      2. T.88 section 6.4.5 3c specifies that the condition for terminating the decoding of a text region strip is the occurrence of the OOB symbol as a symbol's S coordinate.

      If a JBIG2 stream contains a strip that uses #1 yielding a stream of S coordinates that never contain OOB during the decoding phase for #2, an infinite loop results, as text region decoding has no other terminating condition.

      The result is "just" a denial of service. No risk of buffer overruns etc. is associated with the issue.

      A similar issue exists with symbol dictionary decoding. However in this case decoding will not enter an infinite loop due to an array index out of bounds exception that is thrown once more symbols than expected have been decoded.




            • Assignee:
              hennejg Joerg O. Henne
              hennejg Joerg O. Henne
            • Votes:
              0 Vote for this issue
              4 Start watching this issue


              • Created: