All of lore.kernel.org
 help / color / mirror / Atom feed
From: Solar Designer <solar@openwall.com>
To: Salvatore Mesoraca <s.mesoraca16@gmail.com>
Cc: Kernel Hardening <kernel-hardening@lists.openwall.com>,
	Matthew Wilcox <willy@infradead.org>
Subject: [kernel-hardening] Re: [PATCH v3 0/2] Restrict dangerous open in sticky directories
Date: Mon, 11 Dec 2017 17:07:47 +0100	[thread overview]
Message-ID: <20171211160747.GA24829@openwall.com> (raw)
In-Reply-To: <20171207222334.GA8632@openwall.com>

On Thu, Dec 07, 2017 at 11:23:34PM +0100, Solar Designer wrote:
> On Tue, Dec 05, 2017 at 11:13:50AM +0100, Salvatore Mesoraca wrote:
> > 2017-11-30 20:05 GMT+01:00 Solar Designer <solar@openwall.com>:
> > > A new thought: a directory that has someone else as its owner is for our
> > > purposes effectively the same as a group-writable directory.  So maybe
> > > whatever we'll implement for group-writable directories should also be
> > > done for directories that have other than the current fsuid as their
> > > owner. It's currently very uncommon to have directories with the sticky
> > > bit set that are not at least group-writable, so this will rarely make a
> > > difference (and when it does, that's just right), but also it provides a
> > > way to explicitly include any dibrectory under this monitoring (if the
> > > group-writable protection is on) - e.g., if a sysadmin wants this
> > > monitoring for users' home directories, they can change permissions for
> > > those from e.g. 700 to 1700.  This could be handy for development and
> > > auditing of software, even though in production it could be easily
> > > circumvented by the directory owner (who can remove the sticky bit,
> > > which we should document to avoid providing a false sense of security)
> > > and it won't automatically apply to subdirectories.  It'd also cover
> > > part of what we intend to achieve later by possibly extending the
> > > feature to non-sticky directories, where we might also want to treat
> > > different owner the same as group-writable (without the circumvention).
> > 
> > Agreed. I'll extend it to also check for the directory owner.
> > Maybe I could use another bit and make this additional restriction
> > independent from the "group-writable" one.
> 
> I'd prefer not to waste a bit on this.  We'll need plenty of bits later
> on, perhaps also in pairs or (with your suggestion to separate this one)
> in triplets, and every extra bit complicates the calculation of the
> bitmask value.

OTOH, if we were to interleave the world and group bits, then maybe
instead of having the world and group bits as separate we could have a
two bit number, which naturally leaves us an extra value we'd use for
owner.  So:

0 - none
1 - world
2 - group and world
3 - owner, group, and world

This would remove the ability to enable our restrictions for group (and
owner) while disabling them for world, but that's likely just an obscure
misconfiguration.

Unfortunately, this is not compatible with my other idea of easily
extending a tested policy from world onto group by simply assigning the
same value to the other sysctl.

I'm not sure which of these approaches is cleaner.

Alexander

  parent reply	other threads:[~2017-12-11 16:07 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22  8:01 [PATCH v3 0/2] Restrict dangerous open in sticky directories Salvatore Mesoraca
2017-11-22  8:01 ` [kernel-hardening] " Salvatore Mesoraca
2017-11-22  8:01 ` [PATCH v3 1/2] Protected FIFOs and regular files Salvatore Mesoraca
2017-11-22  8:01   ` [kernel-hardening] " Salvatore Mesoraca
2017-11-23 22:43   ` Tobin C. Harding
2017-11-24  8:24     ` Salvatore Mesoraca
2017-11-22  8:01 ` [PATCH v3 2/2] Protected O_CREAT open in sticky directories Salvatore Mesoraca
2017-11-22  8:01   ` [kernel-hardening] " Salvatore Mesoraca
2017-11-22 12:03   ` Pavel Vasilyev
2017-11-24  8:28     ` Salvatore Mesoraca
2017-11-22 13:22   ` Matthew Wilcox
2017-11-22 13:22     ` [kernel-hardening] " Matthew Wilcox
2017-11-22 14:38     ` Pavel Vasilyev
2017-11-24  8:29     ` Salvatore Mesoraca
2017-11-24  8:29       ` [kernel-hardening] " Salvatore Mesoraca
2017-11-22 16:51   ` Alan Cox
2017-11-22 16:51     ` [kernel-hardening] " Alan Cox
2017-11-24  8:31     ` Salvatore Mesoraca
2017-11-24  8:31       ` [kernel-hardening] " Salvatore Mesoraca
2017-11-24 10:53     ` David Laight
2017-11-24 10:53       ` [kernel-hardening] " David Laight
2017-11-24 11:43       ` Salvatore Mesoraca
2017-11-24 11:43         ` [kernel-hardening] " Salvatore Mesoraca
2017-11-24 11:53         ` David Laight
2017-11-24 11:53           ` [kernel-hardening] " David Laight
2017-11-26 11:29           ` Salvatore Mesoraca
2017-11-26 11:29             ` [kernel-hardening] " Salvatore Mesoraca
2017-11-27  0:26         ` Solar Designer
2017-11-27  0:26           ` [kernel-hardening] " Solar Designer
2017-11-30 14:39           ` Salvatore Mesoraca
2017-11-30 14:39             ` [kernel-hardening] " Salvatore Mesoraca
2017-11-30 14:57             ` Ian Campbell
2017-11-30 16:30               ` [kernel-hardening] " Solar Designer
2017-12-05 10:21                 ` Salvatore Mesoraca
2017-12-07 21:47                   ` Solar Designer
2017-12-11 12:08                     ` Salvatore Mesoraca
2017-11-23 22:57   ` Tobin C. Harding
2017-11-24  8:34     ` Salvatore Mesoraca
2017-11-30 16:53   ` David Laight
2017-11-30 16:53     ` [kernel-hardening] " David Laight
2017-11-30 17:51     ` Solar Designer
2017-11-30 17:51       ` [kernel-hardening] " Solar Designer
2017-12-01  9:46       ` David Laight
2017-12-01  9:46         ` [kernel-hardening] " David Laight
2017-12-01 15:52         ` Alan Cox
2017-12-01 15:52           ` [kernel-hardening] " Alan Cox
2017-11-27  1:14 ` [kernel-hardening] Re: [PATCH v3 0/2] Restrict dangerous " Solar Designer
2017-11-27 13:18   ` Solar Designer
2017-11-30 14:38     ` Salvatore Mesoraca
2017-11-30 14:37   ` Salvatore Mesoraca
2017-11-30 19:05     ` Solar Designer
2017-11-30 19:14       ` Solar Designer
2017-12-05 10:13       ` Salvatore Mesoraca
2017-12-07 22:23         ` Solar Designer
2017-12-08 12:17           ` Solar Designer
2017-12-11 12:07             ` Salvatore Mesoraca
2017-12-11 15:33               ` Solar Designer
2017-12-12 18:00                 ` Salvatore Mesoraca
2017-12-11 16:07           ` Solar Designer [this message]
2017-12-12 18:01             ` Salvatore Mesoraca

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=20171211160747.GA24829@openwall.com \
    --to=solar@openwall.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=s.mesoraca16@gmail.com \
    --cc=willy@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.