Executive brief
OpenCV, a widely-used computer vision library, contains an integer overflow vulnerability in its PXM image file format parser. When processing a maliciously crafted image file from an untrusted source, the vulnerability can lead to denial of service or remote code execution.
Technical details
The vulnerability is an integer overflow (CWE-190) in the ReadNumber function within opencv/modules/imgcodecs/src/grfmt_pxm.cpp. The function fails to validate input length before performing arithmetic operations on pixel dimension values, allowing an attacker to trigger signed integer overflow. The attack vector is network-based if the image is sourced remotely; it requires processing a maliciously crafted PXM image file without strict input validation. Successful exploitation can result in denial of service or remote code execution. The vulnerability was patched in OpenCV 3.3.1.11.
Affected products
- OpenCV OpenCV 3.3.0.9 and earlier
- OpenCV opencv-python 3.3.0.9 and earlier
- OpenCV opencv-contrib-python 3.3.0.9 and earlier
Timeline
- 2017-08-15: disclosed
- 2017: patched: Fixed in OpenCV 3.3.1.11
- 2021-10-12: advisory