Bug 1440788 (CVE-2017-0553)

Summary: CVE-2017-0553 libnl: Integer overflow in nlmsg_reserve()
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: dcbw, jiri, rkhan, slawomir, tgraf, thaller
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
An integer overflow leading to a heap-buffer overflow was found in the libnl library. An attacker could use this flaw to cause an application compiled with libnl to crash or possibly execute arbitrary code in the context of the user running such an application.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 03:10:05 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:
Bug Depends On: 1440789, 1442723    
Bug Blocks: 1415638, 1440792    

Description Adam Mariš 2017-04-10 13:21:27 UTC
An integer overflow vulnerability was found in nlmsg_reserve() triggered by crafted @len argument resulting into reserving too few bytes.

Upstream patch:

http://git.infradead.org/users/tgr/libnl.git/commit/3e18948f17148e6a3c4255bdeaaf01ef6081ceeb

Comment 1 Adam Mariš 2017-04-10 13:22:16 UTC
Created libnl3 tracking bugs for this issue:

Affects: fedora-all [bug 1440789]

Comment 2 Huzaifa S. Sidhpurwala 2017-04-17 09:20:13 UTC
Analysis:

The commit messages raises a very important point about libnl:

"In general, libnl functions are not robust against calling with
invalid arguments. Thus, never call libnl functions with invalid
arguments. In case of nlmsg_reserve() this means never provide
a @len argument that causes overflow."

The function nlmsg_reserve() is called with a very large value of len, later when the following code is run, it results in a integer overflow:

"tlen = pad ? ((len + (pad - 1)) & ~(pad - 1)) : len;"

This later causes too small a buffer to be allocated and buffer overflow when data is eventually copied into it.

The commit however assumes that arguement "pad" is untrued, in case it is not, this may causes additional issues.

Also other functions may need an audit, if libnl API functions are called with untrusted value and the assumption is that libnl will sanitize them. (Which does not currently happen).

Finally this may cause arbitrary code execution in the context of the user running the library.

Comment 4 errata-xmlrpc 2017-08-01 09:31:07 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2017:2299 https://access.redhat.com/errata/RHSA-2017:2299