Bug 1492121 (CVE-2017-14348) - CVE-2017-14348 libraw: Heap-based 1 byte buffer over-write in processCanonCameraInfo function in internal/dcraw_common.cpp
Summary: CVE-2017-14348 libraw: Heap-based 1 byte buffer over-write in processCanonCam...
Keywords:
Status: CLOSED WONTFIX
Alias: CVE-2017-14348
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1492122 1492124 1492125 1492126 1492127 1494406
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-15 14:05 UTC by Pedro Sampaio
Modified: 2019-09-29 14:22 UTC (History)
17 users (show)

Fixed In Version: libraw 0.18.4
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-08 03:25:32 UTC
Embargoed:


Attachments (Terms of Use)

Description Pedro Sampaio 2017-09-15 14:05:39 UTC
LibRaw before 0.18.4 has a heap-based Buffer Overflow in the
processCanonCameraInfo function via a crafted file.

Upstream bug:

https://github.com/LibRaw/LibRaw/issues/100

Upstream patch:

https://github.com/LibRaw/LibRaw/commit/d13e8f6d1e987b7491182040a188c16a395f1d21

References:

https://bugzilla.novell.com/show_bug.cgi?id=1058467

Comment 1 Pedro Sampaio 2017-09-15 14:06:27 UTC
Created LibRaw tracking bugs for this issue:

Affects: epel-6 [bug 1492125]
Affects: fedora-all [bug 1492122]


Created dcraw tracking bugs for this issue:

Affects: fedora-all [bug 1492123]


Created libkdcraw tracking bugs for this issue:

Affects: fedora-all [bug 1492126]


Created mingw-LibRaw tracking bugs for this issue:

Affects: fedora-all [bug 1492127]


Created rawtherapee tracking bugs for this issue:

Affects: fedora-all [bug 1492124]

Comment 2 Salvatore Bonaccorso 2017-09-15 19:34:23 UTC
Hi

I think the upstream commit referenced is not the correct one. For CVE-2017-14348 it should be https://github.com/LibRaw/LibRaw/commit/8303e74b0567806dd5f16fc39aab70fe928de1a2

Regards,
Salvatore

Comment 3 Gwyn Ciesla 2017-09-20 16:58:58 UTC
The patch I have includes those changes, except for this, which doesn't apply.

--- dcraw/dcraw.c
+++ dcraw/dcraw.c
@@ -7071,6 +7071,7 @@ void CLASS setCanonBodyFeatures (unsigned id)
 void CLASS processCanonCameraInfo (unsigned id, uchar *CameraInfo, unsigned maxlen)
 {
   ushort iCanonLensID = 0, iCanonMaxFocal = 0, iCanonMinFocal = 0, iCanonLens = 0, iCanonCurFocal = 0, iCanonFocalType = 0;
+  if(maxlen<16) return; // too short, so broken
   CameraInfo[0] = 0;
   CameraInfo[1] = 0;
   switch (id) {
@@ -8631,7 +8632,7 @@ void CLASS parse_makernote_0xc634(int base, int uptag, unsigned dng_writer)
       {
         if (tag == 0x000d && len < 256000) // camera info
           {
-            CanonCameraInfo = (uchar*)malloc(len);
+            CanonCameraInfo = (uchar*)malloc(MAX(16,len));
             fread(CanonCameraInfo, len, 1, ifp);
             lenCanonCameraInfo = len;
           }
@@ -9496,7 +9497,7 @@ void CLASS parse_makernote (int base, int uptag)
       {
         if (tag == 0x000d && len < 256000)     // camera info
           {
-            CanonCameraInfo = (uchar*)malloc(len);
+            CanonCameraInfo = (uchar*)malloc(MAX(16,len));
             fread(CanonCameraInfo, len, 1, ifp);
             lenCanonCameraInfo = len;
           }

Comment 4 Andrej Nemec 2017-09-22 08:26:05 UTC
Created LibRaw tracking bugs for this issue:

Affects: epel-6 [bug 1494406]


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