Heap-buffer-overflow in frame_get_metalayers in c-blosc2
Summary
OSV-2022-322: Heap-buffer-overflow in frame_get_metalayers. Affects c-blosc2 versions >= 5f5213c23cc8608537b234e93ee5dae31a77aaff, < 7f4574f51ad7db56fc13de89e13e7893b1a82189. Fixed in 7f4574f51ad7db56fc13de89e13e7893b1a82189. 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
c-blosc2 is an open-source library that provides a high-performance compression and decompression API for multi-threaded applications. It is commonly used to improve the efficiency of data storage and transmission. However, a vulnerability has been discovered in the frame_get_metalayers function of c-blosc2, which can lead to a heap-buffer-overflow read. This vulnerability can potentially be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition.
Vulnerability Detail
The vulnerability in c-blosc2 arises from a heap-buffer-overflow read in the frame_get_metalayers function. This function is responsible for retrieving the metalayers associated with a compressed frame. By exploiting this vulnerability, an attacker can read beyond the boundaries of the allocated buffer, potentially accessing sensitive information or causing the application to crash. The vulnerability has a medium severity rating and has been reported through the OSS-Fuzz project. The issue has been fixed in commit 7f4574f51ad7db56fc13de89e13e7893b1a82189.
How To Fix
Minimum fixed version
7f4574f51ad7db56fc13de89e13e7893b1a82189
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 implement input validation and boundary checks in their applications to prevent the exploitation of this vulnerability. By ensuring that the input to the frame_get_metalayers function is within the expected range, the risk of a heap-buffer-overflow read can be mitigated. Here is an example of how input validation can be implemented in C:
void get_metalayers_wrapper(void* frame) {
if (frame != NULL) {
frame_get_metalayers(frame);
}
}
Conclusion
The heap-buffer-overflow vulnerability in the frame_get_metalayers function of c-blosc2 can have serious security implications. It is recommended to update the library to a fixed version or implement the provided workaround to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for c-blosc2 →
FAQ
c-blosc2 is an open-source library that provides a high-performance compression and decompression API for multi-threaded applications. It is commonly used to improve the efficiency of data storage and transmission.
This vulnerability can potentially allow an attacker to execute arbitrary code or cause a denial-of-service condition by reading beyond the boundaries of an allocated buffer.
To fix this vulnerability, update the c-blosc2 library to a version that includes the fix commit 7f4574f51ad7db56fc13de89e13e7893b1a82189.
Yes, developers can implement input validation and boundary checks in their applications to mitigate the risk of exploitation.
You can report this vulnerability to the c-blosc2 GitHub repository or through the OSS-Fuzz project.
References
Related vulnerabilities
Recent vulnerabilities recorded for c-blosc2.