Bug 841284

Summary: __pmDecodeInstance vulnerabilities
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: pcpAssignee: Mark Goodwin <mgoodwin>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: kenj, mgoodwin, nathans, security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcp-3.6.5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-20 00:00:35 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 840765, 841698    
Attachments:
Description Flags
Resolve issues in decoding PCP instance PDUs
none
Updated patch to address PCP instance PDU decoding issues none

Description Florian Weimer 2012-07-18 10:57:06 EDT
__pmDecodeInstance does not check the numinst and namelen values against the length of the PDU.  As a result, an application which decodes crafted PDU_INSTANCE packets can crash.  namelen values of 0xFFFFFFFF result in the allocation of a heap object which is too small, but this is probably not exploitable for code execution (this assessment is subject to the usual caveats)
Comment 2 Nathan Scott 2012-07-27 02:30:53 EDT
Created attachment 600701 [details]
Resolve issues in decoding PCP instance PDUs
Comment 3 Florian Weimer 2012-07-27 10:34:48 EDT
(In reply to comment #2)
> Created attachment 600701 [details]

	if (sizeof(instlist_t) - sizeof(sizeof(ip->name)) > (size_t)(pdu_end - (char *)ip)) {

There's a duplicated sizeof.

	if (ip->namelen < 0 || ip->namelen >= rp->hdr.len || ip->namelen + 1 >= INT_MAX) {

ip->namelen + 1 >= INT_MAX is always false.   If you move the next check before the malloc, you only need the ip->namelen < 0 part.  The ip->namelen >= rp->hdr.len check is implicit in the check against the remaining PDU length.
Comment 4 Nathan Scott 2012-07-28 21:14:45 EDT
Created attachment 600962 [details]
Updated patch to address PCP instance PDU decoding issues

Incorporate Florian's review comments.
Thanks Florian!
Comment 5 Florian Weimer 2012-07-30 08:16:47 EDT
I think this is okay, thanks.
Comment 6 Huzaifa S. Sidhpurwala 2012-08-16 00:07:13 EDT
Upstream patch:

http://oss.sgi.com/cgi-bin/gitweb.cgi?p=pcp/pcp.git;a=commit;h=babd6c5c527f87ec838c13a1b4eba612af6ea27c

This issue has been addressed in pcp-3.6.5