Heap-buffer-overflow in libheif: HeifContext::interpret_heif_file
Summary
OSV-2023-736: Heap-buffer-overflow in HeifContext::interpret_heif_file. Affects libheif versions >= 6fb8e4cd53619e547be0045ad1615aa429b7f336, < cd6274a9e5e106ea990fb150e781d79848b74337. Fixed in cd6274a9e5e106ea990fb150e781d79848b74337. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
libheif is an open-source library for reading and writing HEIF (High Efficiency Image Format) image files. It provides functionality to interpret and manipulate HEIF files, allowing developers to integrate HEIF support into their applications. However, a vulnerability has been discovered in the library that can lead to a heap-buffer-overflow when interpreting HEIF files.
Vulnerability Detail
The vulnerability in libheif, specifically in the HeifContext::interpret_heif_file function, allows for a heap-buffer-overflow read of 4 bytes. This can result in a crash when the library attempts to read from memory. The issue was reported through the OSS-Fuzz project and has been assigned a medium severity level. The vulnerability was introduced in commit 6fb8e4cd53619e547be0045ad1615aa429b7f336 of the libheif repository.
How To Fix
Minimum fixed version
cd6274a9e5e106ea990fb150e781d79848b74337
This is the first release that contains the fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, developers can consider implementing input validation and sanitization when processing HEIF files. By carefully checking the input data and ensuring it adheres to expected formats and sizes, the risk of triggering the heap-buffer-overflow can be mitigated. However, this is not a definitive solution and should be seen as a temporary measure until the library is updated.
Conclusion
The libheif library is affected by a heap-buffer-overflow vulnerability that can lead to crashes and potential security issues. It is recommended to update the library to a patched version as soon as possible. Developers can check the official repository for updates and follow the provided upgrade process. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for libheif →
FAQ
libheif is an open-source library for reading and writing HEIF image files. It provides functionality to interpret and manipulate HEIF files.
A heap-buffer-overflow occurs when a program attempts to read or write data outside the bounds of a buffer allocated in the heap. In this case, the vulnerability allows for a read of 4 bytes beyond the allocated buffer.
The heap-buffer-overflow vulnerability in libheif can lead to a crash when processing malicious or specially crafted HEIF files. It may also be possible for an attacker to exploit this vulnerability to execute arbitrary code or trigger other security issues.
This vulnerability was discovered through the OSS-Fuzz project, which performs continuous fuzz testing on open-source software. The issue was reported and subsequently investigated by the libheif maintainers.
The vulnerability has been assigned a medium severity level, indicating a moderate level of risk. While it is not considered critical, it should still be addressed to prevent potential security issues.
References
Related vulnerabilities
Recent vulnerabilities recorded for libheif.