Bug 1299964 - (CVE-2016-2091) CVE-2016-2091 libdwarf: Out-of-bounds read in dwarf_frame2.c
CVE-2016-2091 libdwarf: Out-of-bounds read in dwarf_frame2.c
Status: CLOSED WONTFIX
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
impact=low,public=20160119,reported=2...
: Security
Depends On: 1299967 1299966
Blocks: 1299970
  Show dependency treegraph
 
Reported: 2016-01-19 10:58 EST by Adam Mariš
Modified: 2016-04-01 09:45 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-04-01 09:45:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch extracted from upstream commit 9565964f26 (1.08 KB, patch)
2016-04-01 08:33 EDT, Cedric Buissart
no flags Details | Diff

  None (edit)
Description Adam Mariš 2016-01-19 10:58:26 EST
An out-of-bounds vulnerability was found in dwarf_read_cie_fde_prefix function causing the aplication to crash.

CVE request (contains reproducer and crash report):

http://seclists.org/oss-sec/2016/q1/135
Comment 1 Adam Mariš 2016-01-19 10:58:53 EST
Created libdwarf tracking bugs for this issue:

Affects: fedora-all [bug 1299966]
Affects: epel-all [bug 1299967]
Comment 2 Andrej Nemec 2016-01-29 07:15:30 EST
CVE assignment: http://seclists.org/oss-sec/2016/q1/237
Comment 7 Cedric Buissart 2016-04-01 08:28:46 EDT
- The issue appears to be resolved upstream
- After bisecting, the patch seems to be included in the following 9565964f26 commit :
https://github.com/tomhughes/libdwarf/commit/9565964f26

In particular, the following pick appears to be sufficient :

----8<----
diff --git a/libdwarf/dwarf_frame2.c b/libdwarf/dwarf_frame2.c
index 472a174..e776020 100644
--- a/libdwarf/dwarf_frame2.c
+++ b/libdwarf/dwarf_frame2.c
@@ -964,7 +964,12 @@ dwarf_read_cie_fde_prefix(Dwarf_Debug dbg,
     Dwarf_Small *frame_ptr = frame_ptr_in;
     Dwarf_Small *cie_ptr_addr = 0;
     Dwarf_Unsigned cie_id = 0;
+    Dwarf_Small *section_end = section_ptr_in + section_length_in;
 
+    if(section_end < (frame_ptr +4)) {
+        _dwarf_error(dbg,error,DW_DLE_DEBUG_FRAME_LENGTH_BAD);
+        return DW_DLV_ERROR;
+    }
     /* READ_AREA_LENGTH updates frame_ptr for consumed bytes */
     READ_AREA_LENGTH(dbg, length, Dwarf_Unsigned,
         frame_ptr, local_length_size,
@@ -976,6 +981,10 @@ dwarf_read_cie_fde_prefix(Dwarf_Debug dbg,
             data. We should be very close to end of section. */
         return DW_DLV_NO_ENTRY;
     }
+    if((frame_ptr + local_length_size) >= section_end) {
+        _dwarf_error(dbg,error,DW_DLE_DEBUG_FRAME_LENGTH_BAD);
+        return DW_DLV_ERROR;
+    }
 
     cie_ptr_addr = frame_ptr;
     READ_UNALIGNED(dbg, cie_id, Dwarf_Unsigned,
--->8---
Comment 8 Cedric Buissart 2016-04-01 08:33 EDT
Created attachment 1142549 [details]
Patch extracted from upstream commit 9565964f26
Comment 10 Cedric Buissart 2016-04-01 09:31:27 EDT
Statement:

Red Hat Product Security has rated this issue as having Low security impact. This issue is not currently planned to be addressed in future updates. 
For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.

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