Bug 841306 - libpcp additional decoder hardening
Summary: libpcp additional decoder hardening
Alias: None
Product: Fedora
Classification: Fedora
Component: pcp
Version: 16
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Nathan Scott
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 840765
TreeView+ depends on / blocked
Reported: 2012-07-18 16:05 UTC by Florian Weimer
Modified: 2012-10-25 22:20 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-09-17 00:36:24 UTC
Type: Bug

Attachments (Terms of Use)
Ensure ident is always initialized in text PDU decoder (503 bytes, patch)
2012-08-16 04:47 UTC, Nathan Scott
no flags Details | Diff

Description Florian Weimer 2012-07-18 16:05:01 UTC
The following appear to be minor issues, not leading to crashes or worse (at most information disclosure due to limited buffer over-reading).

__pmGetPDU should enforce minimum PDU lengths, based on a table of per-type minimum values.  This way, individual length checks won't have to be added to decoding functions for constant-size PDUs (such as __pmDecodeLogStatus, __pmDecodeTextReq, __pmDecodeError).

__pmDecodeTextReq should initialize *ident in all cases.

__pmEncodeResult seems to produce vlen fields for non-PM_VAL_INSITU values which are too large in some cases.  Truncating strings at the first NUL byte during decoding appears to hide this.  This is visible with proc.psinfo.cmd, for instance.

Comment 1 Nathan Scott 2012-08-16 04:26:05 UTC
Somehow, I only just came across this bugzilla entry today.

There are three issues here: for the first, we went the other way to Florian's table-based suggestion (i.e. checking sizes in individual handlers).  So that went out with 3.6.5, but spread across the many individual patches for each PDU type.

For the second issue, related to *ident not being initialized, that is fixed by the patch coming shortly.  Its minor though, can't see anything exposed there, will go into pcp-3.6.6.

I'll have to look a bit deeper into the result encoding issue and report back later.

Comment 2 Mark Goodwin 2012-08-16 04:31:56 UTC
assigned to nathan (this one fell thru the cracks), but all seem to agree the 
security implications are not severe.

Comment 3 Nathan Scott 2012-08-16 04:47:14 UTC
Created attachment 604783 [details]
Ensure ident is always initialized in text PDU decoder

Resolves the missing case where ident could be returned without initialisation, and with a return code indicating success in __pmDecodeText.

Comment 4 Nathan Scott 2012-08-16 05:49:14 UTC
OK, I understand the third case now.  The encode function is a bit misleading - it contains code that is marked #ifdef PCP_DEBUG, that initialises the parts of the buffer which I think Florian is calling out here.  It turns out that in all builds of PCP, this "debug" macro is always set.  So these parts of the passed out buffer are in fact initialised (with "~" character) after all, always.

I believe the patch I posted earlier is all we will need for this issue now, and I concur fully with Florian's assessment of these ones being minor issues that are not critical to push immediately.  The patch I posted earlier will go with the pcp-3.6.6 release, which will likely happen with the next two weeks.

Comment 5 Huzaifa S. Sidhpurwala 2012-08-16 06:08:49 UTC
Upstream commit (dev branch):


This patch will be a part of pcp-3.6.6

Comment 6 Fedora Update System 2012-08-28 23:47:19 UTC
pcp-3.6.6-1.fc16 has been submitted as an update for Fedora 16.

Comment 7 Fedora Update System 2012-08-28 23:47:32 UTC
pcp-3.6.6-1.fc17 has been submitted as an update for Fedora 17.

Comment 8 Fedora Update System 2012-08-28 23:47:43 UTC
pcp-3.6.6-1.el5 has been submitted as an update for Fedora EPEL 5.

Comment 9 Fedora Update System 2012-08-28 23:47:53 UTC
pcp-3.6.6-1.fc18 has been submitted as an update for Fedora 18.

Comment 10 Fedora Update System 2012-08-28 23:48:03 UTC
pcp-3.6.6-1.el6 has been submitted as an update for Fedora EPEL 6.

Comment 11 Fedora Update System 2012-08-29 18:45:00 UTC
Package pcp-3.6.6-1.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing pcp-3.6.6-1.fc18'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 12 Nathan Scott 2012-09-17 00:36:24 UTC
Bugzilla maint - this issue has been resolved in Fedora for awhile.

Comment 13 Fedora Update System 2012-09-17 23:04:51 UTC
pcp-3.6.6-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2012-09-18 19:59:35 UTC
pcp-3.6.8-1.fc16 has been submitted as an update for Fedora 16.

Comment 15 Fedora Update System 2012-09-18 20:00:58 UTC
pcp-3.6.8-1.fc17 has been submitted as an update for Fedora 17.

Comment 16 Fedora Update System 2012-10-25 22:18:16 UTC
pcp-3.6.9-1.el5 has been submitted as an update for Fedora EPEL 5.

Comment 17 Fedora Update System 2012-10-25 22:18:47 UTC
pcp-3.6.9-1.fc18 has been submitted as an update for Fedora 18.

Comment 18 Fedora Update System 2012-10-25 22:19:14 UTC
pcp-3.6.9-1.fc16 has been submitted as an update for Fedora 16.

Comment 19 Fedora Update System 2012-10-25 22:19:42 UTC
pcp-3.6.9-1.el6 has been submitted as an update for Fedora EPEL 6.

Comment 20 Fedora Update System 2012-10-25 22:20:16 UTC
pcp-3.6.9-1.fc17 has been submitted as an update for Fedora 17.

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