Skip to content

[Bug]: HEIC Item Length Triggers Unbounded Read #246

@tylzh97

Description

@tylzh97

Summary

HEICExifFinder.find_exif() trusts HEIC iloc metadata and forwards attacker-controlled item_length values straight into
fh.read().

poc:

>>> import resource
>>> from pathlib import Path
>>> from exifread.core.heic import HEICExifFinder
>>> resource.setrlimit(resource.RLIMIT_AS, (512 * 1024 * 1024,) * 2)
>>> fh = Path("heic_OverRead.heic").open("rb")
>>> HEICExifFinder(fh).find_exif()

Traceback:

MemoryError: read request exceeded 512 MiB cap

heic_OverRead.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions