<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: USENIX WOOT07, Exploiting Concurrency Vulnerabilities in System Call Wrappers, and the Evil Genius</title>
	<atom:link href="http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/</link>
	<description>Security Research, Computer Laboratory, University of Cambridge</description>
	<pubDate>Fri, 16 May 2008 06:58:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: TheWanAndOnry</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-28538</link>
		<dc:creator>TheWanAndOnry</dc:creator>
		<pubDate>Thu, 20 Mar 2008 23:58:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-28538</guid>
		<description>Thanks for your answer. My main point is probably, let me have my broken systrace as long as you provide no alternative. "You" is not you but rather NetBSD.

Shared memory: I believe many if not most simpler applications don't use it or at least can live without it. Despite being simple, they are frequently exploitable and have to handle untrusted input. Consider tools like file(1) or pretty much any kind of "parse and transform" application.

“The claim “only fork() and memcpy()”: I might have picked that line from /. or another article. Sorry for attributing it to you.

“Considering that all machines have only single-core CPUs,": What I meant was "What if I only use machines with single-core CPUs?" In fact I do and a lot of infrastructure where CPU power is not very important does too.

“.. the fix appears rather trivial”: That's certainly exaggerated but I thought of people who are already familiar with the kernel code. I believe the reason nothing happened is mainly that systrace is only maintained by a single person namely Niels Provos and somehow systrace didn't take-off at all, maybe because it's complex to configure. Also having to use wrappers is somewhat awkward. People probably just want to apply some restrictions to (application,user) in a central database and the kernel should handle the rest similar to veriexec. There are certainly many usability issue with systrace but then again, if it was reliable, it would still perfect for quite a lot of applications. The question here is also, what's the alternative? A VM for each application or process would be rather heavy on the CPU and probably just as difficult to configure.

However, I have some idea how the current systrace implementation can still be useful and reliable - not in all - but many real-life relevant cases. An obvious problem are syscalls that use pathnames or socket structures as parameters. In the systrace profile you would simply disallow all of them. The systrace executable would replace the relevant function calls with wrapper functions as in the good ol' LD_PRELOAD hack. So "open()" would be linked to "systrace_open()" and so on. The actual parameters are send over a unix domain socket to the systrace wrapper (or daemon). The receiving process can identify euid/egid/uid/gid/pid and the pathname of the executable that created the process, so systrace can locate the policy that will rule the request. If it's granted, systrace calls open() with supplied parameters and passes the file descriptor back over the unix domain socket (an IPC technique known as "file-descriptor passing"). The result code and errno are passed in the same response. The file descriptor number (result code) is of course pointless in this case but matters for stat() and such.

I think this would work for fine-grained access control to the filesystem and sockets.</description>
		<content:encoded><![CDATA[<p>Thanks for your answer. My main point is probably, let me have my broken systrace as long as you provide no alternative. &#8220;You&#8221; is not you but rather NetBSD.</p>
<p>Shared memory: I believe many if not most simpler applications don&#8217;t use it or at least can live without it. Despite being simple, they are frequently exploitable and have to handle untrusted input. Consider tools like file(1) or pretty much any kind of &#8220;parse and transform&#8221; application.</p>
<p>“The claim “only fork() and memcpy()”: I might have picked that line from /. or another article. Sorry for attributing it to you.</p>
<p>“Considering that all machines have only single-core CPUs,&#8221;: What I meant was &#8220;What if I only use machines with single-core CPUs?&#8221; In fact I do and a lot of infrastructure where CPU power is not very important does too.</p>
<p>“.. the fix appears rather trivial”: That&#8217;s certainly exaggerated but I thought of people who are already familiar with the kernel code. I believe the reason nothing happened is mainly that systrace is only maintained by a single person namely Niels Provos and somehow systrace didn&#8217;t take-off at all, maybe because it&#8217;s complex to configure. Also having to use wrappers is somewhat awkward. People probably just want to apply some restrictions to (application,user) in a central database and the kernel should handle the rest similar to veriexec. There are certainly many usability issue with systrace but then again, if it was reliable, it would still perfect for quite a lot of applications. The question here is also, what&#8217;s the alternative? A VM for each application or process would be rather heavy on the CPU and probably just as difficult to configure.</p>
<p>However, I have some idea how the current systrace implementation can still be useful and reliable - not in all - but many real-life relevant cases. An obvious problem are syscalls that use pathnames or socket structures as parameters. In the systrace profile you would simply disallow all of them. The systrace executable would replace the relevant function calls with wrapper functions as in the good ol&#8217; LD_PRELOAD hack. So &#8220;open()&#8221; would be linked to &#8220;systrace_open()&#8221; and so on. The actual parameters are send over a unix domain socket to the systrace wrapper (or daemon). The receiving process can identify euid/egid/uid/gid/pid and the pathname of the executable that created the process, so systrace can locate the policy that will rule the request. If it&#8217;s granted, systrace calls open() with supplied parameters and passes the file descriptor back over the unix domain socket (an IPC technique known as &#8220;file-descriptor passing&#8221;). The result code and errno are passed in the same response. The file descriptor number (result code) is of course pointless in this case but matters for stat() and such.</p>
<p>I think this would work for fine-grained access control to the filesystem and sockets.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert N. M. Watson</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-28347</link>
		<dc:creator>Robert N. M. Watson</dc:creator>
		<pubDate>Sat, 01 Mar 2008 15:38:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-28347</guid>
		<description>Dear TheWanAndOnry,

(1) "None of my policies mention minherit(), so it’s not allowed and apparently not used by any of my traced application."

The use of minherit() is simply an example -- there are many, many ways to set up shared memory between two processes in most UNIX systems, from inheritable mmap()'s, explicit shared memory, memory-mapped files, rfork()/clone(), to threading. Shared memory has been a critical part of the UNIX design for 20+ years, and, combined with parallelism/concurrency, is all that is required in order to exploit these races.

(2) "The claim “only fork() and memcpy()” seems not quite true."

I can't find this claim in the blog article, paper, or presentation. Certainly, all my examples make use of other system calls in order to set up shared memory, which is a widely available and heavily used facility; I also manipulate the scheduler process priority to make exploits on UP more successful, which is not strictly necessary but is helpful.

(1) "Considering that all machines have only single-core CPUs, is systrace really broken in this case?"

I think this assumption comes with two false premise:

First, the vulnerability does affect single-core CPUs, as I illustrate in the paper. It just turns out to be even more effective on multi-core.

Second, I would disagree with "all machines have only single-core CPUs"; hyper-threading/SMT, SMP, and multi-core have become widespread, and from commodity server-class boxes shipped 4+ years ago, to the 2-core notebook I got 2+ years ago, to multi-core embedded hardware that's widespread in networking and telecommunications.  The brave new world of parallelism is here in force, and here to stay.

(2) ".. the fix appears rather trivial"

The fix requires significantly rewriting the kernel memory copying code, or, more cleanly, the system call code, and despite suggestions that it would shortly be fixed for the past six+ years since I reported the vulnerability, it still hadn't been fixed in any of the systems I looked at. Keep in mind also that copying only addresses one half of the problem. Per my comments in the paper about message passing: by moving to true message passing and offering atomic argument access, syntactic races are addressed, but not semantic races, which are inherent to software composition using wrappers.

(3) "Isn't it still useful...?"

I've never said that systrace isn't useful, just that it is highly vulnerable to a certain class of attacks if used for sandboxing. If your use of systrace does not involve paths, socket addresses, etc, in its policy controls, or if the use isn't security related, then it presumably not "vulnerable", although it might be subject to functional race conditions that might well be considered bugs. I have never advocated for the removal of systrace from NetBSD, only that it be properly documented as either a system not appropriate for general-purpose sandboxing as it has been advertised, or that the constraints of sandboxing be properly documented.

thanks for your interest and comments
Robert Watson</description>
		<content:encoded><![CDATA[<p>Dear TheWanAndOnry,</p>
<p>(1) &#8220;None of my policies mention minherit(), so it’s not allowed and apparently not used by any of my traced application.&#8221;</p>
<p>The use of minherit() is simply an example &#8212; there are many, many ways to set up shared memory between two processes in most UNIX systems, from inheritable mmap()&#8217;s, explicit shared memory, memory-mapped files, rfork()/clone(), to threading. Shared memory has been a critical part of the UNIX design for 20+ years, and, combined with parallelism/concurrency, is all that is required in order to exploit these races.</p>
<p>(2) &#8220;The claim “only fork() and memcpy()” seems not quite true.&#8221;</p>
<p>I can&#8217;t find this claim in the blog article, paper, or presentation. Certainly, all my examples make use of other system calls in order to set up shared memory, which is a widely available and heavily used facility; I also manipulate the scheduler process priority to make exploits on UP more successful, which is not strictly necessary but is helpful.</p>
<p>(1) &#8220;Considering that all machines have only single-core CPUs, is systrace really broken in this case?&#8221;</p>
<p>I think this assumption comes with two false premise:</p>
<p>First, the vulnerability does affect single-core CPUs, as I illustrate in the paper. It just turns out to be even more effective on multi-core.</p>
<p>Second, I would disagree with &#8220;all machines have only single-core CPUs&#8221;; hyper-threading/SMT, SMP, and multi-core have become widespread, and from commodity server-class boxes shipped 4+ years ago, to the 2-core notebook I got 2+ years ago, to multi-core embedded hardware that&#8217;s widespread in networking and telecommunications.  The brave new world of parallelism is here in force, and here to stay.</p>
<p>(2) &#8220;.. the fix appears rather trivial&#8221;</p>
<p>The fix requires significantly rewriting the kernel memory copying code, or, more cleanly, the system call code, and despite suggestions that it would shortly be fixed for the past six+ years since I reported the vulnerability, it still hadn&#8217;t been fixed in any of the systems I looked at. Keep in mind also that copying only addresses one half of the problem. Per my comments in the paper about message passing: by moving to true message passing and offering atomic argument access, syntactic races are addressed, but not semantic races, which are inherent to software composition using wrappers.</p>
<p>(3) &#8220;Isn&#8217;t it still useful&#8230;?&#8221;</p>
<p>I&#8217;ve never said that systrace isn&#8217;t useful, just that it is highly vulnerable to a certain class of attacks if used for sandboxing. If your use of systrace does not involve paths, socket addresses, etc, in its policy controls, or if the use isn&#8217;t security related, then it presumably not &#8220;vulnerable&#8221;, although it might be subject to functional race conditions that might well be considered bugs. I have never advocated for the removal of systrace from NetBSD, only that it be properly documented as either a system not appropriate for general-purpose sandboxing as it has been advertised, or that the constraints of sandboxing be properly documented.</p>
<p>thanks for your interest and comments<br />
Robert Watson</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheWanAndOnry</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-28048</link>
		<dc:creator>TheWanAndOnry</dc:creator>
		<pubDate>Wed, 20 Feb 2008 17:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-28048</guid>
		<description>I have another question: Even if systrace is much less useful (at least the way it's currently implemented), isn't it still useful to prevent that an (exploited) application can use socket functions or exec() - assuming it would normally use none of these so that you can safely deny permission?

I could imagine that systrace is overkill for this purpose but I'm not aware of an existing alternative. I have always considered it as awkward and a design flaw that Unix with all its filesystem security and idea of privileges, provides absolutely no tool to prevent access to the network except for low-level network functions like raw sockets.

Some firewalls can map rules to users and groups but that's far too coarse even requiring awkward setgid/uid tricks for effective use in practise.</description>
		<content:encoded><![CDATA[<p>I have another question: Even if systrace is much less useful (at least the way it&#8217;s currently implemented), isn&#8217;t it still useful to prevent that an (exploited) application can use socket functions or exec() - assuming it would normally use none of these so that you can safely deny permission?</p>
<p>I could imagine that systrace is overkill for this purpose but I&#8217;m not aware of an existing alternative. I have always considered it as awkward and a design flaw that Unix with all its filesystem security and idea of privileges, provides absolutely no tool to prevent access to the network except for low-level network functions like raw sockets.</p>
<p>Some firewalls can map rules to users and groups but that&#8217;s far too coarse even requiring awkward setgid/uid tricks for effective use in practise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheWanAndOnry</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-28024</link>
		<dc:creator>TheWanAndOnry</dc:creator>
		<pubDate>Sun, 17 Feb 2008 12:37:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-28024</guid>
		<description>None of my policies mention minherit(), so it's not allowed and apparently not used by any of my traced application. I see that MAP_INHERIT can be used with mmap() to achieve the same. The claim "only fork() and memcpy()" seems not quite true. Considering that all machines have only single-core CPUs, is systrace really broken in this case?

Maybe I'm missing something but I don't even see, why it hasn't been fixed. In fact, systrace has been removed from NetBSD albeit the fix appears to be rather trivial. That is systrace needs to know how and which parameters are passed to each single syscall anyway and I don't understand what's so difficult about packing/unpacking the parameters at the same time. Copying costs performance of course but as long as it's much faster than emulation - few programs spent more time with syscalls than userland code - there is not really a performance issue either. Basically, as far as I grasp this, there is absolutely nothing wrong with systrace as a concept. It's just broken due to an implementation choice that makes it "rather faster than safe".</description>
		<content:encoded><![CDATA[<p>None of my policies mention minherit(), so it&#8217;s not allowed and apparently not used by any of my traced application. I see that MAP_INHERIT can be used with mmap() to achieve the same. The claim &#8220;only fork() and memcpy()&#8221; seems not quite true. Considering that all machines have only single-core CPUs, is systrace really broken in this case?</p>
<p>Maybe I&#8217;m missing something but I don&#8217;t even see, why it hasn&#8217;t been fixed. In fact, systrace has been removed from NetBSD albeit the fix appears to be rather trivial. That is systrace needs to know how and which parameters are passed to each single syscall anyway and I don&#8217;t understand what&#8217;s so difficult about packing/unpacking the parameters at the same time. Copying costs performance of course but as long as it&#8217;s much faster than emulation - few programs spent more time with syscalls than userland code - there is not really a performance issue either. Basically, as far as I grasp this, there is absolutely nothing wrong with systrace as a concept. It&#8217;s just broken due to an implementation choice that makes it &#8220;rather faster than safe&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sjdfjsk</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-24084</link>
		<dc:creator>sjdfjsk</dc:creator>
		<pubDate>Tue, 18 Sep 2007 01:34:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-24084</guid>
		<description>it seems the blackhats were right all along when making fun of systrace/openbsd</description>
		<content:encoded><![CDATA[<p>it seems the blackhats were right all along when making fun of systrace/openbsd</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-24066</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Sun, 16 Sep 2007 19:54:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-24066</guid>
		<description>The problem was described and demo provided for Windows
in 2003 http://lists.virus.org/bugtraq-0312/msg00347.html</description>
		<content:encoded><![CDATA[<p>The problem was described and demo provided for Windows<br />
in 2003 <a href="http://lists.virus.org/bugtraq-0312/msg00347.html" rel="nofollow">http://lists.virus.org/bugtraq-0312/msg00347.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: script kitty</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-23626</link>
		<dc:creator>script kitty</dc:creator>
		<pubDate>Fri, 17 Aug 2007 09:02:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-23626</guid>
		<description>Dear astraco,

your host is constantly attacking my server. I am sure this is because you just don't care and not due to malevolent actions from your part. Please don't shut it down and don't ever be fucked.</description>
		<content:encoded><![CDATA[<p>Dear astraco,</p>
<p>your host is constantly attacking my server. I am sure this is because you just don&#8217;t care and not due to malevolent actions from your part. Please don&#8217;t shut it down and don&#8217;t ever be fucked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dani</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-23523</link>
		<dc:creator>dani</dc:creator>
		<pubDate>Sun, 12 Aug 2007 08:27:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-23523</guid>
		<description>NetBSD is very JIHBED.</description>
		<content:encoded><![CDATA[<p>NetBSD is very JIHBED.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Comeau</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-23495</link>
		<dc:creator>Sean Comeau</dc:creator>
		<pubDate>Fri, 10 Aug 2007 19:27:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-23495</guid>
		<description>Nice presentation. Although the problem has been fairly well known since systrace was released, and its use for anything other than making sure that ports don't install files in the wrong place by accident is discouraged, most people still think systrace can stop attacks. In this presentation your examples are perfectly clear and easy to follow. They should be added to the man page as a warning not to rely on systrace as a security mechanism. 

Another problem with systrace is that that it's difficult to know all legitimate code paths a program will take. That might be acceptable when using it on client applications such as a web browser. If you were running your web browser under systrace, and willing to put up with the annoyance of running into new code paths now and then, you would arguably be more secure than someone next to you not running systrace. The reason is because use of systrace is not very common, and most exploits don't implement the systrace attack.  The attacker might not know why his payload failed to run properly. He might not care if he's out of quantity and not just you. But on the other hand, you might not realize that you were attacked at all. Maybe you just ran into another case of bad systrace policy, turn off automatic enforcement and hit the malicious site again.</description>
		<content:encoded><![CDATA[<p>Nice presentation. Although the problem has been fairly well known since systrace was released, and its use for anything other than making sure that ports don&#8217;t install files in the wrong place by accident is discouraged, most people still think systrace can stop attacks. In this presentation your examples are perfectly clear and easy to follow. They should be added to the man page as a warning not to rely on systrace as a security mechanism. </p>
<p>Another problem with systrace is that that it&#8217;s difficult to know all legitimate code paths a program will take. That might be acceptable when using it on client applications such as a web browser. If you were running your web browser under systrace, and willing to put up with the annoyance of running into new code paths now and then, you would arguably be more secure than someone next to you not running systrace. The reason is because use of systrace is not very common, and most exploits don&#8217;t implement the systrace attack.  The attacker might not know why his payload failed to run properly. He might not care if he&#8217;s out of quantity and not just you. But on the other hand, you might not realize that you were attacked at all. Maybe you just ran into another case of bad systrace policy, turn off automatic enforcement and hit the malicious site again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert N. M. Watson</title>
		<link>http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-23494</link>
		<dc:creator>Robert N. M. Watson</dc:creator>
		<pubDate>Fri, 10 Aug 2007 18:06:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.lightbluetouchpaper.org/2007/08/06/usenix-woot07-exploiting-concurrency-vulnerabilities-in-system-call-wrappers-and-the-evil-genius/#comment-23494</guid>
		<description>Dear Inc_Vega:

:-P

Thanks,

Robert Watson</description>
		<content:encoded><![CDATA[<p>Dear Inc_Vega:</p>
<p> <img src='http://www.lightbluetouchpaper.org/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
<p>Thanks,</p>
<p>Robert Watson</p>
]]></content:encoded>
	</item>
</channel>
</rss>
