<?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>Simplicity is a form of art... &#187; Security</title>
	<atom:link href="http://blog.siphos.be/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.siphos.be</link>
	<description>Sven Vermeulen&#039;s web log</description>
	<lastBuildDate>Sun, 29 Jan 2012 11:33:40 +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>Trying out initramfs with selinux and grsec</title>
		<link>http://blog.siphos.be/2012/01/trying-out-initramfs-with-selinux-and-grsec/</link>
		<comments>http://blog.siphos.be/2012/01/trying-out-initramfs-with-selinux-and-grsec/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 10:58:02 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Hardened]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=538</guid>
		<description><![CDATA[I&#8217;m no fan of initramfs. All my systems boot up just fine without it, so I often see it as an additional layer of obfuscation. But there are definitely cases where initramfs is needed, and from the looks of it, &#8230; <a href="http://blog.siphos.be/2012/01/trying-out-initramfs-with-selinux-and-grsec/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;m no fan of initramfs. All my systems boot up just fine without it, so I often see it as an additional layer of obfuscation. But there are definitely cases where initramfs is needed, and from the <a href="http://thread.gmane.org/gmane.linux.gentoo.devel/74464">looks of it</a>, we might be needing to push out some documentation and support for initramfs. Since my primary focus is to look at a hardened system, I started playing with initramfs together with Gentoo Hardened, grSecurity and SELinux. And what a challenge it was&#8230;
</p>
<p>
But first, a quick introduction to initramfs. The Linux kernel supports <em>initrd</em> images for quite some time. These images are best seen as loopback-mountable images containing a whole file system that the Linux kernel boots as the root device. On this initrd image, a set of tools and scripts then prepare the system and finally switch towards the real root device. The initrd feature was often used when the root device is a network-mounted location or on a file system that requires additional activities (like an encrypted file system or even on LVM. But it also had some difficulties with it.
</p>
<p>
Using a loopback-mountable image means that this is seen as a full device (with file system on it), so the Linux kernel also tries caching the files on it, which leads to some unwanted memory consumption. It is a static environment, so it is hard to grow or shrink it. Every time an administrator creates an initrd, he needs to carefully design (capacity-wise) the environment not to request too much or too little memory.
</p>
<p>
Enter <em>initramfs</em>. The concept is similar: an environment that the Linux kernel boots as a root device which is used to prepare for booting further from the real root file systems. But it uses a different approach. First of all, it is no longer a loopback-mountable image, but a cpio archive that is used on a tmpfs file system. Unlike initrd, tmpfs can grow or shrink as necessary, so the administrator doesn&#8217;t need to plan the capacity of the image. And because it is a tmpfs file system, the Linux kernel doesn&#8217;t try to cache the files in memory (as it knows they already are in memory).
</p>
<p>
There are undoubtedly more advantages to initramfs, but let&#8217;s stick to the primary objective of this post: talk about its implementation on a hardened system.
</p>
<p>
I started playing with <b>dracut</b>, a tool to create initramfs archives which is seen as a widely popular implementation (and suggested on the gentoo development mailinglist). It uses a simple, modular approach to building initramfs archives. It has a base, which includes a small <code>init</code> script and some device handling (based on <code>udev</code>), and modules that you can add depending on your situation (such as adding support for RAID devices, LVM, NFS mounted file systems etc.)
</p>
<p>
On a SELinux system (using a strict policy, enforcing mode) running dracut in the <code>sysadm_t</code> domain doesn&#8217;t work, so I had to create a <code>dracut_t</code> domain (which has been pushed to the Portage tree yesterday). But other than that, it is for me sufficient to call dracut to create an initramfs:
</p>
<pre>
# dracut -f "" 3.1.6-hardened
</pre>
<p>
My grub then has an additional set of lines like so:
</p>
<pre>
title Gentoo Linux Hardened (initramfs)
root (hd0,0)
kernel /boot/vmlinuz-3.1.6-hardened root=/dev/vda1 console=ttyS0 console=tty0
initrd /boot/initramfs-3.1.6-hardened.img
</pre>
<p>
Sadly, the bugger didn&#8217;t boot. The first problem I hit was that the Linux kernel I boot has chroot restrictions in it (grSecurity). These restrictions further tighten chroot environments so that it is much more difficult to &#8220;escape&#8221; a chroot. But <b>dracut</b>, and probably all others, use <b>chroot</b> to further prepare the bootup and eventually switch to the chrooted environment to boot up further. Having the chroot restrictions enabled effectively means that I cannot use initramfs environments. To work around, I enabled <em>sysctl</em> support for all the chroot restrictions and made sure that their default behavior is to be disabled. Then, when the system boots up, it enables the restrictions later in the boot process (through the <code>sysctl.conf</code> settings) and then locks these settings (thanks to grSecurity&#8217;s <code>grsec_lock</code> feature) so that they cannot be disabled anymore later.
</p>
<p>
But no, I did get further, up to the point that either the openrc init is called (which tries to load in the SELinux policy and then breaks) or that the initramfs tries to load the SELinux policy &#8211; and then breaks. The problem here is that there is too much happening before the SELinux policy is loaded. Files are created (such as device files) or manipulated, chroots are prepared, udev is (temporarily) ran, mounts are created, &#8230; all before a SELinux policy is loaded. As a result, the files on the system have incorrect contexts and the moment the SELinux policy is loaded, the processes get denied all access and other privileges they want against these (wrongly) labeled files. And since after loading the SELinux policy, the process runs in <code>kernel_t</code> domain, it doesn&#8217;t have the privileges to relabel the entire system, let alone call commands.
</p>
<p>
This is currently where I&#8217;m stuck. I can get the thing boot up, if you temporarily work in permissive mode. When the openrc init is eventually called, things proceed as usual and the moment udev is started (again, now from the openrc init) it is possible to switch to enforcing mode. All processes are running by then in the correct domain and there do not seem to be any files left with wrong contexts (since the initramfs is not reachable anymore and the device files in <code>/dev</code> are now set again by udev which is SELinux aware.
</p>
<p>
But if you want to boot up in enforcing straight away, there are still things to investigate. I think I&#8217;ll need to put the policy in the initramfs as well (which has the huge downside that every update on the policy requires a rebuild of the initramfs as well). In that case I can load the policy early up the chain and have the initramfs work further running in an enforced situation. Or I completely regard the initramfs as an &#8220;always trusted&#8221; environment and wait for openrc&#8217;s init to load the SELinux policy. In that case, I need to find a way to relabel the (temporarily created) <code>/dev</code> entries (like console, kmsg, &#8230;) before the policy is loaded.
</p>
<p>
Definitely to be continued&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2012/01/trying-out-initramfs-with-selinux-and-grsec/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Unix domain sockets are files</title>
		<link>http://blog.siphos.be/2011/12/unix-domain-sockets-are-files/</link>
		<comments>http://blog.siphos.be/2011/12/unix-domain-sockets-are-files/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 15:48:10 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=528</guid>
		<description><![CDATA[Probably not a first for many seasoned Linux administrators, and probably not correct accordingly to more advanced users than myself, but I just found out that Unix domain sockets are files. Even when they&#8217;re not. I have been looking at &#8230; <a href="http://blog.siphos.be/2011/12/unix-domain-sockets-are-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
Probably not a first for many seasoned Linux administrators, and probably not correct accordingly to more advanced users than myself, but I just found out that Unix domain sockets are files. Even when they&#8217;re not.
</p>
<p>
I have been looking at a weird SELinux denial I had occuring on my system:
</p>
<pre>
avc:  denied  { read write } for  pid=10012 comm="hostname" \
path="socket:[318867]" dev=sockfs ino=318867 \
scontext=system_u:system_r:hostname_t \
tcontext=system_u:system_r:dhcpc_t \
tclass=unix_stream_socket
</pre>
<p>
I had a tough time trying to figure out why in earth the <b>hostname</b> application was trying to read/write to a <em>socket</em> that was owned by <b>dhcpcd</b>. Even more, I didn&#8217;t see a <em>connectto</em> attempt, and there is nothing in my policy that would allow the <code>hostname_t</code> domain to connect to a unix_stream_socket of <code>dhcpc_t</code>. But moreover I was intrigued why the given path was no real path, even though it has an inode.
</p>
<p>
So I dug up <b>lsof</b>, which returned the following on this socket:
</p>
<pre>
# <b>lsof -p 10017</b>
COMMAND   PID USER   FD      TYPE             DEVICE SIZE/OFF   NODE NAME
...
dhcpcd  10017 root    3u     unix 0x0000000000000000      0t0 318867 socket
dhcpcd  10017 root    4w      REG              252,3        6 268749 /var/run/dhcpcd-eth1.pid
dhcpcd  10017 root    5u     unix 0x0000000000000000      0t0 318869 socket
</pre>
<p>
Still no luck in figuring out what that is. And even <code>/proc/net/unix</code> didn&#8217;t give anything back:
</p>
<pre>
# <b>grep 318867 /proc/net/unix</b>
Num               RefCount Protocol Flags    Type St Inode Path
0000000000000000: 00000002 00000000 00000000 0001 01 318867
</pre>
<p>
So I started looking at Unix domain sockets, what they are, how they are used, etc. And I learned that
</p>
<ul>
<li>Unix domain sockets are just files. Well, most of the time. To use a socket (from server-perspective), a programmer first calls <code>socket()</code> to create a socket descriptor, which is a special type of file descriptor. It then <code>bind()</code>&#8216;s the socket to a (socket)file on the file system, <code>listen()</code>&#8216;s for incoming connections and eventually <code>accept()</code>&#8216;s them. Clients also use <code>socket()</code> but then call <code>connectto()</code> to have its socket connected to a (socket)file and eventually <code>read()</code> and <code>write()</code> (or <code>send()</code> and <code>recv()</code>).</li>
<li>Linux supports an abstract namespace for sockets, so not all of these are actually bound/connected to a file. Instead, they connect to a &#8220;name&#8221; instead, which cannot be traced back to a file. For those interested, looking at <code>/proc/net/unix</code> or <code>netstat -xa</code> shows the abstract ones starting with an <code>@</code> sign.</li>
<li>Not all Unix sockets (actually almost the majority of sockets on my system) can be traced back to either a file or abstract name.</li>
</ul>
<p>
And this latter is eating me up. I assume that these sockets were originally created on a file system, but immediately after they were <code>bind()</code>&#8216;ed, the file is unlinked, making it harder (impossible?) to find what the socket file was called to begin with. I first thought it were sockets that were not <code>bind()</code>&#8216;ed to, but many of them have the state <code>CONNECTED</code> displayed (in the <b>netstat -xa</b> output) so that&#8217;s not a likely scenario. In any case, if you know how these sockets can have an inode without a known path, please let me know.
</p>
<p>
But what has this to do with my previous investigation? Well, because the sockets are descriptors, they are passed when a process uses <code>fork()</code> and <code>execve()</code>. And looking at the source code of dhcpcd, I noticed that it does not close its file descriptors when it calls its hook scripts (through the <code>exec_script()</code> function of its sources). As a result, the open file descriptors (including the sockets) are passed on to the hook scripts &#8211; one of them calling <b>hostname</b>.
</p>
<p>
So what I saw in the AVC denials was a leaked socket (so there was no <code>connectto</code> originating from the <code>hostname_t</code> domain since the connection was made by <b>dhcpc</b> in the <code>dhcpc_t</code> domain) that is for some reason being read/written to. A leaked unix stream socket.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/12/unix-domain-sockets-are-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SELinux Gentoo/Hardened state 2011-12-19</title>
		<link>http://blog.siphos.be/2011/12/selinux-gentoohardened-state-2011-12-19/</link>
		<comments>http://blog.siphos.be/2011/12/selinux-gentoohardened-state-2011-12-19/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 16:04:20 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Hardened]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=512</guid>
		<description><![CDATA[On december 14th, the Gentoo Hardened project had its monthly online meeting to discuss the current state of affairs of its projects and subprojects. Amongst them, the updates on the SELinux-front were presented as well. Since last meeting, the follow &#8230; <a href="http://blog.siphos.be/2011/12/selinux-gentoohardened-state-2011-12-19/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
On december 14th, the <a href="http://hardened.gentoo.org">Gentoo Hardened</a> project had its monthly <a href="http://archives.gentoo.org/gentoo-hardened/msg_6ee74d905f217b47446ace08da32a921.xml">online meeting</a> to discuss the current state of affairs of its projects and subprojects. Amongst them, the updates on the SELinux-front were presented as well.
</p>
<p>
Since last meeting, the follow topics passed the revue.
</p>
<ul>
<li>
    <a href="http://packages.gentoo.org/package/sec-policy/selinux-base-policy">sec-policy/selinux-base-policy</a>, which is the &#8220;master&#8221; of our SELinux policies and contains those SELinux modules that are somewhat indivisible (hence the name, &#8220;base&#8221;), is now at revision 8. I tend to describe the changes on the gentoo-hardened mailinglist, and this is <a href="http://archives.gentoo.org/gentoo-hardened/msg_b11ef32142076034abd0616e373361da.xml">not different for rev 8</a>. I haven&#8217;t stabilized the rev 6 one yet although I promised too, I&#8217;ll try to find some time to do that this evening.
  </li>
<li>
    We had a <a href="https://bugs.gentoo.org/show_bug.cgi?id=375475">regression</a> with <b>newrole</b> for some time. Luckily, Jory &#8220;Anarchy&#8221; Pratt found the issue. Drop the setuid bit from the binary, and the application works again as it should. This will be included in the next <a href="http://packages.gentoo.org/package/sys-apps/policycoreutils">policycoreutils</a> bump.
  </li>
<li>
    The last available <a href="http://packages.gentoo.org/package/app-admin/sudo">sudo</a> package now builds with native SELinux support as well, which allows users to add ROLE= and TYPE= information in the <code>sudoers</code> file. As such, users do not need to call <b>newrole</b> when they need to transition to a specific role for just a single command &#8211; sudo can now take care of that.
  </li>
<li>
    The older <code>selinux/v2refpolicy/*</code> profiles have been deprecated. If you want to use a SELinux-enabled profile, you need to use a profile that ends with <code>/selinux</code>, such as <code>default/linux/amd64/10.0/selinux</code> or <code>hardened/linux/amd64/selinux</code>. Of course we prefer you to use a hardened profile ;-)
  </li>
<li>
    Documentation-wise, </p>
<ul>
<li>
      the <a href="http://www.gentoo.org/proj/en/hardened/selinux/selinux-handbook.xml">Gentoo Hardened SELinux Handbook</a> has been updated to reflect the profile changes
    </li>
<li>
      the <a href="http://www.gentoo.org/proj/en/hardened/selinux-bugreporting.xml">SELinux bugreporting guide</a> has been put online to inform users what kind of information is needed for us to fix issues or denials that they might see
    </li>
<li>
      the <a href="http://www.gentoo.org/proj/en/hardened/selinux-faq.xml">SELinux FAQ</a> has been updated with the questions <a href="http://www.gentoo.org/proj/en/hardened/selinux-faq.xml#nosuid">Applications do not transition on a nosuid partition</a> and <a href="http://www.gentoo.org/proj/en/hardened/selinux-faq.xml#auth-run_init">Why do I always need to re-authenticate when operating init scripts?</a>.
    </li>
</ul>
</li>
</ul>
<p>
That&#8217;s about it. Not a too busy month but progress anyhow.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/12/selinux-gentoohardened-state-2011-12-19/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Gentoo Security Benchmark with OVAL and Open-SCAP</title>
		<link>http://blog.siphos.be/2011/11/gentoo-security-benchmark-with-oval-and-open-scap/</link>
		<comments>http://blog.siphos.be/2011/11/gentoo-security-benchmark-with-oval-and-open-scap/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 21:09:11 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Hardened]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=489</guid>
		<description><![CDATA[A while ago, I got referred to the Open Vulnerability and Assessment Language, which seems to be an open specification (or even standard) for defining security content/information and being able to document such things in a way that tools can &#8230; <a href="http://blog.siphos.be/2011/11/gentoo-security-benchmark-with-oval-and-open-scap/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
A while ago, I got referred to the <a href="http://oval.mitre.org/">Open Vulnerability and Assessment Language</a>, which seems to be an open specification (or even standard) for defining security content/information and being able to document such things in a way that tools can interpret it. Actually, it is a set of these specifications. But first:
</p>
<blockquote><p>
tl;dr <a href="http://dev.gentoo.org/~swift/docs/previews/oval/gentoo-xccdf-guide.html">Gentoo Security Benchmark Guide</a> with <a href="http://dev.gentoo.org/~swift/docs/previews/oval/gentoo-xccdf-report.html">example report on automated tests</a> based on <a href="http://dev.gentoo.org/~swift/docs/previews/oval/scap-gentoo-xccdf.txt">XCCDF</a> and <a href="http://dev.gentoo.org/~swift/docs/previews/oval/scap-gentoo-oval2.txt">OVAL</a>, interpreted by <a href="http://www.open-scap.org/page/Main_Page">Open-SCAP</a>.
</p></blockquote>
<p>
There; now that we have that out of our way, let&#8217;s continue on the somewhat more gory details. In this first post, I&#8217;d like to talk a bit about XCCDF and OVAL, which are both imo overly complex but interesting XML formats.
</p>
<p>
The first one, XCCDF, is better known as the <b>Extensible Configuration Checklist Description Format</b> and is an XML format in which you document settings (what should a system look like). By itself, that doesn&#8217;t warrant another XML format. However, the power of XCCDF is that you can define in the document <em>profiles</em>. Each of these profiles is then documented with the set of rules that applies to the profile. So you can have an XCCDF document on the configuration of BIND (the nameserver) and have two profiles: one for a single-server setup, and one for a multi-server (master/slave) setup.
</p>
<p>
These rules also define checks that you can have a tool performed against your configuration. These checks are documented in an OVAL XML file (<b>Open Vulnerability and Assessment Language</b>) which can be interpreted by an OVAL-compliant tool. A very simply put statement could be: &#8220;File /etc/ssh/sshd_config must have a line that matches &#8216;PermitRootLogin no&#8217;&#8221;.
</p>
<p>
Of course, XML doesn&#8217;t use simple statements. In the case of OVAL, a specific form of normalization occurs.
</p>
<ul>
<li>
At the beginning, you define a <em>definition</em> that explains what you want to achieve (similar to the above statement) in plain text, and then refer to one or more criteria that needs to be passed if this line applies. Most checks in a configuration guide are simple criteria, but with OVAL you can create criteria like &#8220;If my system is a Gentoo x86_64 one, and I use the hardened profile, then criteria A must apply, but if my system does not use a hardened profile, it is criteria B&#8221;.
</li>
<li>
The criteria refers to a <em>test</em> that needs to be executed. This test can be a file expression match, partition information check, service state, installed software, etc. but does not allow executing commands  that the user defines (it is not considered a safe practice that you execute commands that are stated in the XML file since most OVAL interpreters will run as root). This test is based on two additional aspects:</p>
<ul>
<li>The <em>object</em> refers to the object or resource that is checked. This can be a partition or a file, or a list of lines that match an expression in a file, etc.</li>
<li>The <em>state</em> refers to the state that that object or resource should be in (or should match).</li>
</ul>
</li>
</ul>
<p>
With this OVAL language in place, you can now refer to several tests to enhance your XCCDF document, and allow OVAL interpreters to test the various rules on your system. For me, this was the major reason to look into the language, since I had my hopes up to update or rewrite the <a href="http://www.gentoo.org/doc/en/security/security-handbook.xml">Gentoo Linux Security Handbook</a> but with a way for users to validate if their system adheres to most/all statements made in that document.
</p>
<p>
As a matter of exercise, I started making such a security benchmark of which you can find a <a href="http://dev.gentoo.org/~swift/docs/previews/oval/gentoo-xccdf-guide.html">HTML version online</a> (it&#8217;s a preview URL, so might change in the future). And since it is written with XCCDF and OVAL, I&#8217;ve also added an <a href="http://dev.gentoo.org/~swift/docs/previews/oval/gentoo-xccdf-report.html">example report on automated tests</a> too. The sources of these documents are available as well (<a href="http://dev.gentoo.org/~swift/docs/previews/oval/scap-gentoo-xccdf.txt">XCCDF</a> and <a href="http://dev.gentoo.org/~swift/docs/previews/oval/scap-gentoo-oval2.txt">OVAL</a> &#8211; download as txt but rename to XML then).
</p>
<p>
For those adventurous enough to play with them: install <code>app-forensics/openscap</code> so that you can parse the files. To generate the guide itself, use <code>oscap xccdf generate scap-gentoo-xccdf.xml &gt; guide.html</code>. To run the tests associated with it, use <code>oscap xccdf eval --oval-results --profile Gentoo-Default --report report.html scap-gentoo-xccdf.xml</code>. Also take a look at the <a href="http://www.open-scap.org/page/Main_Page">Open-SCAP</a> website which is a good resource as well (and the mailinglists are low traffic but with good response times!).
</p>
<p>
So, what is the future on all this for me?
</p>
<p>
First, I&#8217;m going to work a bit further on the OVAL statements, so that I can automatically test the majority of settings that I currently have in the benchmark/guide. Only when I&#8217;m far enough will I continue on the content of the guide (since it is far from finished) and also see if this isn&#8217;t something that can be put on a somewhat more official location. If not, I&#8217;ll still continue developing it, but it&#8217;ll remain on my dev-page.
</p>
<p>
When I&#8217;m somewhat satisfied with that, I might check if I can&#8217;t have OVAL enhanced with some Gentoo-specific objects (there are already objects for RedHat-like and Debian-like distributions) so that we can write tests for Gentoo settings (like USE flags, profiles, enabled GCC specs, etc.) If we have that, then we can even write checks (XCCDF and OVAL based) to validate if a system is how it is supposed to be (wouldn&#8217;t that be great, an automated test that tells you if your system is properly set up according to our documents).
</p>
<p>
But XCCDF and OVAL isn&#8217;t the end. There are other formats available as well, like CCE (for configuration entries), CVE/CPE (to check vulnerability information and its target software/platform) and more. I know RedHat is already actively using OVAL for its <a href="https://www.redhat.com/security/data/oval/">security advisories</a>, and other sites like <a href="http://cisecurity.org/">Center for Internet Security</a> are also using XCCDF and OVAL to document and work with security guides. So why would Gentoo not get on that train as well?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/11/gentoo-security-benchmark-with-oval-and-open-scap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SELinux&#8217; 2011/07 releases now stable</title>
		<link>http://blog.siphos.be/2011/10/selinux-201107-releases-now-stable/</link>
		<comments>http://blog.siphos.be/2011/10/selinux-201107-releases-now-stable/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 13:07:51 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Hardened]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=476</guid>
		<description><![CDATA[A few minutes ago, I stabilized both the 2.20110726 policies as well as the SELinux userspace utilities that were stable (upstream) on 20110727. With the change, I also updated the Gentoo SELinux Handbook with the changes I presented on our &#8230; <a href="http://blog.siphos.be/2011/10/selinux-201107-releases-now-stable/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
A few minutes ago, I stabilized both the 2.20110726 policies as well as the SELinux userspace utilities that were stable (upstream) on 20110727. With the change, I also updated the <a href="http://hardened.gentoo.org/selinux/selinux-handbook.xml">Gentoo SELinux Handbook</a> with the changes I presented on our <a href="http://archives.gentoo.org/gentoo-hardened/msg_73ddd74112bef0007f361f3598140a21.xml">gentoo-hardened</a> mailinglist. After some time, I&#8217;ll remove the now obsoleted older policies and userspace utilities to keep the tree in a sane state.
</p>
<p>
There are a few policy packages whose stabilized version isn&#8217;t the latest (cfr earlier post), those are due within the proper designated period (about 1 month).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/10/selinux-201107-releases-now-stable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gentoo Hardened SELinux policies, rev 5</title>
		<link>http://blog.siphos.be/2011/10/gentoo-hardened-selinux-policies-rev-5/</link>
		<comments>http://blog.siphos.be/2011/10/gentoo-hardened-selinux-policies-rev-5/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 16:30:44 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Hardened]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=471</guid>
		<description><![CDATA[I&#8217;ve pushed out selinux-base-policy version 2.20110726-r5 to the hardened-dev overlay. It does not hold huge changes, most of them are rewrites or updates on pre-existing patches (on the SELinux policies) to make them conform the refpolicy naming conventions and other &#8230; <a href="http://blog.siphos.be/2011/10/gentoo-hardened-selinux-policies-rev-5/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve pushed out <tt>selinux-base-policy</tt> version 2.20110726-r5 to the <a href="http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=summary">hardened-dev</a> overlay. It does not hold huge changes, most of them are rewrites or updates on pre-existing patches (on the SELinux policies) to make them conform the refpolicy naming conventions and other guidelines. It includes preliminary support for the <a href="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG Specification</a> although changes there are still going to occur (as the policy is still under development). Other updates are primarily on the policies for user applications (pan, mozilla, skype), portage and asterisk.
</p>
<p>
In related news, the <a href="http://hardened.gentoo.org/selinux-faq.xml">Gentoo Hardened SELinux FAQ</a> is updated with two entries:
</p>
<ol>
<li><a href="http://www.gentoo.org/proj/en/hardened/selinux-faq.xml#recoverportage">Portage fails to label files because &#8220;setfiles&#8221; does not work anymore</a>, and</li>
<li><a href="http://www.gentoo.org/proj/en/hardened/selinux-faq.xml#nosuid">Applications do not transition on a nosuid-mounted partition</a>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/10/gentoo-hardened-selinux-policies-rev-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mitigating risks, part 5 &#8211; application firewalls</title>
		<link>http://blog.siphos.be/2011/10/mitigating-risks-part-5-application-firewalls/</link>
		<comments>http://blog.siphos.be/2011/10/mitigating-risks-part-5-application-firewalls/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 21:38:24 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=453</guid>
		<description><![CDATA[The last isolation-related aspect on risk mitigation is called application firewalls. Like more &#8220;regular&#8221; firewalls, its purpose is to be put in front of a service, controlling which data/connections get through and which don&#8217;t. But unlike these regular firewalls, application &#8230; <a href="http://blog.siphos.be/2011/10/mitigating-risks-part-5-application-firewalls/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
The last <em>isolation-related</em> aspect on risk mitigation is called <b>application firewalls</b>. Like more &#8220;regular&#8221; firewalls, its purpose is to be put in front of a service, controlling which data/connections get through and which don&#8217;t. But unlike these regular firewalls, <a href="https://en.wikipedia.org/wiki/Application_firewall">application firewalls</a> work on higher-level protocols (like HTTP, FTP) that deal with user data rather than with connection routing. I&#8217;m going to call these firewalls &#8220;network firewalls&#8221;, although most modern network firewalls have some application firewall functionality as well.
</p>
<p>
The purpose and necessity of network firewalls is well known and understood: make sure that the service is only accessible from the right location, check if connections aren&#8217;t abused (or too many connections are made), etc. But what if the connection itself is valid? After all, most abuse of services is not because they originate from the wrong location or try to access the wrong service. Instead, such abuse comes from valid access to the application, but with less kosher intentions. So what can application firewalls do in this case?
</p>
<ul>
<li>Because they perform inspection of the data that is transferred itself, application firewalls can <b>detect malicious data fragments</b> or attempts to abuse the service. These detection rules can be based on general, heuristic rules (well-known examples are detection rules for cross-site scripting attacks (XSS) or SQL Injection) but can also be very specific to a particular application.</li>
<li>Because all data is transferred through the firewall and the firewall has knowledge of the application itself, these firewalls offer <b>advanced auditing features</b> since they can detect authentication steps, user data, application-specific transactions and more.</li>
<li>With knowledge of the users&#8217; session and behavior (application-level) and origin (network level), application firewalls can <b>detect and prevent unauthorized sessions</b>, such as the case with session hijacking or even man-in-the-middle attacks (based on behavior detection)</li>
</ul>
<p>
Implementing an application firewall however doesn&#8217;t only mean that you improve access controls on it. It has other advantages that make application firewalls an important part in many architectures:
</p>
<ul>
<li>If all service access is forced through the application firewall (for instance through an IP filter on the service that only allows connections from the application firewalls) you can implement rules that <b>deter known attacks/vulnerabilities</b> without needing to fix the code itself (or if fixing is possible, lower the time pressure). For instance, for Apache-based services, such an application firewall could detect or even change the <tt>Range:</tt> header on malicious requests to lower the impact of this potentially nasty DoS vulnerability</li>
<li>Depending on the complexity, some <b>functional application bug fixing</b> might even be possible. For instance changing content types on requests/replies (HTTP), adding a domain on an FTP accounts&#8217; login statement, &#8230;</li>
<li>Many application firewalls (or gateways) offer proxy functionality which might <b>improve response times</b>. This is not a sure-given, since most applications are session-aware so the advantage is only for session-agnostic requests (be it static content or specific SQL statements in case of a database firewall). But also in case of session-aware statements can an improvement be found. Consider a database firewall which translates SQL statements from an unsupported application towards better defined statements (for instance using proper indexes or materialized views).</li>
<li>In some cases, you might even be able to upgrade a backend of an unsupported application (which previously required an outdated version of that database) by translating the backend requests when they are incompatible with the new backend version. So you can <b>improve integration</b> or <b>support unsupported upgrades</b>.</li>
<li>In case of risk reduction, application firewalls also allow you to move a service elsewhere (even in the <b>public cloud</b>) and still keep the access under control.</li>
</ul>
<p>
Of course, it would be TGTBT (Too Good To Be True) if there isn&#8217;t an (important) downside: <em>maintaining the application firewall is a daunting task</em>. Because of its flexibility, you&#8217;ll need deep knowledge in the application firewall administration and development, keep track of all rules you have (and why you have them), do lots and lots of testing on each rule (since it might affect the functioning of the application) and still be aware that subtle differences introduced by the application firewall rules can pop up unexpectedly. Also, integrating an application firewall is another service between your customer and his service, which might influence performance but also makes the underlying architecture more complex. Finally, you&#8217;ll need to consider that an application firewall requires lots of resources (CPU/memory), especially when it needs to perform SSL/TLS termination. Oh, and they&#8217;re often expensive too.
</p>
<p>
Still, even with these downsides, application firewalls are an important part of the service isolation strategy, which is a key aspect in the <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-1/">risk mitigation strategy</a> which this series started with. We&#8217;ve focused on three now: <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-2-service-isolation/">service isolation</a> (network-wise), process isolation (through <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-4-mandatory-access-control/">mandatory access control</a>) and now access isolation through application firewalls. And with proper <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-3-hardening/">hardening</a> in place, I believe that you have done all you can do to reduce the risks when running unsupported software (apart from upgrading it or switching towards supported software).
</p>
<p>
If you have other ideas that benefit risk mitigation, with specific focus on unsupported software, I would be glad to hear about them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/10/mitigating-risks-part-5-application-firewalls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mitigating risks, part 4 &#8211; Mandatory Access Control</title>
		<link>http://blog.siphos.be/2011/09/mitigating-risks-part-4-mandatory-access-control/</link>
		<comments>http://blog.siphos.be/2011/09/mitigating-risks-part-4-mandatory-access-control/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 18:16:30 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Hardened]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=433</guid>
		<description><![CDATA[I&#8217;ve talked about service isolation earlier and the risks that it helps to mitigate. However, many applications still run as highly privileged accounts, or can be abused to execute more functions than intended. Service isolation doesn&#8217;t help there, and system &#8230; <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-4-mandatory-access-control/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve talked about <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-2-service-isolation/">service isolation</a> earlier and the risks that it helps to mitigate. However, many applications still run as highly privileged accounts, or can be abused to execute more functions than intended. Service isolation doesn&#8217;t help there, and system hardening can only go that far. The additional countermeasures that you can take are application firewalls and mandatory access control. And now you know what part 5 will talk about ;-)
</p>
<p>
Standard access control on most popular operating systems is based on a limited set of privileges (such as read, write and execute) on a limited scale (user, group, everyone else). Recent developments are showing an increase in the privilege flexibility, with the advent of <a href="http://www.gentoo.org/proj/en/hardened/capabilities.xml">manageable capabilities</a> (Linux/Unix) or <a href="http://technet.microsoft.com/en-us/windowsserver/bb310732">Group Policies</a> (Windows). However, these still lack some important features:
</p>
<ul>
<li>
Users are still able to <b>delegate their privilege</b> to others. A user with read access on a particular file can copy that file to a public readable location so others can read it as well. Privileges on his own files and directories are fully manageable by the owner. For our risk mitigation approach on unsupported software, that means that a vulnerability might be exploited so that the service &#8220;leaks&#8221; information. It is especially important in an attack that uses a sequence of vulnerabilities (such as in an <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Advanced_persistent_threat">advanced persistent threat</a>) where low-risk vulnerabilities can be combined into a high-risk exploit.
</li>
<li>
Privileges are still <b>user-level privileges</b> (including technical account users). In case of running services, this almost always means that the process has more privileges than it requires. Some software titles allow for dropping capabilities when not needed anymore. Most however are oblivious of the rights they possess. Abuse of the service (which includes use of features that the service offers but are not allowed policy-wise by the organization) cannot be prevented if <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-3-hardening/">hardening</a> doesn&#8217;t disable it.
</li>
<li>
Privileges are <b>managed by many actors</b> (such as the system administrators) and are not that easy to audit. Privilege denials are often not audited, causing issues to only come up when they occur, rather then when the attempt to provoke issues is started. In many cases, a malicious (or &#8220;playful, inventive&#8221;) user starts with investigating and trying out long before a way is found to abuse the service.
</li>
</ul>
<p>
In case of a mandatory access control system, a security administrator is responsible for writing and managing a security policy which is <b>enforced by the operating system</b> (well, higher level enforcement would be even better, but is currently not realistic). Once enforced, the policy ensures that privileges are not delegated (unless allowed). Also, in most MAC systems, the policy allows for a much <b>more detailed privilege granularity</b>. And recent server operating systems have support for MAC &#8211; I personally work with <a href="http://hardened.gentoo.org/selinux">SELinux</a> for the (GNU/)Linux operating system.
</p>
<p>
But this more granular flexibility in privileges comes with some costs. First of all, it becomes much more <b>complex to manage the policy</b>. You&#8217;ll need highly experienced administrators to work with a MAC-enabled system. Second, a MAC model has a <b>negative influence on performance</b> since the system has to check many more accesses and access rules. To make MAC-enabled systems workable, operating systems offer a <em>default policy</em> which already covers many services. Also, developers on the MAC technology are continuously safe-guarding performance &#8211; I personally do not notice a performance degradation when using SELinux, and more realistic benchmarks suggest that the impact of SELinux is between 3% and 12% depending on the policy level.
</p>
<p>
But what does that mean towards the initial <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-1">risk list</a> that I identified in the beginning of this article series? Well, directly, very little: mandatory access control in this case is about reducing the impact of security vulnerabilities (and abuse of the service). It will not help you out in other ways. However, there are other things to gain from a mandatory access control than just threat reduction.
</p>
<p>
An advantage is &#8211; again &#8211; that you get to <b>know your application</b> well, especially if you had to write a security policy for it. Since you need to define what files it can access, which kind of accesses it is allowed to do, which commands it can execute, etc, it will give you insight in how the application operates. Bugs in the application might be solved faster and you&#8217;ll definitely learn more about how the application is integrated. Another one is that most mandatory access control systems have much more <b>detailed auditing</b> capabilities. Attempts to abuse the service will result in denials which are detected and on which you can then take proper action.
</p>
<p>
Taking a higher-level look at mandatory access control will show you that, in case of risk mitigation, it is much more like service isolation, but then on the operating system level. You isolate the processes, governing the accesses they are allowed to do.
</p>
<p>
But the one main issue &#8211; active exploits on the application service &#8211; cannot be hindered by neither service isolation (since the service is still accessible), hardening (although it might help) or mandatory access control (which reduces the actions an exploit can do). To make sure that vulnerabilities are less likely to be exploited, I&#8217;ll talk about <em>application firewalls</em> in the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/09/mitigating-risks-part-4-mandatory-access-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mitigating risks, part 3 &#8211; hardening</title>
		<link>http://blog.siphos.be/2011/09/mitigating-risks-part-3-hardening/</link>
		<comments>http://blog.siphos.be/2011/09/mitigating-risks-part-3-hardening/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 20:46:47 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=409</guid>
		<description><![CDATA[While I&#8217;m writing this post, my neighbor is shouting. He&#8217;s shouting so hard, that I was almost writing with CAPS on to make sure you could read me. But don&#8217;t worry, he&#8217;s not fighting &#8211; it is how he expresses &#8230; <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-3-hardening/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
While I&#8217;m writing this post, my neighbor is shouting. He&#8217;s shouting so hard, that I was almost writing with CAPS on to make sure you could read me. But don&#8217;t worry, he&#8217;s not fighting &#8211; it is how he expresses his (positive) feelings about his religion.
</p>
<p>
Security is, for some, also a religion. They see risks and vulnerabilities and what not everywhere. They&#8217;re always thinking every system in the world is or will be hacked in the near future and are frantically trying to secure every service they are running &#8211; and more. But security is also a real-life issue. If you take a look at the compromised <a href="http://www.globalsign.com/company/press/090611-security-response.html">GlobalSign</a> website (who mentions that the website is an isolated one &#8211; as <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-2-service-isolation/">I described earlier</a>) I hope that you look at security as being a <em>functional</em> requirement in architecturing and design (and not a non-functional one as many frameworks suggest).
</p>
<p>
And as you can see from the example, isolating services is not sufficient to prevent a successful exploit of an insecure or unsupported software (the reason why I started with this series). One additional measure that you can take is <b>hardening</b> the server and service.
</p>
<p>
The act of hardening a server and service is to configure the system so that it is as secure as possible, based on configuration entries. Many vendors and projects offer a security guide (like the <a href="http://www.gentoo.org/doc/en/security/security-handbook.xml">Gentoo Security Handbook</a> or the <a href="https://docs.fedoraproject.org/en-US/Fedora/16/html/Security_Guide/">Fedora Security Guide</a>) although most of them add this as part of their standard administrative documents (like the <a href="http://www.postgresql.org/docs/current/static/runtime.html">PostgreSQL &#8220;Server Setup and Operation&#8221;</a> chapter).
</p>
<p>
But for some reason, you&#8217;ll find that default installations &#8211; even when following the instructions of the vendor &#8211; are not as secure as you want it to be. As a matter of fact, if you come in contact with auditors, you&#8217;ll probably fail any audit if you use a default installation. To help administrators to secure their services, you will find lots of third party sites offering advice on securing the operating system and the services running on it. These guides are what you will need to &#8220;harden&#8221; your system.
</p>
<ul>
<li>
<a href="https://www.owasp.org/index.php/Main_Page">OWASP</a>, which stands for Open Web Application Security Project, <a href="https://www.owasp.org/index.php/OWASP_Backend_Security_Project">hosts</a> some hardening guides and suggestions together with test scenarios. For front-end application servers (mostly web application servers) you will find lots of interesting resources in the OWASP site (and surrounding community).
</li>
<li>
<a href="http://www.google.com">Google</a> is probably the best resource for finding hardening guides for your operating system or service. Just look for &#8220;hardening foo&#8221; and you will be reading for a week.
</li>
<li>
<a href="http://www.cisecurity.org/">CISecurity</a>, or &#8220;Center for Internet Security&#8221;, is another one with a larger portfolio on hardening guides. Not only does it offer these guides (which it calls &#8220;benchmarks&#8221;), but organizations can also become a member and as such benefit from tooling that CISecurity supports for the validation of benchmarks (i.e. test if the system/deployment is compliant towards a particular benchmark). It does that by developing the benchmarks in a open specification called <b>OVAL</b> (the <em>Open Vulnerability and Assessment Language</em>) and <b>XCCDF</b> (<em>XML Configuration Checklist Data Format</em>). And CISecurity is not the only one there.
</li>
<li>
Another such resource is the <a href="http://web.nvd.nist.gov/view/ncp/repository">National Vulnerability Database</a> (national for US residents, that is ;-) There you can find and download the OVAL/XCCDF resources for various software titles and operating systems. But as you can imagine from the abbreviations, the resources are XML files which are not made to be read by humans.
</li>
</ul>
<p>
Although you can use the tool(s) that CISecurity offers, another possibility is to use <a href="http://www.open-scap.org/page/Main_Page">Open-SCAP</a>, an open source framework for handling SCAP, OVAL, XCCDF and other such open specifications on a system. Its <a href="http://www.open-scap.org/page/Documentation">documentation</a> offers a first glance at what it can support.
</p>
<p>
However, this brings on he disadvantages of hardening services&#8230;
</p>
<ol>
<li>
Hardening a system and its services is a <em>time consuming</em> job. Its only purpose is to reduce the impact of exploited vulnerabilities and reduce the &#8220;attack surface&#8221; so that exploits on unused functions are not possible.
</li>
<li>
Hardening a system and its services <em>can impact the service</em>. Make it too tight, and it might not behave anymore like you want it to.
</li>
<li>
Also, since there are many, many resources &#8220;out there&#8221; on hardening, you will have to <em>manage your hardening rules</em>, document them for yourself. It is also advisable to document the rules you are not implementing, if not just for future&#8217;s sake.
</li>
<li>
The hardening guides also require quite some <em>expertise on the service</em>. If you are not experienced with the service but you need to harden it, you can be lucky and just implement what is suggested and hope for the best, but usually you will need to dive deeper in the subject and make (tough) choices.
</li>
</ol>
<p>
Although specifications like SCAP exist to help you in your hardening exercises, these are still difficult to manage (do <em>not</em> try to write OVAL/SCAP/XCCDF content in your favorite text editor). Its adoption however by Fedora and RedHat is showing a positive effect on the tools surrounding this specification. I will be writing about SCAP, OVAL and XCCDF later since I too see good use of it in organizations (or even free software projects).
</p>
<p>
Does that mean that hardening is not beneficial? On the contrary:
</p>
<ul>
<li>
You <b>gain lots of knowledge</b> in the matter, and also forces you to think about integration aspects. Since you are responsible for the service (or the damage that could be made if the service is exploited) being knowledgeable is definitely a good thing.
</li>
<li>
A considerable amount of vulnerabilities that are and will be reported on the service (check <a href="http://www.cvedetails.com">CVE details</a> to find out about publicly known vulnerabilities, documented in the CVE specification) will not have their effect on a well hardened service. Or put another way, you will <b>reduce the number of real vulnerabilities</b> in your service. You will not be able to exclude all vulnerabilities, but the projected number is high &#8211; a fully hardened Windows or Linux system can mitigate up to 90% of the exploits on the operating system. It will considerably reduce the risks that you and your organization are taking.
</li>
<li>
A well defined hardening guide will also offer the means to <b>automatically audit</b> or check if the <b>system is still compliant</b> to the hardening setup you envisioned. Scheduled regularly, this will ensure that your configurations are not drifting away, back to a more vulnerable setup, for whatever reason.
</li>
<li>
By removing the functions that the service should not offer, you make sure that the use of the service is per the organizations&#8217; guidelines. (Internal) abuse of the service is made more difficult, so users are forced to take the regular way. Unlike service isolation, which allows you to keep track of data/service flows, hardening makes sure that <b>side-functionality is not used</b> without your consent. Or to put it more blunt, &#8220;Yes I know Oracle DB can be used to schedule tasks on the operating system, but no, you&#8217;re not allowed to use that function&#8221;.
</li>
</ul>
<p>
And who knows, perhaps by optimizing the configuration, it might run faster with a lower resource footprint ;-) If it does, that&#8217;s perfect, since the next topic on risk mitigation will have a negative influence on performance: mandatory access control.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/09/mitigating-risks-part-3-hardening/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mitigating risks, part 2 &#8211; service isolation</title>
		<link>http://blog.siphos.be/2011/09/mitigating-risks-part-2-service-isolation/</link>
		<comments>http://blog.siphos.be/2011/09/mitigating-risks-part-2-service-isolation/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 21:12:53 +0000</pubDate>
		<dc:creator>swift</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.siphos.be/?p=393</guid>
		<description><![CDATA[Internet: absolute communication, absolute isolation ~Paul Carvel The quote might be ripped out of its context completely, since it wasn&#8217;t made when talking about risks and the assurance you might need to get in order to reduce risks. But it &#8230; <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-2-service-isolation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<blockquote><p>
Internet: absolute communication, absolute isolation<br />
~Paul Carvel
</p></blockquote>
<p>
The quote might be ripped out of its context completely, since it wasn&#8217;t made when talking about risks and the assurance you might need to get in order to reduce risks. But it does give a nice introduction to the second part of this article series on <em>risk mitigation</em>. After all, if the unsupported software is offering services to the Internet, you really want to govern the communication and isolate the service.
</p>
<p>
When you are dealing with a product or software that is unsupported (be it that it will not get any patches and updates from its authors or vendor, or there is no time/budget to support the environment properly), it is in my opinion wise to isolate the service from the rest. My <a href="http://blog.siphos.be/2011/09/mitigating-risks-part-1/">first post</a> on the matter gave a high-level introduction on the risks that you might be taking when you run unsupported (or out-of-support) systems. Service isolation helps in reducing the risks that <em>others</em> have when you run such software on a shared infrastructure (like in the same network or even data centre).
</p>
<p>
By isolating the unsupported service from the rest, you create a sort-of quarantine environment where sudden mishaps are shielded from interfering with other systems. It provides <b>insurance for others</b>, knowing that their (supported) services cannot be influenced or jeopardized by issues with the unsupported ones. And if these services need to interact with the isolated service, the interface used is known and much more manageable (think about a well-defined TCP connection versus local communication or even Inter-Process Communication). But it goes beyond just providing insurance for others.
</p>
<p>
Isolation forces you to <b>learn about the application</b> and its interaction with other services. It is this phase that makes it extremely important in an environment, because not knowing how an application works, behaves or interacts creates more problems later when you need to debug issues, troubleshoot performance problems and more. Integration failures, as described in my previous post, can only be dealt with swiftly if you know how the service integrates with others.
</p>
<p>
Another advantage of proper service isolation is that you can fix its dependencies more easily. Remember that I talked about upgrade difficulties, where a necessary upgrade for one component impacted the functionalities of the other (unsupported) component? With good isolation, the <b>dependencies are more manageable</b> and controllable. Not only are (sub)component upgrades easier to schedule, it is also a lot easier to provide fall-back scenario&#8217;s in case problems occur. After all, the isolated service is the only user so you have little to fear if you need to roll-back a change.
</p>
<p>
But what is proper service isolation?
</p>
<ul>
<li>
First of all, it means that you focus on running the (unsupported) software alone on an operating system instance. <em>Do not run other services on the same OS</em>, not even if they too are unsupported. The only exception here is if the other services are tightly integrated with your service and cannot be installed on a separate OS. But usually, full service isolation is possible.
</li>
<li>
Next, <em>strip the operating system</em> so it only runs what you need for managing the service. Put primary focus on services that are accepting incoming connections (&#8220;listening&#8221;) and secondary focus on allowed outgoing protocols/sessions (and the tools that initiate them).
</li>
<li>
See if you can <em>virtualize the environment</em>. In most cases, the service does not require many resources so it would be a waste running it on a dedicated system. However, in my opinion, a much better reason for virtualization is hardware abstraction. Sure, all operating systems tell you that they have some sort of Hardware Abstraction Layer in them and that they can deal with hardware changes without you noticing it. But if you are an administrator, you know this is only partially true. Virtualization offers the advantage that the underlying hardware is virtual and can remain the same, even if you move the virtualized system to a much more powerful host. Another advantage is that you might be able to offload certain necessary services from the OS (like backup) to the host (snapshotting).
</li>
<li>
Shield the operating system, network-wise, from other systems. Yes, that means putting <em>a firewall BEFORE the operating system guest</em> (and definitely not on the OS) which governs all traffic coming in and out of the environment. Only allow connections that are legit. If your organization has a huge network to manage, they might work with network segment filtering instead of IP-level filtering. See if you can get an exception to that &#8211; managing the rules should not give too much overhead since the system, being unsupported and all, is a lot less likely to get many connectivity updates.
</li>
</ul>
<p>
But before finishing off, a hint about stripping an operating system. Stripping is much more than just removing services that are not used. It also means that you look for services that are needed, and see if you can externalize them. Common examples here are logging (send your logs to a remote system rather than keeping them local), e-mail (use simple &#8220;direct-out&#8221; mail) and backup (use a locally scheduled backup tool, or even offload to the host in virtualized systems), but many others exist.
</p>
<p>
Of course, service isolation is not unknown to most people. If you run a large(r) network with Internet-facing services, you probably isolate those in a DMZ environment. That is quite frankly (also) for the same &#8220;risk mitigation&#8221; reason. In case of a security breach, service unavailability or otherwise, you want to reduce the risk that this fault spreads to other systems (be it getting to internal documents or putting more services down).
</p>
<p>
Another aspect administrators do with systems in their DMZ is <em>system hardening</em>, which I will talk about in the third part.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siphos.be/2011/09/mitigating-risks-part-2-service-isolation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

