CVE-2017-12864: PYSEC-2026-697 - Integer Overflow or Wraparound in OpenCV

CVE-2017-12864 · Severity: low · CVSS 3 · Published 2026-07-02

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.

Technologies: OpenCV, opencv-contrib-python (PyPI), opencv-python (PyPI). Vendors: OpenCV, PyPI.

Quick answers

Is CVE-2017-12864 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2017-12864 being exploited in the wild.
How severe is CVE-2017-12864?
Low severity, with a CVSS score of 3, published 2 July 2026.
Which products and versions are affected?
OpenCV 3.3.0.9 and earlier; opencv-contrib-python (PyPI) ECOSYSTEM:introduced=0,fixed=3.3.1.11; opencv-python (PyPI) ECOSYSTEM:introduced=0,fixed=3.3.1.11.
Is there a fix for CVE-2017-12864?
Yes. opencv-contrib-python (PyPI): upgrade to 3.3.1.11 or later; opencv-python (PyPI): upgrade to 3.3.1.11 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2017-12864 attacked?
It is attacked over the network.
Am I affected by CVE-2017-12864?
Check whether you run OpenCV, opencv-contrib-python (PyPI) or opencv-python (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • opencv-contrib-python (PyPI): upgrade to 3.3.1.11 or later
    pip install "opencv-contrib-python>=3.3.1.11"
  • opencv-python (PyPI): upgrade to 3.3.1.11 or later
    pip install "opencv-python>=3.3.1.11"

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

Identifiers

  • CVE-2017-12864
  • GHSA-267x-w5hx-8hjr
  • PYSEC-2026-2804
  • PYSEC-2026-697

Timeline

  • 2017-08-15: disclosed
  • 2017: patched: Fixed in OpenCV 3.3.1.11
  • 2021-10-12: advisory

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.