CVE-2019-5064: Opencv python Out-of-bounds Write Vulnerability
HIGHCVE-2019-5064 is a HIGH (CVSS 8.8) out-of-bounds write vulnerability (CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')) affecting Opencv python libraries in the PyPI ecosystem. The issue involves out-of-bounds write in opencv. Remediation is available by upgrading affected packages to version 4.2.0.32.
CVE-2019-5064 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2019-5064
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.
pip install opencv-python>=4.2.0.32
pip install opencv-python-headless>=4.2.0.32
pip install opencv-contrib-python>=4.2.0.32
pip install opencv-contrib-python-headless>=4.2.0.32
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-2019-5064, 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 4.2.0.32), 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-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow'), where the product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer. 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
CVE-2019-5064 Affected Opencv python Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
opencv-python
|
PyPI |
< 4.2.0.32
|
4.2.0.32
|
|
opencv-python-headless
|
PyPI |
< 4.2.0.32
|
4.2.0.32
|
|
opencv-contrib-python
|
PyPI |
< 4.2.0.32
|
4.2.0.32
|
|
opencv-contrib-python-headless
|
PyPI |
< 4.2.0.32
|
4.2.0.32
|
References
Frequently Asked Questions
What is CVE-2019-5064?
Which Opencv python versions are affected?
What version fixes CVE-2019-5064?
Is opencv-python affected?
Is opencv-python-headless affected?
What is the CVSS score of CVE-2019-5064?
What CWE is associated with CVE-2019-5064?
How can I check PyPI dependencies for CVE-2019-5064?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q799-q27x-vp7w",
"modified" : "2021-10-06T17:39:57Z",
"published" : "2021-10-12T22:23:21Z",
"aliases" : [ "CVE-2019-5064" ],
"summary" : "Out-of-bounds Write in OpenCV",
"details" : "An exploitable heap buffer overflow vulnerability exists in the data structure persistence functionality of OpenCV, version 4.1.0 (corresponds with OpenCV-Python version 4.1.2.30). A specially crafted JSON file can cause a buffer overflow, resulting in multiple heap corruptions and potentially code execution. An attacker can provide a specially crafted file to trigger this vulnerability.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "opencv-python"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.2.0.32"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.1.2.30"
}
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "opencv-python-headless"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.2.0.32"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.1.2.30"
}
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "opencv-contrib-python"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.2.0.32"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.1.2.30"
}
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "opencv-contrib-python-headless"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.2.0.32"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.1.2.30"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-5064"
}, {
"type" : "WEB",
"url" : "https://github.com/opencv/opencv/issues/15857"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/opencv/opencv-python"
}, {
"type" : "WEB",
"url" : "https://github.com/opencv/opencv-python/releases/tag/32"
}, {
"type" : "WEB",
"url" : "https://github.com/opencv/opencv/releases/tag/4.2.0"
}, {
"type" : "WEB",
"url" : "https://talosintelligence.com/vulnerability_reports/TALOS-2019-0853"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com//security-alerts/cpujul2021.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpuApr2021.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-120", "CWE-787" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-10-06T17:39:57Z",
"nvd_published_at" : "2020-01-03T17:15:00Z"
}
}