-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PanasonicRawWbInfo2Descriptor: Infinite recursion extracting light source #419
Comments
As far as I can see, this bug can be triggered quite easily with corrupted/invalid files. The infinite loop is very small, just 3 steps, but it's unclear to me exactly where the "logical flaw" is and thus where the fix should be done. All it takes to achieve this is that the metadata-extractor/Source/com/drew/metadata/exif/PanasonicRawWbInfoDescriptor.java Lines 48 to 56 in ddf21d0
..so that getWbTypeDescription(tagType) is called, that the following returns a value (not null): metadata-extractor/Source/com/drew/metadata/exif/PanasonicRawWbInfoDescriptor.java Line 65 in ddf21d0
..and that the returned value doesn't match anything in this switch: metadata-extractor/Source/com/drew/metadata/TagDescriptor.java Lines 416 to 461 in ddf21d0
Without a match here, it defaults back to In the example file in this issue, the value is |
Thank you very much for this interesting file. It'd definitely be interesting to hear more about how you generated it. Confirming that the bug is present in the dotnet implementation as well. |
This file is not a valid image and was generated by fuzzing. It triggers an infinite loop in PanasonicRawWbInfoDescriptor and related code.
@drewnoakes: Glad you found the testcase interesting! It was actually generated automatically using coverage-guided fuzzing while we were testing Apache Tika. I haven't looked at metadata-extractor directly, yet :) Fuzzing is the automated process of finding software bugs by feeding random data into a target program until one of those permutations reveals a flaw. It's been responsible for discovering a large number of security-critical issues found in operating systems, browsers, ... One of the most important fuzzing advancement has been coverage guidance. A coverage-guided fuzzer gathers coverage information for each random input it tries. If a random input exercises new code, the fuzzer will keep it in a set of interesting inputs. The fuzzer will then generate new inputs by mutating those interesting inputs. Coverage-guided fuzzing scales to complex programs. For instance, AFL, a coverage guided fuzzer, has been used to generate JPEG images out of thin air. By fuzzing a JPEG parser with a coverage-guided fuzzer, the fuzzer eventually generates valid JPEG images! The odds of that happening without coverage guidance is infinitesimally small. Shameless plug: I work on Mayhem, the system that won the DARPA Cyber Grand Challenge. We're adapting our bug finding tech to Java and memory-safe languages. We think fuzz testing should be as fundamental as unit testing, and we're actively looking for partners to work with! |
Extracting the light source from PanasonicRawWbInfo2 metadata can lead to an infinite recursion.
Stacktrace
Steps to repro
You can reproduce the issue by downloading infinite-recursion.txt and running:
java -cp metadata-extractor-2.12.0.jar com.drew.imaging.ImageMetadataReader infinite-recursion.txt
The file was generated by fuzzing and is not a valid file format. I used a .txt extension so that github would allow me to upload it.
The text was updated successfully, but these errors were encountered: