Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 20823 - Creation of files with group 'root' because gpg is installed setgid(0)
Summary: Creation of files with group 'root' because gpg is installed setgid(0)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High major
Assignee: Gentoo Security
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-11 20:28 UTC by Pierre-Yves Strub
Modified: 2003-07-19 05:30 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Yves Strub 2003-05-11 20:28:51 UTC
Gpg is installed with setuid(root) et setgid(root). setuid(0) is necessary for 
locking pages in memory to avoid swapping but there is no reason for 
setgid(0). 
 
As a consequence, Gpg creates file with group 'root'. 
 
The installation script should strip the setgid bit...
Comment 1 Tavis Ormandy (RETIRED) gentoo-dev 2003-06-19 02:35:40 UTC
Yikes. You can write to any file with write access for group root like this:

$ ls -l /tmp/target-file
-rw-rw-r--    1 root     root            0 2003-06-19 10:19 target-file
$ echo owned > temp
$ gpg --symmetric temp 
$ gpg --output target-file --decrypt temp.gpg 
gpg: CAST5 encrypted data
File `target-file' exists. Overwrite (y/N)? y
gpg: WARNING: message was not integrity protected
$ ls -l target-file
-rw-rw-r--    1 root     root            6 2003-06-19 10:21 target-file
$ cat target-file 
owned

There are lots of group root writable files on a gentoo system, glsa?
Comment 2 Tavis Ormandy (RETIRED) gentoo-dev 2003-07-18 02:00:21 UTC
Well, i think this needs some attention, even if nobody else does.

Heres a link to consider.

http://www.mandrakesecure.net/en/advisories/2001/MDKSA-2001-053-1.php3?dis=8.1

"The /usr/bin/gpg executable was installed setuid root and setgid root. While being setuid root offers locking pages in physical memory to avoid writing sensitive material to swap and is of benefit, being setgid root provides no benefits and allows users to write to files that have group root access. This update strips the setgid bit from /usr/bin/gpg."

Even if for some reason im not aware of this isnt considered a problem, conservative use of sgid/suid is always a good thing, is it really nescessary in this case?
Comment 3 Tavis Ormandy (RETIRED) gentoo-dev 2003-07-18 15:24:43 UTC
Fixed in cvs, Thank you reporter.
Comment 4 Thomas R. (TRauMa) 2003-07-19 05:30:56 UTC
Thanks Tavis for caring. This was known a whole month?