All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore@hp.com>
To: selinux@tycho.nsa.gov
Cc: Stephen Smalley <sds@epoch.ncsc.mil>, James Morris <jmorris@redhat.com>
Subject: socket options ... again
Date: Thu, 26 Oct 2006 12:21:23 -0400	[thread overview]
Message-ID: <4540E083.2030304@hp.com> (raw)

I was looking at some policy and just realized that it's pretty liberal in
handing out the socket setopt permission to domains; for some reason I was
thought this was a rather rare thing.  This concerns me slightly because this is
how NetLabel attaches security attributes to outgoing packets.

As a result I'm starting to look at how to best protect the NetLabel security
attributes in the socket's IP options.  It is pretty straight forward to hook
into the selinux_socket_setsockopt() function and watch for the
IPPROTO_IP/IP_OPTIONS combination but my question to all of you is what is the
"right" thing to do in such a case?  I can think of the following options (all
of which are fairly easy to implement):

1. If NetLabel is compiled into the kernel deny the application the right to set
the socket's IP options.  This is pretty heavy handed but it would preserve the
security attributes; although I have no idea the problems it might cause in the
application space.

2. If the socket has a NetLabel attached to it simply deny the access, otherwise
allow it to proceed.  This has the problem in that it could allow a "bad"
application to write it's own "evil" security attributes to the socket's IP
option, although if there is no NetLabel attached to the socket (i.e. NetLabel
was told to ignore this domain) this may be okay.

3. If the application sets it's own security attributes, clear the socket's
option field and replace it with the correct NetLabel option even if the
NetLabel configuration for that domain is to leave the packets unlabeled.  The
problem here is that we would be allowing the setsockopt() syscall to proceed
without error then we would end up resetting the options on the socket (this
would happen on the first write to the socket).

While option #1 is the easiest I don't really like the idea of simply denying
applications the ability to set IP options (although I question how common this
really is).  Option #3 is perhaps the most compatible, although it could lead to
strange behavior with socket options changing underneath the application.  Which
leads me to option #2, it does have the drawback I mentioned above, but then
again there is nothing stopping applications from doing this currently.

Thoughts on these options?  Can anyone else think of a better solution?

-- 
paul moore
linux security @ hp

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

             reply	other threads:[~2006-10-26 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-26 16:21 Paul Moore [this message]
2006-10-26 16:46 ` socket options ... again Stephen Smalley
2006-10-26 17:23   ` Paul Moore
2006-10-26 18:00     ` Stephen Smalley
2006-10-26 18:51       ` Paul Moore
2006-10-26 19:07   ` Paul Moore
2006-10-26 20:37     ` [RFC] protect NetLabel options from setsockopt (was: socket options ... again) Paul Moore

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=4540E083.2030304@hp.com \
    --to=paul.moore@hp.com \
    --cc=jmorris@redhat.com \
    --cc=sds@epoch.ncsc.mil \
    --cc=selinux@tycho.nsa.gov \
    /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.