From: Klaus Weidner <klaus@atsec.com>
To: Karl MacMillan <kmacmillan@mentalrootkit.com>
Cc: Joshua Brindle <method@manicmethod.com>,
Joshua Brindle <method@gentoo.org>,
russell@coker.com.au, selinux@tycho.nsa.gov,
Stephan Mueller <smueller@atsec.com>
Subject: Re: type transitioning script race condition?
Date: Thu, 31 Aug 2006 11:02:22 -0500 [thread overview]
Message-ID: <20060831160222.GD12307@w-m-p.com> (raw)
In-Reply-To: <1157038164.14623.6.camel@localhost.localdomain>
On Thu, Aug 31, 2006 at 11:29:24AM -0400, Karl MacMillan wrote:
> Sorry - started one message and sent another. If you embed the script
> (as a string) and interpreter in the C wrapper you can avoid the race.
Yes, the important thing is to ensure that raising the privileges and
picking the thing to execute is a single operation.
> In practice - for the scripts we are discussing - if you have sufficient
> privilege to modify the script or the environment to take advantage of
> the race condition you likely have a more direct attack vector. So the
> environment cleansing seems more important to me.
You don't need to modify the script or have special privileges to exploit
the race condition. A possible example looks like this:
- create link to executable (the link can be one of the path components),
for example:
ln -s /usr/sbin /tmp/hack
- execute /tmp/hack/semanage
- kernel looks at label of /tmp/hack/semanage, gets the label of
/usr/sbin/semanage
- kernel decides to do a domain transition, suid, whatever
- kernel executes: /usr/bin/python /tmp/hack/semanage
- attacker redirects /tmp/hack to /tmp/malicious/ which contains a
different semanage script
- python opens /tmp/hack/semanage which now resolves to
/tmp/malicious/semanage
(As an aside, I think in this specific case the AppArmor approach of
making the security decisions based on the path name is actually safer
than using the file label. Time for a flame war about "label based
security considered harmful"? ;-) But the real solution is to avoid the
race in the first place.)
-Klaus
--
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.
next prev parent reply other threads:[~2006-08-31 16:02 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-30 22:39 type transitioning script race condition? Klaus Weidner
2006-08-30 23:18 ` Russell Coker
2006-08-31 3:12 ` Joshua Brindle
2006-08-31 13:23 ` Karl MacMillan
2006-08-31 13:53 ` Joshua Brindle
2006-08-31 15:29 ` Karl MacMillan
2006-08-31 15:41 ` Joshua Brindle
2006-08-31 16:02 ` Klaus Weidner [this message]
2006-08-31 16:39 ` Karl MacMillan
2006-08-31 17:19 ` Klaus Weidner
2006-08-31 20:02 ` Karl MacMillan
2006-08-31 15:46 ` Klaus Weidner
2006-08-31 16:13 ` Joshua Brindle
2006-08-31 16:40 ` Klaus Weidner
2006-09-01 11:37 ` Stephen Smalley
2006-09-01 12:48 ` Russell Coker
2006-09-01 13:13 ` Joshua Brindle
2006-08-31 14:43 ` Stephen Smalley
2006-08-31 14:49 ` Joshua Brindle
2006-08-31 15:09 ` Stephen Smalley
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=20060831160222.GD12307@w-m-p.com \
--to=klaus@atsec.com \
--cc=kmacmillan@mentalrootkit.com \
--cc=method@gentoo.org \
--cc=method@manicmethod.com \
--cc=russell@coker.com.au \
--cc=selinux@tycho.nsa.gov \
--cc=smueller@atsec.com \
/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.