Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 59632 - vmware won't start because of sfperms
Summary: vmware won't start because of sfperms
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo VMWare Bug Squashers [disabled]
URL:
Whiteboard:
Keywords:
: 70269 73982 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-06 13:30 UTC by Thorsten Kampe
Modified: 2005-04-08 11:57 UTC (History)
8 users (show)

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 Thorsten Kampe 2004-08-06 13:30:25 UTC
I emerged vmware today and noticed that I couldn't start vmware anymore. The vmware and vmware-ping file (both setuid) are lacking go+r. The logfile shows the culprit: sfperms. It seems that this is called by default since a few days (03.08.?).

 sfperms
  * >>> SetUID: [chmod go-r] /var/tmp/portage/vmware-workstation-4.5.2.8848-r1/  [ ok ]
  * >>> SetUID: [chmod go-r] /var/tmp/portage/vmware-workstation-4.5.2.8848-r1/  [ ok ]
  * >>> SetUID: [chmod go-r] /var/tmp/portage/vmware-workstation-4.5.2.8848-r1/  [ ok
Comment 1 SpanKY gentoo-dev 2004-08-07 22:16:11 UTC
the vmware and vmware-ping files have a+x though and u+r right ?
Comment 2 Thorsten Kampe 2004-08-08 10:05:34 UTC
Exactly. The owner is root:root, so "o" needs the read right on this file to execute it (setuid or not).
Comment 3 Thorsten Kampe 2004-08-08 10:08:59 UTC
The vmware start script ("/opt/bin/vmware") is a shell script and the executor needs read right
Comment 4 SpanKY gentoo-dev 2004-08-08 13:59:42 UTC
no, the only time the executor needs the read bit is when the file is a shell script

if it is a normal binary, the perms can be o+rx, go-rw+x, and +s, and everything will work fine
Comment 5 Thorsten Kampe 2004-08-08 14:04:09 UTC
"/opt/vmware/bin/vmware/" *is* a normal shell script and because of the missing read right it's not possible to start vmware. (vmware-ping might be okay because it's a binary).
Comment 6 SpanKY gentoo-dev 2004-08-08 14:23:57 UTC
i know it's a script, i was correcting your logic that 'executers need read rights'

in this case, executers do need the read rights because it's a script
Comment 7 Chris Gianelloni (RETIRED) gentoo-dev 2004-08-18 12:50:44 UTC
I'm sorry... what's sfperms?
Comment 8 Chris Gianelloni (RETIRED) gentoo-dev 2004-08-18 12:56:24 UTC
Ah... I found it.

Adding solar to CC, then.  Hopefully he will have an answer for you, though on my system, neither /opt/vmware/bin/vmware nor /opt/vmware/bin/vmware-ping are setuid/setgid on any of my systems, so I am not sure why this is affecting you.
Comment 9 solar (RETIRED) gentoo-dev 2004-08-18 13:56:53 UTC
Well thanks for adding me to the CC..

#  'sfperms'     feature for security minded people that causes portage to 
#                remove group+other readable bits on setuid files and
#                remove the other readable bits on setgid files.
#


I can't really say I like the idea of a suid shell scripts as they can lead to a 
total compromise of a system. They should never be used.

All of spankys comments are perfectly correct.

If you want to make the ebuild aware your going to have to save permissions and restore them at postinst. Or restrict the feature.

Note: 
This is the first pkg in gentoo's history that I'm aware of where sfperms has caused a conflict.
Also I've asked a few hardened users and nobody else seems to have this problem.
I'll merged this pkg and see if I can reproduce it. 
Comment 10 Chris Gianelloni (RETIRED) gentoo-dev 2004-08-18 14:13:20 UTC
This is really strange.  I have 2 machines right next to each other, both with vmware-workstation installed.  On one machine, vmware and vmware-ping are suid root, and on the other, neither are suid root.  I have vmware running on both machines, and I have yet to find anything that is not working.  I am sure there must be something obscure that I am missing, but it appears to run fine.  The actual binary is under /opt/vmware/lib/bin and it is not suid root.
Comment 11 solar (RETIRED) gentoo-dev 2004-08-18 15:37:37 UTC
/usr/bin/vmware: /usr/bin/vmware: Permission denied
Runs fine as long as I'm root.

The way the feature was written it never took into account the need to 
RESTRICT= so that probably wont be so easy to work around.

My honest opinion is it would be better to just remove the suid bits all 
together and to 'einfo' in the pkg_postinst() that suggests vmware when
used by normal users should be run via sudo. That would atleast reduce
the chances of any possible security bugs showing up and biting us in
the arse one day.
Comment 12 Chris Gianelloni (RETIRED) gentoo-dev 2004-11-09 16:39:48 UTC
*** Bug 70269 has been marked as a duplicate of this bug. ***
Comment 13 Romang 2004-11-30 00:56:47 UTC
Hello,

I have install sudo to run wmware as solar say's
but there is a new problem :

bash-2.05b$ sudo vmware

Gtk-WARNING **: cannot open display:

Why nobody care about this bug ???
Since two weeks no more vmware on my desktop ;)

Regards
Comment 14 solar (RETIRED) gentoo-dev 2004-11-30 01:34:41 UTC
A recent secure update to sudo made it do an env_reset. You might want to check if this is the case for you. If so you may need to allow your user/group to not env_reset
Comment 15 Chris Gianelloni (RETIRED) gentoo-dev 2004-11-30 06:19:14 UTC
You just have to love when an update breaks funtionality... heh... vmware is a prime example of this happening.

Anyway, there are several simple solutions:

1. FEATURES="-sfperms" emerge vmware-workstation
-or-
2. chmod a+r /opt/vmware/bin/vmware
-or-
3. "fix" sudo as solar suggested

solar: is there any chance we could have sfperms *not* strip the r bit from suid shell scripts?  You mentioned restricting the FEATURE.  What is the proper RESTRICT for sfperms?
Comment 16 solar (RETIRED) gentoo-dev 2004-11-30 06:44:06 UTC
scripts should still never be suid.
sudo is not the best work around.
I'm not sure what to say here. Maybe try FEATURES=-sfperms or RESTRICT=

Can't somebody rewrite this shell script in c? The bash interpeter is just so darn prone to exploition with +s bits on scripts.
Comment 17 Chris Gianelloni (RETIRED) gentoo-dev 2004-12-10 05:29:55 UTC
*** Bug 73982 has been marked as a duplicate of this bug. ***
Comment 18 Urs Joss 2004-12-10 05:42:55 UTC
How about:
chown root:vmware /opt/vmware/bin/vmware
chmod 450 /opt/vmware/bin/vmware

Is that a security risk?
Comment 19 ta2002 2004-12-27 01:38:07 UTC
This has just nabbed me. What seems like
the safest option as far as running vmware
as a regular user?

$ which vmware
/usr/bin/vmware

$ ls -al /usr/bin/vmware
lrwxrwxrwx  1 root root 22 2004-12-25 00:12:26 /usr/bin/vmware -> /opt/vmware/bin/vmware*

$ ls -al /opt/vmware/bin/vmware
-r-s--x--x  1 root root 4547 2004-12-25 00:12:23 /opt/vmware/bin/vmware*

$ vmware
/usr/bin/vmware: /usr/bin/vmware: Permission denied
Comment 20 Urs Joss 2004-12-28 10:18:00 UTC
I created a group 'vmware' and assigned my users (in my case just me ;-) to that group. I changed the group of all files in /opt/vmware/bin/ to vmware. 

$ ls -al /opt/vmware/bin/
insgesamt 4512
drwxr-xr-x  2 root root       616 16. Dez 08:53 .
drwxr-xr-x  6 root root       144 10. Dez 08:49 ..
-r-xr-xr-x  1 root vmware    6404 16. Dez 08:53 vmnet-bridge
-r-xr-xr-x  1 root vmware  110908 16. Dez 08:53 vmnet-dhcpd
-r-xr-xr-x  1 root vmware  121676 16. Dez 08:53 vmnet-natd
-r-xr-xr-x  1 root vmware    5436 16. Dez 08:53 vmnet-netifup
-r-xr-xr-x  1 root vmware    8384 16. Dez 08:53 vmnet-sniffer
-r-xr-xr-x  1 root vmware    4223 16. Dez 08:53 vmrun
-r-xr-xr-x  1 root vmware   11014 16. Dez 08:53 vm-support
-r--r-x---  1 root vmware    4715 16. Dez 08:53 vmware
-r-xr-x---  1 root vmware  215257 10. Dez 08:49 vmware-config-console.pl
-r-xr-xr-x  1 root vmware  236114 16. Dez 08:53 vmware-config.pl
-r-xr-x---  1 root vmware 2421972 10. Dez 08:49 vmware-console
-r-xr-xr-x  1 root vmware  540720 16. Dez 08:53 vmware-loop
-r-xr-xr-x  1 root vmware   25488 16. Dez 08:53 vmware-mount.pl
-r--r-x---  1 root vmware   10172 16. Dez 08:53 vmware-ping
-r-xr-x---  1 root vmware   84345 10. Dez 08:49 vmware-uninstall-console.pl
-r-xr-xr-x  1 root vmware   87637 16. Dez 08:53 vmware-uninstall.pl
-r-xr-xr-x  1 root vmware  677544 16. Dez 08:53 vmware-vdiskmanager

It works with me, I don't know enough about the associated risks, though.
Comment 21 solar (RETIRED) gentoo-dev 2005-01-05 22:32:28 UTC
Good read on setuid shell scripts.
http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html
Comment 22 Giuseppe Lettieri 2005-01-06 08:19:28 UTC
what's the poin in having setuid scripts anyway? Linux ignores them:

# echo "#!/bin/cat /etc/shadow" > foo
# chmod +x,u+s foo
...
$ ./foo
bin/cat: /etc/shadow: Permission denied
#!/bin/cat /etc/shadow
Comment 23 Stephen Bennett (RETIRED) gentoo-dev 2005-01-08 07:57:20 UTC
For what it's worth, VMware seems to work perfectly for me without the setuid bit on /opt/vmware/bin/vmware or vmware-ping. It's needed on vmware-vmx, but that isn't a problem since it's an ELF executable.
Comment 24 Chris Gianelloni (RETIRED) gentoo-dev 2005-01-09 07:15:11 UTC
Yeah, I had noticed that in my playing, too.  I was still a bit concerned about the vmware-ping, though, as I really do not know why it was suid in the first place.  There could be some broken functionality that we're both just missing.

Anyway, I'm looking at this and another fix or two for the near future, I've just been busy working on release stuff for the moment.
Comment 25 Chris Gianelloni (RETIRED) gentoo-dev 2005-01-11 08:36:48 UTC
I've removed the suid bits from everything except vmware-vmx and it appears to work.  I also had rizzo test it and he got the same results.

I've added a newer vmware-workstation ebuild to portage but haven't bumped the revision.  However, it is being marked stable, so it should catch most people.
Comment 26 Donnie Berkholz (RETIRED) gentoo-dev 2005-02-26 20:02:21 UTC
I just upgraded to 5.0_rc2 and the shell script was still suid. As before, removing the suid bit fixes things.

Apparently the 5.x stuff never got the fix.
Comment 27 Chris Gianelloni (RETIRED) gentoo-dev 2005-04-08 11:57:56 UTC
Bad Donnie reopening bugs for a package.masked package! ;]

Anyway, this is fixed in the VMware 5 final ebuild.