mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Zimmerman <mdz@debian.org>
To: Aaron Lehmann <aaronl@vitelus.com>
Cc: team@security.debian.org, nethack@packages.debian.org,
	Alexander Viro <viro@math.psu.edu>,
	linux-kernel@vger.kernel.org
Subject: Re: Nethack setgid screwup
Date: Sun, 3 Nov 2002 14:38:22 -0500	[thread overview]
Message-ID: <20021103193822.GT31490@mizar.alcor.net> (raw)
In-Reply-To: <20021103050042.GA25215@vitelus.com>

On Sat, Nov 02, 2002 at 09:00:42PM -0800, Aaron Lehmann wrote:

> ----- Forwarded message from Alexander Viro <viro@math.psu.edu> -----
> On Sat, 2 Nov 2002, Linus Torvalds wrote:
> 
> > But I like Al's idea of mount binds even more, although it requires maybe
> > a bit more administration.
> 
> OK, will do - will be fun to take a break from drivers/* and devfs excrements
> I'm digging in...
> 
> BTW, here's a fresh demonstration (found half an hour ago) that capabilities
> do *not* permit more lax attitude when writing stuff with elevated priveleges:
> 	* /usr/lib/games/nethack/recover is run at the boot time (as root)
> to recover crashed games.
> 	* Debian nethack 3.4.0-3.1 has it installed root.games and it
> is group-writable - cretinism in debian/rules, upstream is not guilty
> in that (BTW, so is /usr/lib/games/nethack/recover-helper).
> 	* ergo, any exploitable hole in sgid-games binary (rogue, for
> instance) is trivially elevated to root exploit.

mizar:[/tmp] dpkg -l nethack
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  nethack        3.4.0-3.1      Overhead dungeon-crawler game (dummy package
mizar:[/tmp] ls -l /usr/lib/games/nethack/recover*
-rwxrwsr-x    1 root     games        6088 2002-07-06 17:54 /usr/lib/games/nethack/recover
-rwxrwxr-x    1 root     root          283 2002-07-06 17:54 /usr/lib/games/nethack/recover-helper
mizar:[/tmp] grep recover /etc/init.d/nethack
# Nethack save-file recovery script for Debian
    test -x /usr/lib/games/nethack/recover-helper || exit 0
      # Refuse to recover root's nethack files.
        echo "Ignoring root's Nethack unrecovered save file."
        # script running as the user which recovers everything
        su "$owner" -c /usr/lib/games/nethack/recover-helper 

The script has worked this way since at least version 3.3.0-7, which is
found in Debian 2.2 (potato).  Is there some other situation you found where
recover would be run as root, other than when explicitly started by root?

This is still a serious bug, of course, and allows gid games to be exploited
to gain the privileges of a user with a recoverable saved game, but not root
(at least not trivially).

-- 
 - mdz

           reply	other threads:[~2002-11-03 19:31 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20021103050042.GA25215@vitelus.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021103193822.GT31490@mizar.alcor.net \
    --to=mdz@debian.org \
    --cc=aaronl@vitelus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nethack@packages.debian.org \
    --cc=team@security.debian.org \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®