poly-instantiated directories and call-gate
When giving a talk on PI directories I was asked why every program that calls setuid() has to be changed instead of just changing what happens when setuid() is called.
I mentioned in my talk that the MTA local delivery agents and suexec need to be modified to use PAM to prevent users from using those facilities to escape from their poly-instantiated directories. The idea is that if you change N programs and there are really N+1 programs that call setuid() before performing operations on behalf of users then you lose.
I believe that with a /tmp/.inst/whatever scheme (as previously discussed) most attacks require that both users that want to inappropriately exchange data need to be involved. I find it difficult to imagine a scenario where it is expected that two users who are allowed to receive email or host cgi-bin scripts would be unable to exchange data in some more convenient manner. Thus the consequences of a single user breaking out of their instance of /tmp is mitigated.
In terms of having a call-gate, apparently this has been done before (Casey - would you care to comment?). But even so I have great doubts about anything that involves changing a simple system call to an execution of a program (thus giving some potential for dead-locks among other things). I believe that this was one of the issues with devfs that caused it to be deprecated.
Signature · 9 lines
http://etbe.blogspot.com/ My Blog http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/sponsorship.html Sponsoring Free Software development -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
MLS with DAC
Good morning everybody. I wonder if it could be possible to achieve partial MLS using standard DAC: what if I create 4 group of users (TS, Secret, Confidential, Unclassified), and create documents with those groups as owner, so that only users who belong to each group can access documents of that kind?
_________________________________________________________________
Ami viaggiare?Ma non sai dove andare? http://search.msn.it/results.aspx?q=viaggiare&FORM=QBRE
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: MLS with DAC
Quoted 9 lines · --- Salvo Giuffrida
Good morning everybody. I wonder if it could be possible to achieve partial
MLS using standard DAC: what if I create 4 group of users (TS, Secret,
Confidential, Unclassified), and create documents with those groups as
owner, so that only users who belong to each group can access documents of
that kind?
If you turned off multiple groups and
disabled the ability to change mode,
owner, and group attributes on files
and user sessions you could begin to
make an argument that you have MLS.
Alas, your system wouldn't work very well.
Casey Schaufler
[email protected]
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 4 lines · --- Russell Coker
...
Thus the consequences of a single user breaking out of their instance of /tmp
is mitigated.
Contrary to popular belief, the motivation behind polyinstatiated directories was allowing programs that used /tmp to continue to work, not to assist in keeping programs with different attributes (MLS values in particular) seperate. In the early days of Unix MLS design we seriously considered tossing /tmp into the bitbucket and encouraging everyone to set a rational value to $TMPDIR and being done with it. In the end we figured that the install base really did require access to /tmp, and polyinstatiation emerged as the most popular scheme for providing that access.
All of the Unix schemes provide a way to get at the "real" file system name space. Solaris uses "adorned" path components. Trix uses a process attribute (the Moldy bit), and UNICOS used a symlink scheme that avoided the whole issue. With the usual file system protections in place there is no compelling reason to worry about "breaking out". There are good reasons to allow it, including sharing (upward) and monitoring.
Quoted 3 lines
In terms of having a call-gate, apparently this has been done before (Casey -
would you care to comment?).
Yes, it has been done. It's a Bad Idea.
Quoted 8 lines
But even so I have
great doubts about anything
that involves changing a simple system call to an
execution of a program
(thus giving some potential for dead-locks among
other things). I believe
that this was one of the issues with devfs that
caused it to be deprecated.
Casey Schaufler
[email protected]
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 7 lines · Casey Schaufler
Quoted 3 lines
Thus the consequences of a single user breaking out of their instance of /tmp
is mitigated.Contrary to popular belief, the motivation behind polyinstatiated directories was allowing programs that used /tmp to continue to work,
Well, to be pedantic doing a few "chmod -R 777" commands will also allow programs to continue to work (I've seen this done). The reason for PI is to allow programs to continue to work while providing good security (where mode 1777 is not good enough).
Quoted 11 lines
not to
assist in keeping programs with different attributes (MLS values in particular) seperate. In the early days of Unix MLS design we seriously considered tossing /tmp into the bitbucket and encouraging everyone to set a rational value to $TMPDIR and being done with it. In the end we figured that the install base really did require access to /tmp, and polyinstatiation emerged as the most popular scheme for providing that access.
There are some technical advantages to /tmp in terms of management. /tmp can be a filesystem with no persistent storage (the default action on Solaris). Even if /tmp is a real filesystem if space runs low the sys-admin can do a few "rm -rf" commands with the knowledge that the potential risk is quite low. You can set up strict quotas on home directories for storage that is backed up while allowing large (or no) quotas on /tmp for operations that require a lot of space (eg sort).
Setting $TMPDIR=/tmp/$USER would work reasonably well if all programs would actually use $TMPDIR.
Quoted 10 lines
All of the Unix schemes provide a way to get at the "real" file system name space. Solaris uses "adorned" path components. Trix uses a process attribute (the Moldy bit), and UNICOS used a symlink scheme that avoided the whole issue. With the usual file system protections in place there is no compelling reason to worry about "breaking out". There are good reasons to allow it, including sharing (upward) and monitoring.
I recall from playing with Trix that you had to be the administrator to see the full name space. Was Solaris the same in this regard?
As for the Unicos symlink scheme, how did that work?
Quoted 5 lines
Quoted 3 lines
In terms of having a call-gate, apparently this has been done before (Casey -
would you care to comment?).Yes, it has been done. It's a Bad Idea.
That was my gut feeling too. Apart from the reasons I outline below what were the problems with it? I expect that I'll be asked the same question the next time I speak about such things and want to have a good answer ready. Also it'll be good to have this in the list archives.
I think it might be worth having a wikipedia page on this. What would be a good title?
Quoted 8 lines
Quoted 8 lines
But even so I have
great doubts about anything
that involves changing a simple system call to an
execution of a program
(thus giving some potential for dead-locks among
other things). I believe
that this was one of the issues with devfs that
caused it to be deprecated.
Signature · 9 lines
http://etbe.blogspot.com/ My Blog http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/sponsorship.html Sponsoring Free Software development -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 12 lines · --- Russell Coker
Quoted 1 line · Casey Schaufler
Quoted 1 line
Thus the consequences of a single user breaking
out
Quoted 6 lines
Quoted 2 lines
of their instance of /tmp
is mitigated.Contrary to popular belief, the motivation behind polyinstatiated directories was allowing programs that used /tmp to continue to work,
Quoted 7 lines
Well, to be pedantic doing a few "chmod -R 777" commands will also allow
programs to continue to work (I've seen this done). The reason for PI is to
allow programs to continue to work while providing good security (where mode
1777 is not good enough).
Polyinstatiation was developed in the context of MLS and explicitly to deal with the issue that the MLS label of a traditional /tmp would allow only processes with that MLS label to write to it. Giving /tmp a "wildcard" MLS label would have been considered a design flaw by the TCSEC evaluators, and was not an option. The alternative to polyinstatiation is directory entries comprised of a name/inode/MLS-label triple instead of the traditional name/inode pair, resulting in directory entries being objects in their own right, and thus subject to all of the protection requirements of objects.
Quoted 12 lines
Quoted 11 lines
not to
assist in keeping programs with different attributes (MLS values in particular) seperate. In the early days of Unix MLS design we seriously considered tossing /tmp into the bitbucket and encouraging everyone to set a rational value to $TMPDIR and being done with it. In the end we figured that the install base really did require access to /tmp, and polyinstatiation emerged as the most popular scheme for providing that access.
Quoted 13 lines
There are some technical advantages to /tmp in terms of management. /tmp can
be a filesystem with no persistent storage (the default action on Solaris).
Even if /tmp is a real filesystem if space runs low the sys-admin can do a
few "rm -rf" commands with the knowledge that the potential risk is quite
low. You can set up strict quotas on home directories for storage that is
backed up while allowing large (or no) quotas on /tmp for operations that
require a lot of space (eg sort).
These are all real advantages. They all pale in comparison to the arguement that the customer is shipping the box (@ $20,000,000) back because their application won't work.
Quoted 3 lines
Setting $TMPDIR=/tmp/$USER would work reasonably
well if all programs would
actually use $TMPDIR.
Which is, of course, the rub.
Quoted 11 lines
Quoted 10 lines
All of the Unix schemes provide a way to get at the "real" file system name space. Solaris uses "adorned" path components. Trix uses a process attribute (the Moldy bit), and UNICOS used a symlink scheme that avoided the whole issue. With the usual file system protections in place there is no compelling reason to worry about "breaking out". There are good reasons to allow it, including sharing (upward) and monitoring.
Quoted 3 lines
I recall from playing with Trix that you had to be the administrator to see
the full name space.
su -M allows (or used to!) anyone to flip the bit.
Quoted 1 line
Was Solaris the same in this regard?
Originally anyone could use adorned pathnames. I do not know if it got changed.
Quoted 1 line
As for the Unicos symlink scheme, how did that work?
Symlink processing allowed variables. If you created a symlink /tmp -> /a/$B/c it would look in your environment for a definition of B. /tmp -> /$TEMPDIR/ . Cute.
Quoted 7 lines
Quoted 1 line
Quoted 1 line
In terms of having a call-gate, apparently this
has
Quoted 4 lines
Quoted 2 lines
been done before (Casey -
would you care to comment?).Yes, it has been done. It's a Bad Idea.
Quoted 7 lines
That was my gut feeling too. Apart from the reasons I outline below what were
the problems with it? I expect that I'll be asked the same question the next
time I speak about such things and want to have a good answer ready. Also
it'll be good to have this in the list archives.
It's demonstrably unnecessary as there are several better ways to do the job. The path lookup scheme is "small enough to analyze", I'm not convinced that dynamic components meet that aspect of the TCB principle.
Besides, what it the problem if you do "break out of /tmp"? By rule, every directory is going to enforce policy, so if you get into someone else's /tmp policy will still be enforced.
Quoted 3 lines
I think it might be worth having a wikipedia page on this. What would be a
good title?
I like "moldy directories", from an attempt to pronounce the initials for Multi-Level Directory (MLD) as "mold" and running with the bad joke.
Casey Schaufler
[email protected]
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.