<?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"
	>

<channel>
	<title>Brindle on Security &#187; Security</title>
	<atom:link href="http://securityblog.org/brindle/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://securityblog.org/brindle</link>
	<description>The ramblings of security neophyte Joshua Brindle</description>
	<pubDate>Sun, 18 May 2008 18:06:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Security Anti-Pattern: MLS for Guards</title>
		<link>http://securityblog.org/brindle/2008/05/18/security-anti-pattern-mls-for-guards/</link>
		<comments>http://securityblog.org/brindle/2008/05/18/security-anti-pattern-mls-for-guards/#comments</comments>
		<pubDate>Sun, 18 May 2008 18:06:15 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[BLP]]></category>

		<category><![CDATA[CDS]]></category>

		<category><![CDATA[Guard]]></category>

		<category><![CDATA[MLS]]></category>

		<category><![CDATA[selinux]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/?p=24</guid>
		<description><![CDATA[This article was requested, and was a long time coming anyway.
I&#8217;ve gone over Multi-Level Security (MLS) a little bit before. It&#8217;s basically a security policy that is implemented by many trusted operating systems (such as Trusted Solaris) that is hierarchical and inflexible by nature. Specifically Bell-LaPadula (BLP) is used by many operating systems because it [...]]]></description>
			<content:encoded><![CDATA[<p>This article was requested, and was a long time coming anyway.</p>
<p>I&#8217;ve gone over Multi-Level Security (MLS) a little bit before. It&#8217;s basically a security policy that is implemented by many trusted operating systems (such as Trusted Solaris) that is hierarchical and inflexible by nature. Specifically Bell-LaPadula (BLP) is used by many operating systems because it reflects the real world security policy used by the government and military. In BLP subjects and objects have a label consisting of a level (Secret, Top Secret, Unclassified, etc) and a set of non-hierarchical categories (US Only, Army, etc).</p>
<p>The sensitivies are hierarchical in that a higher sensitivity process labeled top secret can read and write top secret objects but only read unclassified objects. This prevents the &#8216;downgrade&#8217; of classified information. For systems that conform to this kind of policy it makes perfect sense, a multi-level desktop system allows users to keep top secret and unclassified material on the same system but does not allow the release of top secret data to unclassified environments or users. Lower levels can also write to higher levels, in some cases. This may seem bad but considering what the policy is trying to accomplish allowing an unclassified process to write a top secret document doesn&#8217;t disclose top secret data. The catch is that the unclassified process would never be able to read the document after writing it. This policy is only usable for confidentiality, to prevent information from being released inappropriately. It cannot address integrity or other security goals I have mentioned in other articles.</p>
<p>Because traditional trusted operating systems only implemented BLP (and in some rare cases Biba for integrity) the users of such systems (primarily government and military) had to use it even when it wasn&#8217;t appropriate. One such case is a guard, or cross domain solution (CDS). A CDS is a system that allows two or more networks of differing security properties to be connected to one another. A typical CDS can connect a top secret to a secret network, for example, and allow information from the secret network onto the top secret network but not vice versa. CDS&#8217;s also do the opposite, allowing a controlled release of information from top secret to secret, or between two coalition networks (Such as Australia and the US). CDS&#8217;s always have some safety mechanism built in to prevent malicious data, or inappropriate data from going across it (if it didn&#8217;t it wouldn&#8217;t be any more useful than a crossover cable between the networks). These safety mechanisms are virus scanners, &#8220;dirty word&#8221; filters, document disassemblers (for example to take a word document and convert it to plain text or pdf), etc. The type of safety mechanism primarily depends on what kinds of networks the system is connecting.</p>
<p>For now we&#8217;ll talk about the first case, letting information flow from a secret network to a top secret network. Since a BLP system is designed to let information go from secret to top secret already it seems like an obvious fit, right? If the CDS was a very simple system with a process to read incoming data, a virus filter and an outgoing process it seems like a BLP policy would be fine. We are going to call the set of processes that pass data through the system the pipeline.</p>
<p>Wrong, there are actually multiple issues here. Because the lower levels would be allowed to write to higher levels, but not read from them we could label the incoming process Unclassified, the middle process Secret and the outgoing process Top Secret. This allows flow from the incoming process to the outgoing process. The main problem here is that since the levels are hierarchical there is nothing that stops the Unclassified process from writing directly to the Top Secret process (oops). Well, people figured this out and thought of a great work-around. Remember those categories? Categories allow reading and writing when the subject dominates (or has a superset) the categories of the object. So you give the incoming process categories that dominate the categories of the middle process but not the outgoing process.</p>
<p>So that problem is solved (albeit in an interesting way) but CDS&#8217;s are never that simple (I mean never). The requirements that are imposed on CDS&#8217;s specify pesky little things like logging, auditing, monitoring, emergency shutdown, etc. So now our simple CDS needs all processes to be able to talk to a logging system, and a monitoring system must ask the processes for their state and get back a response. So now we have one or more huge processes that can talk to and receive data from every process in the pipeline. That wouldn&#8217;t be so bad except the functional requirements of every guard I&#8217;ve seen says that those logs have to end up on the high side for consumption, which is obvious, they certainly can&#8217;t go to the low side because that would be a violation of the security policy. This, of course, allows information to flow through the logging and monitoring process out the other side without going through the set of filters. Sure, the advocates will say the logging and monitoring system is part of the TCB (Trusted Computing Base), the part of the system that is trusted to not do nasty things, but in a system like this do you want such processes to be trusted?</p>
<p><img src="http://securityblog.org/images/bad-cds.png" alt="Bad CDS" /><br />
The above (totally professionally done) diagram shows the attack vector that would be used to get data through such a system. Because the logging/monitoring app is allowed to violate the MAC policy it is possible to use it to bypass filters 2, 3 and 4.</p>
<p>So basically its impossible to use a BLP policy on a guard and ensure that all data is passed through all filters before it reaches the other side, the policy simply wasn&#8217;t made for that kind of thing. It has been the standard operating procedure to shoehorn CDS&#8217;s into that policy for a very long time, however.</p>
<p>Before I get into how SELinux helps this I&#8217;ll quickly cover the other two types of guards I previously mentioned. First the High-to-Low guard. This kind of guard basically allows controlled downgrading of information; it will run filters like a &#8216;dirty word&#8217; filter to ensure nothing that shouldn&#8217;t be getting downgraded isn&#8217;t. It may also redact some data. This CDS is a direct violation of the BLP policy, as such the processes essentially have to be MAC Exempt, or not subject to the policy, essentially making the existence of the policy irrelevant, it should be easy to see why this is an inappropriate use of BLP. The second was a CDS between two coalition partners. In this case the BLP policy doesn&#8217;t even mean anything since there is no high side and low side, merely &#8216;different&#8217; sides.</p>
<p>So, those are the reasons why BLP is inappropriate for CDS&#8217;s, why is SELinux different?</p>
<p>SELinux primarily uses type enforcement for policy decisions. Type enforcement allows fine grained policy to be written for all subjects and objects on the system. In the case of CDS&#8217;s you can literally say incoming process can write to virus scanner (but not read) and virus scanner can write to outgoing process. We call this an assured pipeline. This can be used for any size or type of pipeline, we even have a tool called CDS Framework that lets you visualize the CDS system. But wait, what about all that logging and auditing and monitoring? Simple, since the policy can describe arbitrary relationships between processes we can break that logging and monitoring process up into filter size chunks, then allow each filter to read and write from the logging and monitoring app. The logging and monitoring app can then send its logs through the same pipeline as the data, it will end up on the high side but there is no additional large process you have to trust to allow it to happen. Using type enforcement we can ensure that every single bit of information that comes leaves the guard passed through every filter (we can&#8217;t, of course guarantee that the filters worked). Since type enforcement is not hierarchical the direction of the CDS doesn&#8217;t matter, we can do the same thing for High-to-Low that we do for Low-to-High, or even between coalition networks.</p>
<p><img src="http://securityblog.org/images/good-cds.png" alt="Good CDS" /><br />
The above diagram shows a possible CDS configuration using type enforcement. It allows for logging and monitoring and simply passes those messages back through the filters to get them to the high side. In this configuration no single part of the pipeline is trusted to violate the policy, and filters can never be bypassed. This policy would be impossible to enforce with BLP.</p>
<p>Don&#8217;t take this to mean that I hate MLS and never think it&#8217;s useful. I&#8217;m not saying it kicks puppies (although it does occasional pee on rugs I&#8217;m told). MLS has a time and a place, just like everything else. The point I&#8217;m trying to make is that it shouldn&#8217;t be used if it isn&#8217;t appropriate, as has been done in the past (and continues to be done today).</p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2008/05/18/security-anti-pattern-mls-for-guards/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Is the BSD license more liberal or conservative than the GPL?</title>
		<link>http://securityblog.org/brindle/2008/04/11/is-the-bsd-license-more-liberal-or-conservative-than-the-gpl/</link>
		<comments>http://securityblog.org/brindle/2008/04/11/is-the-bsd-license-more-liberal-or-conservative-than-the-gpl/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 20:21:00 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[bsd]]></category>

		<category><![CDATA[conservative]]></category>

		<category><![CDATA[gpl]]></category>

		<category><![CDATA[liberal]]></category>

		<category><![CDATA[license]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2008/04/11/is-the-bsd-license-more-liberal-or-conservative-than-the-gpl/</guid>
		<description><![CDATA[Recently I was looking around for a piece of software and I thought to myself &#8220;I need something with a more liberal license than the GPL&#8221;.. Then I thought &#8220;Wait, is liberal the right word there? Hrm&#8221;&#8230;
So what do you guys think?
]]></description>
			<content:encoded><![CDATA[<p>Recently I was looking around for a piece of software and I thought to myself &#8220;I need something with a more liberal license than the GPL&#8221;.. Then I thought &#8220;Wait, is liberal the right word there? Hrm&#8221;&#8230;<br />
So what do you guys think?</p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2008/04/11/is-the-bsd-license-more-liberal-or-conservative-than-the-gpl/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Secure doesn&#8217;t mean anything.</title>
		<link>http://securityblog.org/brindle/2008/03/30/secure-doesnt-mean-anything/</link>
		<comments>http://securityblog.org/brindle/2008/03/30/secure-doesnt-mean-anything/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 16:26:54 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[biba]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[integrity]]></category>

		<category><![CDATA[mandatory-access-control]]></category>

		<category><![CDATA[openbsd]]></category>

		<category><![CDATA[selinux]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2008/03/30/secure-doesnt-mean-anything/</guid>
		<description><![CDATA[No, seriously. I&#8217;m not trying to be ironic because the title of my blog is &#8220;Brindle on Security&#8221;, which I should probably change to something more creative anyway.
During my tenure at Gentoo, running the Hardened Gentoo project, the most common question by far was &#8220;How do I secure my system?&#8221; Warning, this article may contain [...]]]></description>
			<content:encoded><![CDATA[<p>No, seriously. I&#8217;m not trying to be ironic because the title of my blog is &#8220;Brindle on Security&#8221;, which I should probably change to something more creative anyway.</p>
<p>During my tenure at Gentoo, running the Hardened Gentoo project, the most common question by far was &#8220;How do I secure my system?&#8221; Warning, this article may contain some flamebait, avoid it if you can&#8217;t resist flaming back ;).</p>
<p>Eventually we gave up and just pointed people to websites, perhaps this post can serve as that page. The answer was &#8220;What do you mean &#8217;secure&#8217; your system?&#8221; Security isn&#8217;t, and can&#8217;t be, a goal by itself. You need to know what exactly you are trying to protect yourself against, your threat model, as it were.<br />
<span id="more-22"></span><br />
SELinux has the ability to protect against many different threat models. In Hardened Gentoo we also had some complimentary projects that protected against things that SELinux couldn&#8217;t, such as PaX (kernel level memory execution protection and memory layout randomization) and SSP (userspace level stack smashing protection). Fedora also has comparable technologies such as Exec Shield baked in by default.</p>
<p>So I saw a thread recently that said something to the concern of &#8220;Why use SELinux, which is security bolted onto Linux when you can use OpenBSD which has security as part of the development process?&#8221; It&#8217;s an interesting question I suppose, if you can decode it. The OpenBSD mantra seems to be develop software correctly in the first place and you don&#8217;t need additional layers of security. The baffling part is that you&#8217;ll rarely find an OpenBSD user that actually knows what security OpenBSD actually, tangibly provides.</p>
<p>All that said, there are different kinds of security that you might want to implement, and lots of different solutions to attain them.</p>
<h2>System Integrity</h2>
<p>System integrity is what most people mean when they say &#8220;secure my system&#8221;. Do you want system integrity? The answer is almost always yes. Some people want very good system integrity and end up using a read only medium, like a livecd or dvd, to run their systems. This, of course, only works if you aren&#8217;t storing important data on those systems, for things like web front ends to applications servers it might work fine.</p>
<p>System integrity is what OpenBSD users mean when they say they have a secure system. They integrate quality control into their development process to ensure that as few bugs as possible get into their code and the result is suppose to be high system integrity.</p>
<p>Quality control alone doesn&#8217;t give you complete system integrity, however. Your kernel can be well coded but that doesn&#8217;t mean much if other processes running as root are vulnerable. Just take a look at ps and see how many applications are running as root. If any of those services are vulnerable your system may have less integrity than previously thought. The fact is everyone runs third party apps on their UNIX/Linux systems. Most users run Apache, samba, syslog, etc and all have components running as root. Even OpenBSD isn&#8217;t without vulnerabilities, quality control only goes so far, after that more is necessary.</p>
<p>Memory protection techniques can help protect against some of these vulnerabilities. NX support on modern processors prevent some exploits that use bugs to add shellcode to  running applications but that won&#8217;t prevent someone from using code already present in the address space, such as system(). Memory layout randomization only provides stop gap protection since the layout can eventually be brute forced, if the administrator isn&#8217;t watching very closely.</p>
<p>Mandatory access control is a way of addressing the gaps between a well coded kernel and vulnerable third party applications. If Apache shouldn&#8217;t be able to write to anything in /usr then MAC can prevent that. This, by itself, is a huge win for system integrity since it is generally thought that /usr is the highest integrity part of the system.</p>
<p>Now for some explanation. On most systems you can think of integrity as either low or high. High integrity files are files that are system objects. Things in /usr are pretty much all system objects. If a system object gets changed the behavior of the system is changed. A rootkit is going to target these high integrity files, for example. Other examples of high integrity objects are, ofcourse, anything in /boot, /lib, /sbin, /bin, most files in /etc, and so on. User files, on the other hand, are generally low integrity files. Anything in /home is untrusted. User data should never be able to affect the integrity of the system.</p>
<p>The integrity of a process is determined simply by where it gets its input. If a process reads user data, or data off of an untrusted network it is considered low integrity. Apache, which reads /home/*/public_html and receives queries from the internet, is low integrity. RPM, which is run by the administrator, reads rpm&#8217;s downloaded from your vendor (hopefully) and installs files all over the system, is high integrity (this is an assessment of how it operates, not whether it is free of vulnerabilities).</p>
<p>Now that you know how to determine the integrity level of objects and processes lets talk about the security policy to maintain system integrity. Biba is a hierarchical integrity policy, similar to Bell LaPadula but, interestingly, the exact opposite. It allows processes to both read and write to objects of the same integrity, no surprises there. Next it allows high integrity processes to write to low integrity objects, but not read them and last it allows low integrity processes to read high integrity objects but not write them.</p>
<p><img alt="Biba" title="Biba" src="/images/biba.png" /></p>
<p>Though the use of Biba is very limited and has never hit a mainstream operating system it is a very good practice, if implemented in a usable way. The standard SELinux policies implement something between Biba and &#8216;least privilege&#8217;, with a nice balance to ensure system integrity without making the system completely unusable. Biba, for example, isn&#8217;t very flexible. Since processes and objects are simply labeled with their integrity there is no way to make practical changes to the policy. You either fall within the constraints of Biba or you are entirely MAC exempt.</p>
<p>The SELinux Apache policy doesn&#8217;t allow Apache to write to the high integrity files we talked about above (/usr, /lib, /bin, etc) while allowing it to write to its logs, its cache, etc. Since objects in SELinux have fine grained labeling we can restrict access to apache high integrity objects, such as apache modules, the apache configuration and so on. In many ways SELinux lets us constrain applications more than Biba while at the same time making practical exceptions when necessary. This brings me to my next kind of security.</p>
<h2>Application and Data Integrity</h2>
<p>While system integrity is generally of the utmost importance, since it is the basis on which you can build other security goals, in some cases it is not enough. Sometimes the most important part of a system is the applications it is running, or the data those applications manage.</p>
<p>For example, if you are running a database server the most important part of the system quite possibly could be the data in that database. How do you protect that data?</p>
<p>We can go back to the mantra of well coded systems with quality control but that, once again, fails when you consider other applications running on the system. Granted you&#8217;ll need to trust the database server itself with the data, there is no way around that but the other applications that can access the data can be problematic. Generally database files would be owned by a non-root user with the correct permissions set to prevent other applications from accessing them without going through the database server. Of course root applications can bypass all those restrictions.</p>
<p>There are multiple ways to protect the data. One way is run only the database server on the system and nothing else. That way there is nothing else to protect the data from. This can work in well controlled environments but there are always going to be apps running, like the system logger and sometimes, particularly on UNIX like systems, there is a tendency to put multiple applications on a single system. There will always be the need for backup apps, log monitors, log rotators, etc. This may be a risk you are willing to take, and that is what threat modeling is all about. If you can accept the risk then your security may already meet your needs.</p>
<p>Another way people have tried recently is with hypervisors. Unfortunately the current generation of hypervisors always require a domain 0 or host OS that essentially has full access to the disk, the network interfaces, sometimes the memory, etc. Protecting the integrity of applications within a VM is impossible without first doing so on the host OS, as I pointed out in my <a title="Why Blu-Ray scares me" href="http://securityblog.org/brindle/2008/01/24/why-blu-ray-scares-me/">Blu-ray post</a>.</p>
<p>MAC systems are IMHO a superior way to handle application and data integrity. SELinux policies can prevent anyone from accessing the database files aside from the database server itself. You may need the backup service to read the database files directly (unless it is configured to get backups directly from the database server itself) but you can easily make the backup server only able to read files without being able to write them, which is not something you can easily do without MAC.</p>
<h2>Pipelines</h2>
<p>Another security goal which is often overlooked outside of a small niche of guard architects are pipelines. Guards are systems with specific purposes to transfer data from one side to another, while going through a specific set of applications. In the real world one can envision a proxy server or a virus scanning email server as a guard. The idea is that data coming into a system must go through some number of applications before it is allowed to proceed.</p>
<p><img alt="pipeline" title="pipeline" src="/images/pipeline.png" /></p>
<p>In this security goal it is desired that any incoming email goes through a virus and spam filter before going on to the user mail directory and ultimately onto the end users system. This may be more of a functional goal than a security goal to some. As a former administrator I understand the security ramifications of unfiltered email getting through to the network. This kind of goal is generally enforced with configuration of the mail system but for some people that is not enough.</p>
<p>Pipelines obviously rely on system integrity to protect the layer below the pipeline itself, so those security goals are composed onto one another. An opensource project that my company developed called CDS Framework implements this sort of security goal.</p>
<h2>Conclusion</h2>
<p>There are other security goals one can implement, these are only examples. The first two are probably the most important for most users. The main thing I want people who read this to take away is that there is no such thing as a &#8217;secure system&#8217; or &#8216;added on security&#8217; or &#8216;baked in security&#8217;. Security by itself doesn&#8217;t mean anything. Users need to determine their threat model and security goals in order to determine what measures need to be taken in order to protect what they want protected.</p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2008/03/30/secure-doesnt-mean-anything/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why Blu-Ray scares me</title>
		<link>http://securityblog.org/brindle/2008/01/24/why-blu-ray-scares-me/</link>
		<comments>http://securityblog.org/brindle/2008/01/24/why-blu-ray-scares-me/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 02:30:54 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[bd+]]></category>

		<category><![CDATA[bluray]]></category>

		<category><![CDATA[DRM]]></category>

		<category><![CDATA[virtual machine]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2008/01/24/why-blu-ray-scares-me/</guid>
		<description><![CDATA[Now that Blu-Ray has all but won the HD format war I guess its a little late to post this but oh well, I&#8217;ll do it anyway.
Disclaimer: I am an HDDVD owner but this post is not a result of  bitterness about my chosen format losing. The reason I&#8217;m posting here about (among others) [...]]]></description>
			<content:encoded><![CDATA[<p>Now that Blu-Ray has all but won the HD format war I guess its a little late to post this but oh well, I&#8217;ll do it anyway.</p>
<p>Disclaimer: I am an HDDVD owner but this post is not a result of  bitterness about my chosen format losing. The reason I&#8217;m posting here about (among others) is the actual reason I chose HDDVD. I also don&#8217;t want to talk about the pro&#8217;s and con&#8217;s of DRM or whether the DRM has been cracked and is accessible via other means. I am going to talk about the intentions of the format producers and what it means to consumers.</p>
<p><span id="more-21"></span><br />
So, basically the big security problem I have with Blu-Ray is that <a title="BD+" href="http://en.wikipedia.org/wiki/BD%2B" target="_blank">BD+</a> (a BluRay specific DRM mechanism) has some scary provisions to make movie producers happy. Basically the idea behind BD+ is that the movie, decoding, etc is done from within a virtual machine.</p>
<p>So the problem with using a virtual machine to protect the data from the person who owns the device is that the host inherently can access and manipulate the virtual machine itself, including the data. This presents a fundamental problem with the idea of protecting the content. So in order to address this the movie producer must be satisfied that the host machine is in a state where the virtual machine is considered safe.</p>
<p>This is where BD+ gets scary. It allows movie producers to package arbitrary host executables with the BD+ virtual machine that is run on the player before the virtual machine unencrypts any content. The idea, of course,  is that a vulnerable host (that is, a host that allows unauthorized access to the unencrypted content) can be patched in order to close the vulnerability. This has some serious ramifications including, but not limited to, producers being able to rootkit machines (see sony&#8217;s recent rootkit fiascos), spyware, broken patches that make systems more vulnerable, broken patches that break machines, patches that affect different OS releases differently, etc.</p>
<p>I almost wish a producer would create a PS3 patch that bricks a bunch of PS3&#8217;s just to show how very very dangerous &#8220;features&#8221; like this are.</p>
<p>So that is one of the features that scared me the most. There are other problems I had that caused me to choose HDDVD such as incomplete specifications for BluRay, fewer features in the original specifications, limits on the layering of the disks and so on. I now have a dilemma about whether to get a BluRay player knowing that, as a consumer, the choices I make validate the behavior of the producers. The most disturbing fact is that the consumers who don&#8217;t know about these issues have implicitly allowed the format producers and movie producers to build this incredibly anti-consumer system. C&#8217;est la vie I suppose.</p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2008/01/24/why-blu-ray-scares-me/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Misunderstanding UNIX security</title>
		<link>http://securityblog.org/brindle/2007/07/15/misunderstanding-unix-security/</link>
		<comments>http://securityblog.org/brindle/2007/07/15/misunderstanding-unix-security/#comments</comments>
		<pubDate>Sun, 15 Jul 2007 17:12:38 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[apparmor]]></category>

		<category><![CDATA[mandatory-access-control]]></category>

		<category><![CDATA[path-based-access-control]]></category>

		<category><![CDATA[selinux]]></category>

		<category><![CDATA[selinux-symposium]]></category>

		<category><![CDATA[unix-security]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2007/07/15/misunderstanding-unix-security/</guid>
		<description><![CDATA[I just got a comment on my post about path based access control that was fairly startling to me. The more I thought about it, though, the more I thought maybe others shared the beliefs so I&#8217;m going to respond to it here.
inode-based security has analogous problems to path-based security.  Software opens paths, not [...]]]></description>
			<content:encoded><![CDATA[<p>I just got a comment on my post about path based access control that was fairly startling to me. The more I thought about it, though, the more I thought maybe others shared the beliefs so I&#8217;m going to respond to it here.</p>
<blockquote><p>inode-based security has analogous problems to path-based security.  Software opens paths, not inodes, so it very much matters what the permissions are for the file at /etc/shadow or /var/data/mydb, regardless of what the inode happens to be.  With an inode-based system, security may go out the window when programs replace or manipulate inodes, as many of them do.</p></blockquote>
<p>Software opens paths because paths are the exposed abstraction for userspace applications. Sure it matters what permissions are on /etc/shadow, but those permissions and the access control alike is <strong>always</strong> done at the inode level, as I will demonstrate below. Applications that manipulate inodes have always needed to set security attributes on those inodes, look at passwd source code and you will see that it creates the inode with mode 400 (r&#8212;&#8212;&#8211;).</p>
<blockquote><p>So, neither AppArmor nor SELinux provide bullet proof security or data integrity, although both may be useful in protecting against some problems.</p></blockquote>
<p>This is blatantly wrong,  SELinux provides controls to specify precisely how things can be labeled. If my policy does not allow an application that handles confidential information to relabel or create a file with a label that is accessible by other applications there are no circumstances where that application will be able to leak the data. Similarly if an application can&#8217;t read low-integrity data and write to high-integrity files there are no circumstances where the application can harm the data integrity. I suggest you read some of the papers about SELinux policy analysis and information flow to understand the issues and how SELinux can address them. Many are available at the <a href="http://selinux-symposium.org">SELinux symposium website</a>.</p>
<blockquote><p>But arguments like the ones in this blog really make me doubt whether the SELinux people even understand the issues or have much of a notion of how files and security work on real-world UNIX systems.</p></blockquote>
<p>As much as I&#8217;d like to ignore people using ad hominum attacks there may be others under this impression. Note the following demonstration as a counter example:</p>
<pre># ls -al /etc/shadow
-r-------- 1 root root 947 2007-06-06 03:40 /etc/shadow</pre>
<pre># ln /etc/shadow /tmp/shadow
# ls -al /tmp/shadow
-r-------- 2 root root 947 2007-06-06 03:40 /tmp/shadow</pre>
<pre># chmod 777 /tmp/shadow
# ls -al /etc/shadow
-rwxrwxrwx 2 root root 947 2007-06-06 03:40 /etc/shadow</pre>
<p>It should be clear at this point that the UNIX permissions absolutely do not have anything to do with paths, only with inodes. This is how real-world UNIX systems have always worked, path based mechanisms break that convention and are subject to the issues I&#8217;ve noted in the path based article. The simple fact is that UNIX systems never ever use paths to determine access to anything, access control has always been centered around inodes and permissions set on inodes. Do not think that the existance of paths changes that, these are merely an abstraction to make userspace more useful.</p>
<p>The arguments against SELinux by the AppArmor people, and others, are purely functionality based arguments. They want to use paths because paths are easy to understand and paths have conventions that can be reflected in their policy (eg., that passwords are always stored in /etc/shadow and therefore that file should be protected). SELinux provides mechanisms to enforce many different security policies including protecting /etc/shadow and /var/data/mydb.</p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2007/07/15/misunderstanding-unix-security/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Secure Networking with SELinux</title>
		<link>http://securityblog.org/brindle/2007/05/28/secure-networking-with-selinux/</link>
		<comments>http://securityblog.org/brindle/2007/05/28/secure-networking-with-selinux/#comments</comments>
		<pubDate>Mon, 28 May 2007 17:51:26 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[mandatory-access-control]]></category>

		<category><![CDATA[networking]]></category>

		<category><![CDATA[opensource]]></category>

		<category><![CDATA[selinux]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2007/05/28/secure-networking-with-selinux/</guid>
		<description><![CDATA[During the last year quite a bit of effort has gone into improving SELinux’ networking support, thanks to the great SELinux community. While this support is still evolving it will be very beneficial for people to try it out and give feedback so the final result is useful to more users and meets the security [...]]]></description>
			<content:encoded><![CDATA[<p>During the last year quite a bit of effort has gone into improving SELinux’ networking support, thanks to the great SELinux community. While this support is still evolving it will be very beneficial for people to try it out and give feedback so the final result is useful to more users and meets the security needs of a wider audience. As the network support in SELinux continues to evolve (there are already other ideas being discussed for possible inclusion) I’ll try to keep this post updated so that people who find it will have the latest information available.</p>
<p><span id="more-19"></span></p>
<p>Network support in SELinux means many things. In the old days (“old days” is very relative since it was only a few kernel releases back at this point) SELinux had fine grained network access control by way of many object classes. These object classes were netif (network interfaces), node (network addresses) and a handful of socket object classes (such as tcp_socket, udp_socket, rawip_socket and so on).</p>
<p>The SELinux policy directly labeled several kinds of network objects including interfaces (using netifcon), internet nodes (using nodecon) and ports (using portcon). The policy statements looked something like these:</p>
<p><code> netifcon eth0 system_u:object_r:external_netif_t system_u:object_r:external_packet_t </code></p>
<p><code>nodecon 192.168.1.1 255.255.255.255 system_u:object_r:external_node_t; portcon tcp 21 system_u:object_r:ftp_port_t ; </code></p>
<p>These labeled objects could then be given access to with normal SELinux rules:</p>
<p><code> allow ftpd_t external_netif_t : netif {tcp_send tcp_recv }; </code></p>
<p><code>allow ftpd_t external_node_t : node { tcp_send tcp_recv }; </code></p>
<p><code>allow ftpd_t ftp_port_t : tcp_socket { send_msg recv_msg name_bind }; </code></p>
<p>These basically gave ftpd_t the ability to bind to port 21, send and receive tcp messages on port 21 and send and receive tcp messages on eth0 (whose ip was 192.168.1.1). These worked fine, the only problem is that they weren’t specified in a single rule so they weren’t coupled. This means if there was another set of rules that let ftpd_t send and receive dns packets (for name resolution) only on the internal interface they could also send and receive dns packets on the external interface by virtue of the rules above. Note that these access controls can still be used en lieu of the ones I’m going to talk about next by setting the compat_net option in SELinux with echo 1 > /selinux/compat_net.</p>
<p>The labeling of these objects was eventually added to libsemanage and could be changed on end systems using the semanage command without modifying policies.</p>
<p>During the 2006 SELinux Symposium Developer Summit we discussed ideas on making the network labeling easier to use, more able to support typical network restrictions and most importantly to closely bind the interface, address and port. Fortunately for us netfilter in Linux already supports all these things as well as some additional benefits like connection tracking that can be used to more precisely restrict things that use dynamic ports such as ftp.</p>
<p>One may be thinking that the easiest way to handle this is to add a domain specifier to iptables so that one could write a rule that matched the SELinux domain as well as the ports, network interface and addresses to allow only ftp packets to reach ftpd_t. This would have decentralized the SELinux policy, however, by moving part of the decision making out of the SELinux security server and into the iptables policy and subsystem. This is generally undesirable as we’d like to keep a single, centralized, analyzable SELinux policy. That essentially left us with using netfilter and iptables to label packets, which would have SELinux allows rules written to allow or deny access. Lets look at how this might be used:</p>
<p><code> iptables -A INPUT -t mangle -p tcp --dport 21 -j SECMARK --selctx system_u:object_r:ftp_packet_t </code></p>
<p>This labels packets destined for port 21 as ftp_ packet_t. The SELinux rule that allows ftpd_t send and receive packets of this type is simply:</p>
<p><code> allow ftpd_t ftp_packet_t : packet { send recv }; </code></p>
<p>But this doesn’t do anything more than the old network controls did, lets look at something more interesting:</p>
<p><code> iptables -A INPUT -t mangle -p tcp --dport 21 -i eth0 -s 192.168.0.1/24 -j SECMARK –-selctx system_u:object_r:ftp_packet_t </code></p>
<p>This labels only packets on eth0, coming from 192.168.0.1/24 and on tcp port 21 as ftp_packet_t. So this has the advantage of being able to couple anything that netfilter supports together. Another iptables rule such as:</p>
<p><code> iptables -A INPUT -t mangle -m state --state RELATED,ESTABLISHED -j CONNSECMARK –restore </code></p>
<p>will copy the label for related packets so when an ftp client attempts a file transfer the related port (which is dynamically assigned at the time of the transfer) will receive the same label. This takes advantage of netfilter’s connection tracking features to allow ftp to only receive packets related to its connections. This requires no additional policy rules or policy modifications of any kind since the labels are all we are changing.</p>
<p>What this brings over netfilter’s existing functionality is the ability to specify precisely which domains can access which packets, so it allows you to bring the firewall functionality all the way to the processes rather than just to the machine, which is significant if you have several services of differing security properties running on the same machine. This would, for example, allow you to have an internal Apache instance with access to company confidential data to only be accessible internally and another external Apache instance that serves static web content to the internet.</p>
<p>While most people think of network access controls in the terms of firewalls alone this is not the only network support in SELinux. The next kind of SELinux network support is labeled networking.</p>
<p>There are two methods of labeling network traffic in SELinux: NetLabel, which is an implementation of CIPSO, and IPSec based labeling. I’m not going to talk about NetLabel because it only supports the MLS portion of the SELinux context and is primarily useful for making SELinux cooperate with legacy trusted operating systems like Trusted HP-UX and Trusted Solaris. IPSec based labeling sends the entire context but currently only works between SELinux systems.</p>
<p>As NetLabel is primarily for supporting MLS and legacy trusted systems I’m not going to talk about it, lets instead move to IPSec based labeling.</p>
<p>I’m going to assume some knowledge of IPSec here so if you are unfamiliar with some of the terms please consult IPSec documentation. In particular you need to know what SPD&#8217;s and SA&#8217;s are and what their role in IPSec is.<br />
The first thing you need is a kernel that supports IPSec labeling. The easiest way (if you are using Red Hat) is to use the current Fedora rawhide kernel or the LSPP kernel. The LSPP kernel is available at <a href="http://people.redhat.com/sgrubb/files/lspp/">http://people.redhat.com/sgrubb/files/lspp/</a>. For the non-Red Hat users in the audience labeled IPSec is also available in the released version of linux-2.6.22.</p>
<p>You’ll also need an ipsec-tools that is capable of labeling, rawhides or the LSPP version will do here as well. Once you have everything you need installed you can start using labeled IPSec. We’ll start with simple labeled SA’s.</p>
<p>First I have a couple programs that will help test and ensure that everything is working. They are simple a simple client and server that connect, use getpeercon() to return what the context of the network socket is.</p>
<p><a href="/src/client.c">client.c</a></p>
<p><a href="/src/server.c">server.c</a></p>
<p>Build these by linking them against libselinux:</p>
<p><code>gcc -o client client.c -lselinux</code></p>
<p><code>gcc -o server server.c -lselinux</code></p>
<p>First lets try running them without IPSec to see what happens:</p>
<p>My test machines are 192.168.147.132 (scarecrow) and 192.168.147.130 (poisonivy), obviously replace with your addresses.</p>
<p>After running server on 192.168.147.132 and running client 192.168.147.132 on the other machine the output should look like this:</p>
<p><code>[root@poisonivy ~]# ./client 192.168.147.132 </code></p>
<p><code>getpeercon: Protocol not available Received: Hello, (null) from (null)</code></p>
<p><code> [root@scarecrow ~]# ./server </code></p>
<p><code>getsockopt: Protocol not available server: got connection from 192.168.147.130, (null) </code></p>
<p>getpeercon() returns protocol not available because no labeling was enabled on this connection, you can use the error to determine if you are using a labeled network socket or not.</p>
<p>If we make an SA between these 2 machines without specifying a context we’ll get the same results:</p>
<p><code> [root@scarecrow ~]# cat dev/ipsec/setkey.scarecrow.test  </code></p>
<p><code>spdflush; </code></p>
<p><code>flush;  </code></p>
<p><code>spdadd 192.168.147.130 192.168.147.132 any</code></p>
<p><code>    -P in ipsec         esp/transport//require;  </code></p>
<p><code>spdadd 192.168.147.132 192.168.147.130 any </code></p>
<p><code>    -P out ipsec         esp/transport//require; </code></p>
<p><code>[root@poisonivy ~]# cat dev/ipsec/setkey.poisonivy.test  </code></p>
<p><code>spdflush; </code></p>
<p><code>flush;  </code></p>
<p><code>spdadd 192.168.147.132 192.168.147.130 any  </code></p>
<p><code>    -P in ipsec          esp/transport//require;   </code></p>
<p><code>spdadd 192.168.147.130 192.168.147.132 any  </code></p>
<p><code>    -P out ipsec          esp/transport//require; </code></p>
<p>Then run:</p>
<p><code> [root@poisonivy ~]# setkey -f dev/ipsec/setkey.poisonivy.test       </code></p>
<p><code> [root@scarecrow ~]# setkey -f dev/ipsec/setkey.scarecrow.test </code></p>
<p>NOTE: both machines will need to be running racoon in order to create SA&#8217;s when the connections are attempted.</p>
<p>Running server and client the same as before will give the exact same results. You can use setkey -D to see the newly created SA’s. Notice that the SA&#8217;s are not be labeled.</p>
<p>If we add a -ctx statement to our setkey files such that:</p>
<p><code> [root@scarecrow ~]# cat dev/ipsec/setkey.scarecrow.test  </code></p>
<p><code>spdflush; </code></p>
<p><code>flush;  </code></p>
<p><code>spdadd 192.168.147.130 192.168.147.132 any </code></p>
<p><code>    -ctx 1 1 "system_u:object_r:default_t:s0"         </code></p>
<p><code>    -P in ipsec         esp/transport//require;  </code></p>
<p><code>spdadd 192.168.147.132 192.168.147.130 any </code></p>
<p><code>    -ctx 1 1 "system_u:object_r:default_t:s0"         </code></p>
<p><code>    -P out ipsec         esp/transport//require; </code></p>
<p>You can use setkey -DP to see the SPD entries on each machine, note the context field in the entries.<br />
Repeat this with the other machines setkey file. Note that you&#8217;d never use default_t in a label, this is an example to show what happens. This is _NOT_ the label that will be used to create SA&#8217;s, this label will be used in a &#8216;polmatch&#8217; rule to see which SPD entries a domain can match to. This will be explained later.</p>
<p>Running setkey -f results in an error now:</p>
<p><code> [root@scarecrow ~]# setkey -f dev/ipsec/setkey.scarecrow.test  </code></p>
<p><code>The result of line 8: Permission denied. </code></p>
<p><code>The result of line 14: Permission denied. </code></p>
<p>Looking for the denial:</p>
<p><code> [root@scarecrow ~]# tail /var/log/audit/audit.log  | grep AVC </code></p>
<p><code>type=AVC msg=audit(1179150979.762:33): avc:  denied  { setcontext } for  pid=21632 comm="setkey" scontext=root:system_r:unconfined_t:s0-s0:c0.c1023 tcontext=system_u:object_r:default_t:s0 tclass=association type=AVC msg=audit(1179150979.895:34): avc:  denied  { setcontext } for  pid=21632 comm="setkey" scontext=root:system_r:unconfined_t:s0-s0:c0.c1023 tcontext=system_u:object_r:default_t:s0 tclass=association </code></p>
<p>This is good, it means that we can protect who sets the labels on IPSec SPD&#8217;s. For now set permissive mode on both machines and run setkey again, it should now succeed.</p>
<p>Run the client and server again and you should see something like this on the client side:</p>
<p><code> [root@poisonivy ~]# ./client 192.168.147.132     </code></p>
<p><code>Received: Hello, root:system_r:unconfined_t:SystemLow-SystemHigh from root:system_r:unconfined_t:-SystemHigh</code></p>
<p>You can use setkey -D  to see the newly created SA&#8217;s and note the context field in each entry.<br />
Hopefully this image conveys how the SA&#8217;s are labeled, note that each side of the connection has 2 SA&#8217;s, one incoming and one outgoing with the appropriate labels. The outgoing SA for each system is always the local domain, the incoming SA for each system is always the remote domain.<br />
<img alt="labeled ipsec" title="labeled ipsec" src="/images/ipsec.png" /><br />
I&#8217;d like to thank <a title="Chris Ashworth" target="_blank" href="http://smashworth.org">Chris Ashworth</a> for the graphic, it is much simpler than mine and I think gives a better understanding of the labeled tunnels.</p>
<p>This demonstrates that the server sees root:system_r:unconfined_t:SystemLow-SystemHigh when it calls getpeercon() and the client sees root:system_r:unconfined_t:-SystemHigh. To show the difference more specifically run the client with a different context using runcon:</p>
<p><code> [root@poisonivy ~]# runcon -t httpd_t ./client 192.168.147.132         </code></p>
<p><code>Received: Hello, root:system_r:httpd_t:SystemLow-SystemHigh from root:system_r:unconfined_t:-SystemHigh </code></p>
<p>Now you can see the server sees httpd_t when it calls getpeercon(). So now we&#8217;ve seen how you can identify the process context on the other side of a connection, but what about the policy?</p>
<p>Lets clear out dmesg and setenforce 1; setenforce 0; to clear the AVC and start the process over.</p>
<p>First running setkey and then audit2allow -d should show:</p>
<p><code> allow unconfined_t default_t:association setcontext; </code></p>
<p>This means that unconfined_t (what your shell normally runs as) tried to set the context of an association to default_t. This is expected since we used default_t in our SPD entry. Run dmesg -c to clear the kernel buffer and try to run the server and client (with runcon):</p>
<p>Removing the irrelevant rules we should see something like this on the client side:</p>
<p><code> allow httpd_t default_t:association polmatch; </code></p>
<p>This rule means that the client (running as httpd_t) attempted to match against the SPD entry we added earlier. This is useful because you can use SELinux policy to enforce which SPD entries a domain may match against. For example, if you wanted to have some domains use high quality encryption and let the others use a faster, lower quality encryption you can do that by specifying which SPD types a domain may polmatch against.</p>
<p><code> allow httpd_t self:association sendto; </code></p>
<p>This is httpd_t sending data to an association labeled httpd_t. This basically just means that it is sending to the association created for it. Note that with the current controls you can not control which domains you are sending to on the other side.</p>
<p><code> allow httpd_t unconfined_t:association recvfrom; </code></p>
<p>This is the most significant control; it says that we are allowing httpd_t to receive from an association labeled unconfined_t, which is the result of the server running in unconfined_t. This lets you use policy to determine which domains on another machine can send data to which domains on the local machine.</p>
<p><code> allow unconfined_t default_t:association polmatch; </code></p>
<p>And this is the remote domain (the server) matching against the income SPD entry on this machine. Note that there were 2 SPD entries added, one for outgoing communication and one for incoming communication, both domains have to polmatch the SPD&#8217;s on the local machine (for outgoing) and the remote machine (for incoming).</p>
<p>There should be similar denials on the server side, only reversed so I won&#8217;t go over those.</p>
<p>As you can see you can do a significant amount with this technology, assuming that you control both policies (source and destination) you can be very certain which domains are talking to which domains across machines, similar to the SELinux IPC controls but across a network!</p>
<p>For example, one possible application of this technology is to have an &#8216;internal&#8217; and &#8216;external&#8217; browser on employee workstations. The internal browser would run in a domain that is allowed to access internal company web application servers that contain confidential customer information while the external browser can access the internet. This reduces the risk that rogue internet content can compromise your internal data. This kind of separation would be much more difficult (or impossible) without SELinux&#8217; advanced networking controls.</p>
<p>Using both labeled IPSec and netfilter secmark you can do some pretty amazing things with SELinux networking, and its only going to get better, stay tuned for more information.</p>
<p>A special thanks goes out to all the people that worked hard on getting this technology where it is now and the same ones trying to push it even further to have the best secure networking infrastructure around. These people include (in no particular order): James Morris, Venkat Yekkirala, Joy Latten, Paul Moore (who implemented NetLabel), and many others.<br />
<a href="http://marc.info/?a=117803237000001&#038;r=1&#038;w=2" /></p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2007/05/28/secure-networking-with-selinux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Don&#8217;t disable SELinux!</title>
		<link>http://securityblog.org/brindle/2007/05/05/dont-disable-selinux/</link>
		<comments>http://securityblog.org/brindle/2007/05/05/dont-disable-selinux/#comments</comments>
		<pubDate>Sat, 05 May 2007 22:47:11 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[mandatory-access-control]]></category>

		<category><![CDATA[razor]]></category>

		<category><![CDATA[SAP]]></category>

		<category><![CDATA[selinux]]></category>

		<category><![CDATA[selinux-symposium]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2007/05/05/dont-disable-selinux/</guid>
		<description><![CDATA[A while back I wrote a post on companies telling their customers to disable SELinux in order to get applications running and why this is a very bad thing. While I don&#8217;t see the situation getting better in the near term I did see a blog posting today from an SAP employee about using SELinux [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I wrote <a target="_blank" href="http://securityblog.org/brindle/2006/05/21/software-not-working-disable-selinux/">a post</a> on companies telling their customers to disable SELinux in order to get applications running and why this is a very bad thing. While I don&#8217;t see the situation getting better in the near term I did see a <a target="_blank" href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6453">blog posting today from an SAP employee</a> about using SELinux with SAP. This made me happy <img src='http://securityblog.org/brindle/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Since I don&#8217;t think his blog software uses trackbacks I&#8217;ll be contacting him to suggest some changes. Namely he says that SAP would not be able to send SELinux policy modules with their software to customers since it apparently gets installed in many different places.</p>
<p>I&#8217;d first like to mention to him (and anyone else reading this) that SELinux policy does not care about paths, only types. The policy part of the module can be the same for every SAP customer, specifying the exact interactions between their software and the rest of the system. The file context part of the module is not compiled and can be generated at install time and added to the policy they distribute with the semodule_package command. After installing the module and labeling the SAP related files everything should work the same.</p>
<p>Next I&#8217;d like to mention that, while this is a noble effort and I&#8217;m very happy to see enterprise vendors showing their customers how they can use SELinux, this article essentially tells people to audit2allow the SAP related denials into policy without reviewing exactly what those denials were or whether they were appropriate. My <a target="_blank" href="http://securityblog.org/brindle/2006/03/25/security-anti-pattern-status-quo-encapsulation/">status quo encapsulation article</a> is an analysis of this style of policy writing and why it is bad.</p>
<p>If a SAP engineer wanted to create a policy for SAP applications that implemented proper security objectives and have that added to the reference policy I&#8217;m sure we&#8217;d be more than happy to add it in. There are other options though. IBM has been working with my company, <a target="_blank" href="http://www.tresys.com">Tresys</a>, to develop a product, <a target="_blank" href="http://tresys.com/products/razor.html">Razor</a>, that takes generates policy for Websphere and DB2 by using configuration files that are understandable by the administrators of said applications. More information on the technique that Razor uses to create policies is available in a <a target="_blank" href="http://selinux-symposium.org/2006/slides/05-websphere.pdf">case study</a> from the 2006 <a target="_blank" href="http://selinux-symposium.org/">SELinux Symposium</a>. This product can be used to generate policy for all kinds of enterprise applications, including presumably SAP, that implement specific security goals instead of just encapsulating the status quo of the application.</p>
<p>All that said, I&#8217;m still glad to see some companies taking initiative and trying to work with their customers instead of against them.</p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2007/05/05/dont-disable-selinux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SELinux training</title>
		<link>http://securityblog.org/brindle/2007/04/19/selinux-training/</link>
		<comments>http://securityblog.org/brindle/2007/04/19/selinux-training/#comments</comments>
		<pubDate>Thu, 19 Apr 2007 23:00:28 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[mandatory-access-control]]></category>

		<category><![CDATA[selinux]]></category>

		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2007/04/19/selinux-training/</guid>
		<description><![CDATA[My employer, Tresys Technology, occasionally hosts an SELinux training class, many of which I&#8217;ve been the teacher for. The course outline and slides are available for free at http://tresys.com/selinux/selinux-course-outline.html but that isn&#8217;t what this post is about.
I&#8217;ve been asked if I think many people would pay to take an online shorter version of the class [...]]]></description>
			<content:encoded><![CDATA[<p>My employer, Tresys Technology, occasionally hosts an SELinux training class, many of which I&#8217;ve been the teacher for. The course outline and slides are available for free at <a target="_blank" href="http://tresys.com/selinux/selinux-course-outline.html">http://tresys.com/selinux/selinux-course-outline.html</a> but that isn&#8217;t what this post is about.</p>
<p>I&#8217;ve been asked if I think many people would pay to take an online shorter version of the class if it were around $500. I wasn&#8217;t sure how to answer so I decided to ask the people that read my blog what they think. It would be an 8 hour video or slide version of the course available on the web. If not many people would take the class another option is to have a 1 hour free webinar that talks about how SELinux can be useful to commercial enterprises that IT people could use to learn some basics about what SELinux can do.</p>
<p>I&#8217;d like some feedback on these ideas but in any case you can come see me teach a tutorial in person at Linux World Expo - San Francisco in August.</p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2007/04/19/selinux-training/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Future of SELinux (or how we are going to take over the world)</title>
		<link>http://securityblog.org/brindle/2006/08/24/the-future-of-selinux-or-how-we-are-going-to-take-over-the-world/</link>
		<comments>http://securityblog.org/brindle/2006/08/24/the-future-of-selinux-or-how-we-are-going-to-take-over-the-world/#comments</comments>
		<pubDate>Thu, 24 Aug 2006 22:25:14 +0000</pubDate>
		<dc:creator>method</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[mandatory-access-control]]></category>

		<category><![CDATA[opensource]]></category>

		<category><![CDATA[selinux]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2006/08/24/the-future-of-selinux-or-how-we-are-going-to-take-over-the-world/</guid>
		<description><![CDATA[I&#8217;ve been talking to a few people about what SELinux might look like in a few years and the conversations have been fairly stimulating so I&#8217;m going to share some of the ideas here.
As you (hopefully) know in my day job I work on the SELinux policy server, which as far as I know, is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been talking to a few people about what SELinux might look like in a few years and the conversations have been fairly stimulating so I&#8217;m going to share some of the ideas here.</p>
<p>As you (hopefully) know in my day job I work on the <a target="_blank" title="SELinux policy server" href="http://sepolicy-server.sf.net">SELinux policy server</a>, which as far as I know, is the most forward looking SELinux project around. Granted all those forward looking goals aren&#8217;t published on the site, hopefully we can remedy that at some point.. So alot of this is going to be centered around the policy server, other parts are just on my wishlist.. without further ado lets get started&#8230;<br />
<span id="more-16"></span><br />
I think the absolute most important thing that needs to happen is that SELinux needs to become part of the system, not a strap on, not a value add, not an extra burden, it must be part of the system. There are a ton of things that need to happen for that to happen, most of the desires below will, in some way, reflect on this main goal.</p>
<p>First and foremost we need complete protection. Its been said many times in the past and its still true. If SELinux desktop deployments are ever going to be entirely secure a security enhanced X server is necessary. Without it even a confined mail client or web browser can use the X protocol to manipulate or otherwise hijack other applications running in X. This isn&#8217;t something that can be solved any way except by making X an object manager. This work has been done, I personally have run a security enhanced X server for extended periods of time but without a proper integration into upstream and proper deployment by distributions it won&#8217;t help. In addition to the enhanced X server the window manager must be SELinux aware. This means that the window manager is capable of launching applications in different domains, managing clipboard data and ensuring it doesn&#8217;t allow information to be leaked from one domain to another without permission and many other things. Once these two things are in place we are well on our way toward SELinux utopia.</p>
<p>One of my biggest desires is to use SELinux to its potential and make the root user powerless by default. Ubuntu has started on this path already, making the root user not able to login and forcing users to use sudo to do administrative tasks. This is a disruptive concept that many many people won&#8217;t like but it must happen. Once the root user is powerless by default SELinux roles are used to manage administrative tasks and grant only what is necessary to each user, which brings me to my next point.</p>
<p>Fine grained role management is an absolute must. The SELinux reference policy already has concepts that will allow this to be implemented in the (hopefully) near future. Each policy module should export some sort of role capabilities (not to be confused with Linux or POSIX capabilities) that can be granted by the system administrator. For example, the Apache module should have an interface that, when invoked, gives a role authorization to administer Apache, whatever that means. Once the policy is running on the system the administrator should be able to specify the precise capabilities that any role is able to use. This brings me to my next point.</p>
<p>The user management and selinux role and user management must be unified. An administrator should absolutely not need to go to a different application or dialog box to give a user that he just created extra SELinux privileges. SELinux must be a first class citizen of the system. In the user management interface the SELinux options must be present and easily usable. For example, my small company just hired a new junior admin. I want this admin to administer a handful of daemons, including apache. The interface where I create him as a user should have a very obvious way of customizing his roles capabilities (this depends on the fine grained role management). Everything about the system must be unified, which, again, is my main point, SELinux must be part of the system, not an addon.</p>
<p>When I want to adjust my firewall settings SELinux settings should be present. We already know that SELinux is capable of much more fine grained network controls, specifically that you can specify specific domains that can access the network in specific ways. The example I want to use here is Firefox.  I want my enterprise to enforce that each workstation must have two web browsers, one that is intranet only and one that is internet. This will allow me to prevent any kind of Firefox exploit from touching my internal network. The network management should be able to let me specify that I want two Firefox domains with different network access controls. We&#8217;ll put two firefox icons on the desktops and SELinux will take care of the rest.</p>
<p>We shouldn&#8217;t just have fine grained access of client sessions though. One of the biggest problems plaguing the Internet is that web servers are notoriously insecure. When a random untrusted user&#8217;s PHP scripts are allowed to run in the same domain as trusted system scripts there is clearly a problem. Apache should be able to bracket privileges of user and system scripts, or even fine grained bracketing between different classes of users. The most secure and effective way to do this is to execute interpreters per target domain. FastCGI basically does this for DAC already. When a user&#8217;s script is accessed FastCGI determines if there is already an interpreter running as that UID that can handle the request, if not it will spawn one. We need to take this one step further and make a system like FastCGI spawn interpreters per UID per domain. This would make an enormous difference in the security of webservers and should be the default configuration. Alternatively for people who truly have performance requirements Apache chould use dynamic transitions to bracket privileges, though I don&#8217;t suggest this as a permanent mode of operation.</p>
<p>Speaking of privilege bracketing, it would be very nice for other applications to do this as well. The systems package manager (we&#8217;ll assume RPM for now) should be able to do a few things. The proper RPM process will have access to do pretty much anything, thats a given. That doesn&#8217;t mean, for example, that arbitrary scripts that execute as part of the install process should have unlimited access to the system. RPM is already able to execute scriptlets in a different domain so we are partially there. One interesting thing I&#8217;d like to see is RPM being able to treat &#8216;trusted&#8217; and &#8216;untrusted&#8217; packages differently. We&#8217;ll assume packages coming from the distro are trusted and third party ones are untrusted. An untrusted RPM should be much more restricted on the system, both the scriptlets and the RPM process itself. An untrusted application shouldn&#8217;t be able to overwrite high integrity binaries or configuration files (think /usr/bin/passwd and /etc/shadow) or label files with high integrity labels (like passwd_exec_t). Firther the scriptlets should not be able to overwrite files on the filesystem or any of the other nasty things scriptlets like to do. This is disruptive as well since there are probably about a million RPM packages around that do seriously questionable things.</p>
<p>Since RPM also installs SELinux policy the same bracketing should apply there. Using the policy server one should be able to restrict the kind of policy an untrusted RPM can insert (while still allowing them to insert policy for the application being installed). For example a third party RPM like Opera (hypothetically ofcourse) should be able to install the browser policy but should not be able to add rules that let it (or anything else for that matter) access /etc/shadow. Nor should be allowed to overwrite any system binaries or libraries. A production ready policy server (we are working on this, I promise <img src='http://securityblog.org/brindle/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) and an effective metapolicy would be necessary for this requirement.</p>
<p>Since one of the most critisized aspects of SELinux is its inability to apply fine grained controls to network filesystem this should also be added. This is alot more complicated than it seems at first, the network protocol should be sufficiently protected enough that the file labels sent across can be trusted. The client and server must also agree on an access control policy otherwise unexpected things can result. The client won&#8217;t be able to subvert the policy on the server side but since many network filesystems are caching the user might not understand why a write succeeds but is reverted when the client flushes its cache to the server. Network security servers like Samba should be able to take advantage of SELinux by applying access controls to the incoming clients.</p>
<p>SELinux management, up until now, has been very focused on the policy itself. This isn&#8217;t how administrators or users think, however. If someone wants to give user bill write access to a file in /usr/local/bin/bills-script he won&#8217;t think to go to a policy, he&#8217;ll instinctualy go to either the object itself (/usr/local/bin/bills-script) or to bill in the user manager. Either interface should be able to manage SELinux permissions. Chances are most people aren&#8217;t going to learn how to write SELinux policy (most people didn&#8217;t learn how to write sendmail.cf files and look what happened there!). Simple permission assignments like this should be taken care of by the SELinux management tools, and should be transparent (why do they care what needs to be done to give access, they just need it).</p>
<p>This solves some problems but most applications written are applications run within an organization which means there are going to be alot of applications running on SELinux systems that no policy developer has ever seen, or ever will. The process of writing a policy for these applications must be made significantly easier. I&#8217;ve <a target="_blank" title="status quo encapsulation article" href="http://securityblog.org/brindle/2006/03/25/security-anti-pattern-status-quo-encapsulation/">posted </a>about how bad status quo encapsulation is in the past but at this juncture an application running a status quo style policy is better than it running without one at all. The system should be able to write a policy for the application with very little interaction from the administrator. This will always leave the ability for more savy admins and users to write well thought out policies for their applications but we need an 80% way to write policies that will help the vast majority of people.</p>
<p>SETroubleshoot is a very good first step toward a widely usable SELinux but it needs to go even further. More targets need to be written for it so that it understands most denials. If most expected denials can be caught and dealt with the remaining denials may be indicative of an actual problem on the system, like an attack, something that an administrator should be notified of. By eliminating as many false positive denials as possible SELinux auditing could become useful as an early warning system for attempted intrusions and other bad things.</p>
<p>One of the most important things that SELinux can do is educate software developers and companies that their software is broken and how they can fix it. I allude to this in another <a target="_blank" title="blog article" href="http://securityblog.org/brindle/2006/05/21/software-not-working-disable-selinux/">blog article</a> but this will be the most help to the most people. If most systems are running SELinux and users tell vendors that disabling it isn&#8217;t an option that will force them to fix their software for the betterment of all of their users. I hope that this will be one of the most significant impacts SELinux can make on the entire industry for opensource applications, commercial applications and even internal applications.</p>
<p>Oh, one more thing, we need a really cool and secure looking framebuffer graphic that is shown during bootup, that way people know we are really secure <img src='http://securityblog.org/brindle/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2006/08/24/the-future-of-selinux-or-how-we-are-going-to-take-over-the-world/feed/</wfw:commentRss>
		</item>
		<item>
		<title>On AppArmor</title>
		<link>http://securityblog.org/brindle/2006/08/20/on-apparmor/</link>
		<comments>http://securityblog.org/brindle/2006/08/20/on-apparmor/#comments</comments>
		<pubDate>Sun, 20 Aug 2006 15:34:53 +0000</pubDate>
		<dc:creator>Joshua Brindle</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[apparmor]]></category>

		<category><![CDATA[mandatory-access-control]]></category>

		<category><![CDATA[opensource]]></category>

		<category><![CDATA[selinux]]></category>

		<guid isPermaLink="false">http://securityblog.org/brindle/2006/08/20/on-apparmor/</guid>
		<description><![CDATA[This will be the last thing I write about AppArmor because quite honestly it’s a waste of time to constantly refute people and I’d rather work to make security better for everyone :).
That said, I taught an SELinux tutorial at LWE San Francisco last week, unfortunately my tutorial wasn’t one of the ones reviewed by [...]]]></description>
			<content:encoded><![CDATA[<p>This will be the last thing I write about AppArmor because quite honestly it’s a waste of time to constantly refute people and I’d rather work to make security better for everyone :).</p>
<p>That said, I taught an SELinux tutorial at LWE San Francisco last week, unfortunately my tutorial wasn’t one of the ones reviewed by the media, what a shame. During the tutorial I was asked about AppArmor, to which I said they could come up after the tutorial to talk about it, I didn’t want to disparage it in front of an audience of 50, I’m a nice guy like that. <img src='http://securityblog.org/brindle/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Then I saw <a title="But our security goes to 11!" target="_blank" href="http://www.bress.net/blog/archives/36-But-our-security-goes-to-11!.html">this article</a>, which has a quite humorous title, which prompted me to go ahead and write up something that I can point to in the future.</p>
<p><span id="more-15"></span></p>
<p>If you’ve read <a target="_blank" href="http://securityblog.org/brindle/2006/04/02/top-down-vs-bottom-up-policy-development/">my</a> <a target="_blank" href="http://securityblog.org/brindle/2006/04/19/security-anti-pattern-path-based-access-control/">previous</a> <a target="_blank" href="http://securityblog.org/brindle/2006/03/25/security-anti-pattern-status-quo-encapsulation/">articles</a> you’ll see the great deal of technical problems AppArmor has and I can even add a few such as an incomplete reference validation mechanism, incomplete object model, the fact that it isn’t really mandatory access control (and thus not even comparable to SELinux), etc. Those don’t seem to affect a large number of people though, decision makers and administrators sort of give me strange looks when I start going into those.</p>
<p>So here are some more reasons, slightly less technical but probably much more important to these particular crowds. You see, I was an admin once upon a time and speaking from experience admins are much less likely to take a ‘purity’ argument seriously, because they know the kind of impure crap that has to happen to get the job done.</p>
<p>I think the most important and compelling argument for both of these crowds is one of scalability. AppArmor is very much a ‘right now’ type of solution. They give you exactly what you see, a security mechanism that will protect some of your applications within a limited threat model, namely only remote intruders and only if they can only exploit 1 application. So, you say that’s all you need and AppArmor lets you write “profiles” in 5 minutes? That’s great, are you sure it is all you will ever need?</p>
<p>With AppArmor there is no room for improvement. The authors were so focused on ease-of-use that they pushed all the simplicity into the model (incidentally this often creates a very complex implementation but that is another point). The model, then, only covers this very limited threat model. You will never be able to secure your infrastructure more than you can today with AppArmor. Your system level applications will never be secured, your users will never be restricted, and your confined applications only haphazardly.</p>
<p>SELinux has its roots in research that started around 1992, to build very secure systems on OS’s like Distrubuted Trusted Mach (DTMach), which later continued as the Distrubuted Trusted Operating System project. Eventually the Flask architecture comes out of an implementation by the NSA and the University of Utah which is the same architecture that SELinux uses today. When I started working on SELinux 4-5 years ago it was a very very hard thing to use and implement in a distro. The SELinux researchers and developers were very interested in getting the security right, and then simplifying it with tools in userspace, like it should be.</p>
<p>So here it is, 2 years after Red Hat first put SELinux on by default in a general purpose distro (oh yea, AppArmor also doesn’t come on by default) and the usability of SELinux has leaped lightyears ahead of where it was. The best part is that SELinux will continue to get easier, while keeping its strengths while AppArmor was artificially limited by a broken design.</p>
<p>So, that’s the background on SELinux. The point of it was to say, SELinux is complete and comprehensive and also very flexible. The SELinux policy lets you basically accomplish any kind of security goals you have. So you can deploy SELinux today using the targeted policy and tweaking where necessary on your system, which requires little SELinux expertise and when you are ready you can secure more and more of your infrastructure, you aren’t artificially limited, SELinux scales to any security goals you might come up with anytime in the future.</p>
<p>So I believe that is a pretty compelling reason for an Admin, but I’ll throw in another bonus reason. AppArmor claims extreme ease of use and Novell is pushing it on their enterprise clients but one important thing they are missing for any enterprise is any kind of network policy management. I’ll grant you that SELinux isn’t overflowing with network policy management capabilities today but there are several works in progress. Even without the specific network management SELinux has modular policy and local customizations that let you maintain a set of policy modules that you can deploy to your systems while maintaining local customizations on top of those policies at each machine that needs them, already significantly better than any AppArmor offering. My employer, Tresys has a product coming out called <a target="_blank" href="http://www.tresys.com/products/brickwall">Brickwall </a>that has some pretty advanced network management capabilities and obviously my project, the <a target="_blank" href="http://sepolicy-server.sf.net/">policy server</a>, has some crazy capabilities extending even to access control on the policy, so that you can delegate parts of the policy to junior administrators without letting the intent of the policy change.</p>
<p>With the scalability and management features of SELinux (and the lack of them in AppArmor) I’d be seriously shocked if an informed administrator chose AppArmor.</p>
]]></content:encoded>
			<wfw:commentRss>http://securityblog.org/brindle/2006/08/20/on-apparmor/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
