CVE-2017-17760: Opencv python Improper Restriction Of Operations Within Vulnerability

MODERATE
Advisory Identifier: GHSA-jcxv-2j3h-mg59
CVSS 6.5
CWE-119
Published
Advisory Summary

CVE-2017-17760 is a MODERATE (CVSS 6.5) improper restriction of operations within vulnerability (CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer) affecting Opencv python libraries in the PyPI ecosystem. The issue involves improper restriction of operations within the bounds of a memory buffer in opencv. Remediation is available by upgrading affected packages to version 3.4.0.12.

CVE-2017-17760 at a Glance

CVE Identifier CVE-2017-17760
GHSA Identifier GHSA-jcxv-2j3h-mg59
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
Affected Product Opencv python
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2017-17760

To remediate this vulnerability, upgrade all affected Opencv python dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

opencv-python fixed: 3.4.0.12
pip install opencv-python>=3.4.0.12
opencv-contrib-python fixed: 3.4.0.12
pip install opencv-contrib-python>=3.4.0.12
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show opencv-python

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2017-17760, inspect your installed packages using pip:

pip show opencv-python

Analyze the terminal output to locate any version of Opencv python in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.4.0.12), your application is affected.

Note: The pip show opencv-python command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer, where the product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. this may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data. In Opencv python, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

OpenCV 3.3.1 (corresponding with opencv-python and opencv-contrib-python 3.3.1.11) has a Buffer Overflow in the cv::PxMDecoder::readData function in grfmt_pxm.cpp, because an incorrect size value is used.

CVE-2017-17760 Affected Opencv python Versions

2 component(s)
Fixed Versions:
3.4.0.12
Product / Package Ecosystem Affected Versions Fixed Version
opencv-python
PyPI
< 3.4.0.12
3.4.0.12
opencv-contrib-python
PyPI
< 3.4.0.12
3.4.0.12

References

Frequently Asked Questions

What is CVE-2017-17760?
CVE-2017-17760 is a security vulnerability in Opencv python involving Improper Restriction of Operations within the Bounds of a Memory Buffer in OpenCV under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
Which Opencv python versions are affected?
Affected versions include releases prior to 3.4.0.12 across affected packages: opencv-python, opencv-contrib-python.
What version fixes CVE-2017-17760?
Upgrading to 3.4.0.12 (or the latest patched release for your respective branch) resolves the vulnerability.
Is opencv-python affected?
Yes, opencv-python is affected in releases prior to 3.4.0.12. Upgrade your dependency to 3.4.0.12 or later.
Is opencv-contrib-python affected?
Yes, opencv-contrib-python is affected in releases prior to 3.4.0.12. Upgrade your dependency to 3.4.0.12 or later.
What is the CVSS score of CVE-2017-17760?
CVE-2017-17760 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2017-17760?
CVE-2017-17760 is classified under CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer (The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.).
How can I check PyPI dependencies for CVE-2017-17760?
Run the dependency tree command: 'pip show opencv-python'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jcxv-2j3h-mg59",
  "modified" : "2021-11-18T15:31:01Z",
  "published" : "2021-10-12T22:03:09Z",
  "aliases" : [ "CVE-2017-17760" ],
  "summary" : "Improper Restriction of Operations within the Bounds of a Memory Buffer in OpenCV",
  "details" : "OpenCV 3.3.1 (corresponding with opencv-python and opencv-contrib-python 3.3.1.11) has a Buffer Overflow in the cv::PxMDecoder::readData function in grfmt_pxm.cpp, because an incorrect size value is used.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "opencv-python"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.4.0.12"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.3.1.11"
    }
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "opencv-contrib-python"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.4.0.12"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.3.1.11"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-17760"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/opencv/opencv/issues/10351"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/opencv/opencv/pull/10369/commits/7bbe1a53cfc097b82b1589f7915a2120de39274c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/opencv/opencv-python"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2018/01/msg00008.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2018/07/msg00030.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2021/10/msg00028.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.securityfocus.com/bid/102974"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-07T20:20:01Z",
    "nvd_published_at" : "2017-12-29T18:29:00Z"
  }
}