Bug 834338 - SECURITY: kgrantpty: unnecessary setuid root binary
SECURITY: kgrantpty: unnecessary setuid root binary
Product: Fedora
Classification: Fedora
Component: kdelibs3 (Show other bugs)
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Ngo Than
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-06-21 11:15 EDT by H. Peter Anvin
Modified: 2016-06-27 11:04 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-06-27 11:04:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description H. Peter Anvin 2012-06-21 11:15:29 EDT
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 11:15:45 EDT
s/attack vector/attack surface/
Comment 2 Ngo Than 2012-06-21 12:08:06 EDT
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 19:28:57 EDT
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-21 20:22:27 EDT
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-03 23:46:41 EDT
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 11:07:20 EDT
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:
Comment 7 Ngo Than 2016-06-27 11:04:36 EDT
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.