Bug 1435182 (CVE-2016-10255)

Summary: CVE-2016-10255 elfutils: Memory allocation failure in __libelf_set_rawdata_wrlock (elf_getdata.c)
Product: [Other] Security Response Reporter: Andrej Nemec <anemec>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: anemec, aoliva, drepper, fche, jakub, kanderso, mcermak, me, mjw, mjw, mnewsome, ohudlick, roland
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: elfutils 0.168 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-23 10:50:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrej Nemec 2017-03-23 10:47:44 UTC
A vulnerability was found in elfutils. A maliciously crafted ELF file could cause a very large allocation failure.

References:

https://blogs.gentoo.org/ago/2016/11/04/elfutils-memory-allocation-failure-in-__libelf_set_rawdata_wrlock-elf_getdata-c/
http://seclists.org/oss-sec/2016/q4/367

Comment 1 Mark Wielaard 2017-03-23 11:04:35 UTC
(In reply to Andrej Nemec from comment #0)
> A vulnerability was found in elfutils. A maliciously crafted ELF file could
> cause the application to crash.

Note that it real bug wasn't a crash but a possibly very large allocation failure. Normally the application would get E_ELF_NOMEM as error value (except when malloc was overridden as in the fuzzing example). The fix was to make the code first check whether the allocation size made sense and if not return ELF_E_INVALID_SECTION_HEADER early instead of trying to allocate the memory.