linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: kernel-hardening@lists.openwall.com,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Christoph Lameter <cl@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>, Matt Mackall <mpm@selenic.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] proc: force dcache drop on unauthorized access
Date: Thu, 22 Sep 2011 21:57:54 +0400	[thread overview]
Message-ID: <20110922175754.GA6558@albatros> (raw)
In-Reply-To: <20110910164001.GA2342@albatros>

Hello Andrew,

On Sat, Sep 10, 2011 at 20:40 +0400, Vasiliy Kulikov wrote:
> The patch "proc: fix races against execve() of /proc/PID/fd**" is still
> a partial fix for a setxid problem.  link(2) is a yet another way to
> identify whether a specific fd is opened by a privileged process.  By
> calling link(2) against /proc/PID/fd/* an attacker may identify whether
> the fd number is valid for PID by analysing link(2) return code.
> 
> Both getattr() and link() can be used by the attacker iff the dentry is
> present in the dcache.  In this case ->lookup() is not called and the
> only way to check ptrace permissions is either operation handler or
> ->revalidate().  The easiest solution to prevent any unauthorized access
> to /proc/PID/fd*/ files is to force the dentry drop on each unauthorized
> access attempt.
> 
> If an attacker keeps opened fd of /proc/PID/fd/ and dcache contains
> a specific dentry for some /proc/PID/fd/XXX, any future attemp to use the
> dentry by the attacker would lead to the dentry drop as a result of a
> failed ptrace check in ->revalidate().  Then the attacker cannot spawn a
> dentry for the specific fd number because of ptrace check in ->lookup().
> 
> The dentry drop can be still observed by an attacker by analysing
> information from /proc/slabinfo, which is addressed in the successive
> patch.

After (almost) everybody agreed that closing slabinfo and similar is
a good thing, should I resend these 2 patches (/proc/PID/fd and
slabinfo) with sysfs addition or you'll take these patches and I'll send
sysfs patch after them?

Thanks,

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

      parent reply	other threads:[~2011-09-22 17:58 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-10 16:40 [RFC PATCH 1/2] proc: force dcache drop on unauthorized access Vasiliy Kulikov
2011-09-10 16:41 ` [RFC PATCH 2/2] mm: restrict access to /proc/slabinfo Vasiliy Kulikov
2011-09-12 15:06   ` Cyrill Gorcunov
2011-09-13  6:28     ` Vasiliy Kulikov
2011-09-14 13:16   ` Vasiliy Kulikov
2011-09-14 15:18     ` Dave Hansen
2011-09-14 15:42       ` [kernel-hardening] " Vasiliy Kulikov
2011-09-14 15:48         ` Vasiliy Kulikov
2011-09-14 18:24         ` Dave Hansen
2011-09-14 18:41   ` Dave Hansen
2011-09-14 19:14     ` Vasiliy Kulikov
2011-09-14 19:27   ` Kees Cook
2011-09-18 17:05     ` [kernel-hardening] " Vasiliy Kulikov
2011-09-19 13:42       ` Christoph Lameter
2011-09-19 14:30       ` Pekka Enberg
2011-09-19 14:46         ` Vasiliy Kulikov
2011-09-19 15:13           ` Pekka Enberg
2011-09-19 15:57             ` Vasiliy Kulikov
2011-09-19 16:11               ` Pekka Enberg
2011-09-19 16:18                 ` Vasiliy Kulikov
2011-09-19 17:31                   ` Pekka Enberg
2011-09-19 17:35                     ` Vasiliy Kulikov
2011-09-19 17:51                       ` Christoph Lameter
2011-09-19 19:59                         ` Valdis.Kletnieks
2011-09-19 20:02                           ` Christoph Lameter
2011-09-19 20:36                             ` Valdis.Kletnieks
2011-09-19 17:51                       ` Pekka Enberg
2011-09-19 17:58                         ` Vasiliy Kulikov
2011-09-19 18:46                           ` Pekka Enberg
2011-09-19 18:55                             ` Vasiliy Kulikov
2011-09-19 19:20                               ` Pekka Enberg
2011-09-19 19:33                               ` Pekka Enberg
2011-09-19 18:55                             ` Linus Torvalds
2011-09-19 19:18                               ` Pekka Enberg
2011-09-19 19:45                                 ` Pekka Enberg
2011-09-19 20:59                                 ` David Rientjes
2011-09-19 18:03                         ` Dave Hansen
2011-09-19 18:21                           ` Pekka Enberg
2011-09-19 19:45           ` Valdis.Kletnieks
2011-09-19 19:55             ` Alan Cox
2011-09-21 17:05               ` Vasiliy Kulikov
2011-09-22  2:20                 ` Valdis.Kletnieks
2011-09-22 17:57 ` Vasiliy Kulikov [this message]

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=20110922175754.GA6558@albatros \
    --to=segoon@openwall.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=gorcunov@gmail.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=penberg@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).