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   
Fixed In Version: pcp-3.6.5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-20 04:00:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 840765, 841698    
Description Flags
Resolve issues in decoding PCP instance PDUs
Updated patch to address PCP instance PDU decoding issues none

Description Florian Weimer 2012-07-18 14:57:06 UTC
__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 06:30:53 UTC
Created attachment 600701 [details]
Resolve issues in decoding PCP instance PDUs

Comment 3 Florian Weimer 2012-07-27 14:34:48 UTC
(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-29 01:14:45 UTC
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 12:16:47 UTC
I think this is okay, thanks.

Comment 6 Huzaifa S. Sidhpurwala 2012-08-16 04:07:13 UTC
Upstream patch:


This issue has been addressed in pcp-3.6.5