Bug 841284 - __pmDecodeInstance vulnerabilities
Summary: __pmDecodeInstance vulnerabilities
Alias: None
Product: Fedora
Classification: Fedora
Component: pcp
Version: 16
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Mark Goodwin
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 840765 CVE-2012-3418
TreeView+ depends on / blocked
Reported: 2012-07-18 14:57 UTC by Florian Weimer
Modified: 2012-08-20 04:00 UTC (History)
4 users (show)

Fixed In Version: pcp-3.6.5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-08-20 04:00:35 UTC
Type: Bug

Attachments (Terms of Use)
Resolve issues in decoding PCP instance PDUs (2.22 KB, patch)
2012-07-27 06:30 UTC, Nathan Scott
no flags Details | Diff
Updated patch to address PCP instance PDU decoding issues (2.03 KB, patch)
2012-07-29 01:14 UTC, Nathan Scott
no flags Details | Diff

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

Note You need to log in before you can comment on or make changes to this bug.