Bug 834338 - SECURITY: kgrantpty: unnecessary setuid root binary
Summary: SECURITY: kgrantpty: unnecessary setuid root binary
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: kdelibs3
Version: 23
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-21 15:15 UTC by H. Peter Anvin
Modified: 2016-06-27 15:04 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-27 15:04:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description H. Peter Anvin 2012-06-21 15:15:29 UTC
Description of problem:
kdelibs3 includes the setuid root program kgrantpty.

I have audited the content of the binary, as well as the code in kdelibs3, and have come to the following conclusion:

The setuid program DOES ABSOLUTELY NOTHING on a Linux platform with devpts; it is in fact never called.  It is invoked via the private method KPty::chownpty() only from KPty::open() or KPty::close(), and in both cases the code to call chownpty() is explicitly bypassed when Unix98 ptys are in use.

Therefore, this binary serves no purpose, and in the interest of reducing the system attack vector, should be dropped.

Comment 1 H. Peter Anvin 2012-06-21 15:15:45 UTC
s/attack vector/attack surface/

Comment 2 Than Ngo 2012-06-21 16:08:06 UTC
as i remember correctly kgrantpty is intended to be used internally by konsole to open a slave pty securely, it performs a setuid chmod and chown on the slave pty device.

Comment 3 Kevin Kofler 2012-06-21 23:28:57 UTC
Hmmm, kdelibs3 is a compatibility library, making unnecessary changes in it might break things. Are we sure really nothing expects kgrantpty to be there? Have you tried deleting it and then trying legacy kdelibs3 programs to check that they still work? (In particular, if you find anything using the old KonsolePart from kdebase3, that'd be worth testing.) If it's really unnecessary, we can delete it, but I'd like to be reasonably sure that there aren't any legacy programs which expect it to be there.

Comment 4 H. Peter Anvin 2012-06-22 00:22:27 UTC
Look at the source code!  kgrantpty is only invoked in a single place, in KPty::chownpty(), which is a private method (not exported from the library); it in turn is only called in two places, both of which have explicit tests for Unix98 PTYs which bypass the call to chownpty().

If something outside kdelibs3 needs kgrantpty then it is a legacy application in its own right and should be packaged into a separate package.

Comment 5 Fedora End Of Life 2013-07-04 03:46:41 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Jan Kurik 2015-07-15 15:07:20 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 7 Than Ngo 2016-06-27 15:04:36 UTC
it's fixed in kdelibs3-3.5.10-75.fc25


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