Bug 1299964 (CVE-2016-2091) - CVE-2016-2091 libdwarf: Out-of-bounds read in dwarf_frame2.c
Summary: CVE-2016-2091 libdwarf: Out-of-bounds read in dwarf_frame2.c
Keywords:
Status: CLOSED WONTFIX
Alias: CVE-2016-2091
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: 1299966 1299967
Blocks: 1299970
TreeView+ depends on / blocked
 
Reported: 2016-01-19 15:58 UTC by Adam Mariš
Modified: 2021-02-17 04:29 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-04-01 13:45:00 UTC
Embargoed:


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

Description Adam Mariš 2016-01-19 15:58:26 UTC
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 15:58:53 UTC
Created libdwarf tracking bugs for this issue:

Affects: fedora-all [bug 1299966]
Affects: epel-all [bug 1299967]

Comment 2 Andrej Nemec 2016-01-29 12:15:30 UTC
CVE assignment: http://seclists.org/oss-sec/2016/q1/237

Comment 7 Cedric Buissart 2016-04-01 12:28:46 UTC
- 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 12:33:38 UTC
Created attachment 1142549 [details]
Patch extracted from upstream commit 9565964f26

Comment 10 Cedric Buissart 2016-04-01 13:31:27 UTC
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.