Bug 1797450 (CVE-2019-14493) - CVE-2019-14493 opencv: NULL pointer dereference in function cv::XMLParser::parse() in persistence_xml.cpp leading to DoS
Summary: CVE-2019-14493 opencv: NULL pointer dereference in function cv::XMLParser::pa...
Alias: CVE-2019-14493
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
Depends On: 1797451
Blocks: 1797452
TreeView+ depends on / blocked
Reported: 2020-02-03 08:12 UTC by Dhananjay Arunesh
Modified: 2021-02-16 20:40 UTC (History)
12 users (show)

Fixed In Version: opencv 4.1.1
Doc Type: If docs needed, set a value
Doc Text:
A NULL pointer dereference flaw was found in OpenCV in the way the Cascade Classifier algorithm loaded and processed certain classifiers. A remote attacker could exploit this flaw by providing a specially crafted XML file that, when loaded by an application linked to OpenCV, would crash the application causing a denial of service.
Clone Of:
Last Closed: 2020-02-13 20:09:44 UTC

Attachments (Terms of Use)

Description Dhananjay Arunesh 2020-02-03 08:12:01 UTC
An issue was discovered in OpenCV before 4.1.1. There is a NULL pointer dereference in the function cv::XMLParser::parse at modules/core/src/persistence.cpp.


Comment 1 Dhananjay Arunesh 2020-02-03 08:12:55 UTC
Created opencv tracking bugs for this issue:

Affects: fedora-all [bug 1797451]

Comment 2 Mauro Matteo Cascella 2020-02-12 14:03:18 UTC
Upstream fix:

Comment 3 Mauro Matteo Cascella 2020-02-12 17:00:52 UTC
The flaw lies in the implementation of Cascade Classifier, an algorithm used internally by OpenCV to detect objects in digital images. It is a machine learning based algorithm where a classifier is trained from a lot of "positive" and "negative" images, and then used to detect objects in other images. 

Specifically, the NULL pointer dereference can be triggered when the classifier (in the form of a XML file) is loaded and parsed by the cv::CascadeClassifier::load() function.

Comment 4 Mauro Matteo Cascella 2020-02-13 15:33:31 UTC
This flaw was apparently introduced in OpenCV upstream version 4.0.0 with commit https://github.com/opencv/opencv/commit/0f622206e48f6050536f00d47abf47c4a2d1824a.

This commit replaced function icvXMLSkipSpaces() with skipSpaces() in persistence_xml.cpp; the new implementation made it possible for skipSpaces() to return a NULL pointer: https://github.com/opencv/opencv/commit/0f622206e48f6050536f00d47abf47c4a2d1824a#diff-c9729b5bab1646d0cf30a15a7de41fd5R416.
Conversely, the older implementation took care of re-initializing the NULL pointer before returning it: https://github.com/opencv/opencv/commit/0f622206e48f6050536f00d47abf47c4a2d1824a#diff-c9729b5bab1646d0cf30a15a7de41fd5L81.

Comment 6 Mauro Matteo Cascella 2020-02-13 15:42:11 UTC

This flaw did not affect the versions of OpenCV as shipped with Red Hat Enterprise Linux 6, 7, and 8 as they did not include the vulnerable code, which was introduced in a newer version of the library.

Comment 7 Product Security DevOps Team 2020-02-13 20:09:44 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):


Comment 8 Mauro Matteo Cascella 2020-04-15 15:09:18 UTC

Avoid loading cascade classifiers from external untrusted sources.

Note You need to log in before you can comment on or make changes to this bug.