<?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>Apache &#8211; Phocean.net</title>
	<atom:link href="/tag/apache/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Computer Security Blog</description>
	<lastBuildDate>Fri, 24 Feb 2017 21:17:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.10</generator>
	<item>
		<title>Mitigating Slow HTTP DoS Attacks</title>
		<link>/2010/11/24/mitigating-slow-http-dos-attacks.html</link>
		<pubDate>Wed, 24 Nov 2010 22:54:29 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[DoS]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[RUDY]]></category>
		<category><![CDATA[Slowloris]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=928</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=928</guid>
		<description><![CDATA[Interesting article on the latest Apache and ModSecurity techniques to prevent DoS HTTP attacks. The attacks are well explained. I personally knew about Slowloris but didn&#8217;t about RUDY and post attacks.]]></description>
				<content:encoded><![CDATA[<p><a title="HTTP DoS attacks" href="http://blog.spiderlabs.com/2010/11/advanced-topic-of-the-week-mitigating-slow-http-dos-attacks.html" target="_blank">Interesting article</a> on the latest Apache and ModSecurity techniques to prevent DoS HTTP attacks.</p>
<p>The attacks are well explained. I personally knew about Slowloris but didn&#8217;t about RUDY and post attacks.</p>
]]></content:encoded>
			</item>
		<item>
		<title>Updates on OpenSSL CVE-2009-3555 (client renegociation)</title>
		<link>/2010/04/05/updates-about-openssl-cve-2009-3555-client-renegociation.html</link>
		<comments>/2010/04/05/updates-about-openssl-cve-2009-3555-client-renegociation.html#comments</comments>
		<pubDate>Mon, 05 Apr 2010 08:40:44 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[CVE-2009-3555]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mod-ssl]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=773</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=773</guid>
		<description><![CDATA[So there are some news from the front of OpenSSL CVE-2009-3555 (see this and this for the history). Now the latest version of Apache mod_ssl (2.2) embeds an option to reactivate old way client renegociation : SSLInsecureRenegotiation on Check the official doc for more details. With this option activated, you can now safely upgrade openSSL...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2010/04/05/updates-about-openssl-cve-2009-3555-client-renegociation.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>So there are some news from the front of OpenSSL CVE-2009-3555 (see <a title="SSL client authenticate breakage" href="/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html" target="_self">this</a> and <a title="SSL/TLS RFC updated against CVE-2009-3555" href="/2010/01/09/ssltls-rfc-updated-against-cve-2009-3555.html" target="_self">this</a> for the history).</p>
<p>Now the latest version of Apache mod_ssl (2.2) embeds an <a title="mod_ssl client renegociation" href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslinsecurerenegotiation" target="_blank">option to reactivate old way client renegociation</a> :</p>
<pre>SSLInsecureRenegotiation on</pre>
<p>Check the official doc for more details. With this option activated, you can now safely upgrade openSSL and mod_ssl without breaking your clients. They should have done it from the begining, shouldn&#8217;t they ?</p>
<p>The next step will be to move on to the new protocol definitely, to solve for good the CVE-2009-3555 vulnerability. For that we have to wait for the browsers to support it.</p>
<p>Firefox has started to <a title="Firefox and CVE-2009-3555" href="https://wiki.mozilla.org/Security:Renegotiation" target="_blank">work seriously on it</a> and we can expect some support in the next releases (some settings will be possible through about:config).</p>
<p>They even created a <a title="CVE-2009-3555 test page" href="https://ssltls.de/" target="_blank">test site</a>. This screenshot was taken from Google Chrome (5.0.366.2, <a title="openSUSE repos" href="http://en.opensuse.org/Additional_package_repositories" target="_blank">openSUSE repo</a>) which already has support for the SSL protocol :</p>
<p style="text-align: center;"><a href="/wp-content/uploads/2010/04/chrome-ssl.png" rel="lightbox[773]"><img class="aligncenter size-full wp-image-776" title="chrome-ssl" src="/wp-content/uploads/2010/04/chrome-ssl.png" alt="" width="455" height="473" /></a></p>
]]></content:encoded>
			<wfw:commentRss>/2010/04/05/updates-about-openssl-cve-2009-3555-client-renegociation.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SSL/TLS RFC updated against CVE-2009-3555</title>
		<link>/2010/01/09/ssltls-rfc-updated-against-cve-2009-3555.html</link>
		<pubDate>Sat, 09 Jan 2010 11:23:09 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[IETF]]></category>
		<category><![CDATA[mod-ssl]]></category>
		<category><![CDATA[RFC]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=673</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=673</guid>
		<description><![CDATA[A solution has been finally brought up to fix CVE-2009-3555 and the temporary solution that broke client authentication. At least, the IETF agreed on a fix as Marsh Ray informs us, though it will still take some weeks for the whole validation process to complete. Moreover, as it requires both the servers and the clients...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2010/01/09/ssltls-rfc-updated-against-cve-2009-3555.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>A solution has been finally brought up to fix<a href="/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html"> CVE-2009-3555 and the temporary solution that broke client authentication</a>.</p>
<p>At least, the IETF agreed on a fix as <a title="SSL/TLS fix" href="http://extendedsubset.com/?p=14" target="_blank">Marsh Ray</a> informs us, though it will still take some weeks for the whole validation process to complete.</p>
<p>Moreover, as it requires both the servers and the clients to be patched, it will take months before the patches can be applied and one can have a working client authentification architecture. The longest will be the client side, of course, so I feel sorry for those who have a large park to manage.</p>
<p>As far as I am concerned, fortunately, I will just have a few browsers that I manage directly to update. Anyway, still more patience is needed !</p>
]]></content:encoded>
			</item>
		<item>
		<title>waf00f</title>
		<link>/2009/12/16/waf00f.html</link>
		<pubDate>Wed, 16 Dec 2009 22:40:09 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Fingerprinting]]></category>
		<category><![CDATA[httprint]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[scanner]]></category>
		<category><![CDATA[Waf]]></category>
		<category><![CDATA[waf00f]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=571</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=571</guid>
		<description><![CDATA[waf00f is another nice fingerprinting tool. It is a good complement to a tool like httprint. It is able to detect Web Application Firewalls. Its output can help you to determine the trust you can have in what httprint or any other web server fingerprinting tool found out. Check it there.]]></description>
				<content:encoded><![CDATA[<p><strong>waf00f</strong> is another nice fingerprinting tool.<br />
It is a good complement to a tool like httprint. It is able to detect Web Application Firewalls.<br />
Its output can help you to determine the trust you can have in what httprint or any other web server fingerprinting tool found out.<br />
Check it <a title="waf00f" href="http://pentestit.com/2009/07/10/wafw00f-fingerprint-web-application-firewall/" target="_blank">there</a>.</p>
]]></content:encoded>
			</item>
		<item>
		<title>ModSecurity 2.5 review</title>
		<link>/2009/12/10/modsecurity-2-5-review.html</link>
		<pubDate>Thu, 10 Dec 2009 14:12:56 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[ModSecurity]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=555</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=555</guid>
		<description><![CDATA[I finished reading the ModSecurity 2.5 book, written by Magnus Mischell and published by Packt Publishing. I found a lot of interest reading it as I was already using ModSecurity &#8211; and I think anyone exposing an Apache web server should. I was actually using it partially. It is not trivial to secure a web...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2009/12/10/modsecurity-2-5-review.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>I finished reading the <strong>ModSecurity 2.5</strong> book, written by <strong>Magnus Mischell</strong> and published by <strong>Packt Publishing</strong>.</p>
<p style="text-align: center;"><a title="Modsecurity 2.5" href="http://www.packtpub.com/modsecurity-2-5/book" target="_blank"><img class="size-full wp-image-521  aligncenter" title="ModSecurity 2.5" src="/wp-content/uploads/2009/11/1847194745.js" /></a></p>
<p>I found a lot of interest reading it as I was already using ModSecurity &#8211; and I think anyone exposing an Apache web server should.<br />
I was actually using it partially. It is not trivial to secure a web application, and the rule engine of ModSecurity is very powerful but it is also quite complex.</p>
<p>So this book was a good opportunity for me to dig into it further.</p>
<p>The book covers all topics : from the set-up to a real use-case.<br />
The author explains how to write rules, how to deal with the performance impact, logging and gives us a range of various core rules to implement to get a good security basis.</p>
<p>The difficulty goes up progressively and the author doesn&#8217;t forget the beginners.<br />
The set-up of the module is precisely described. All requirements are also explained and there are some good recalls about regular expressions, common attacks on systems, server and client sides, and other stuff like that.</p>
<p>After reading the book, I could harden my rules, reorganize and optimize them for better performance &#8211; something I hadn&#8217;t cared about before.</p>
<p>So I have nothing else to say but to recommend this book.<br />
It is definitely <strong>a great handbook about ModSecurity</strong> that&#8217;s worth having next to you. The variety of configuration patterns makes it a reference.</p>
<p>Check it <a title="Modsecurity 2.5" href="http://www.packtpub.com/modsecurity-2-5/book" target="_blank">there</a>. I also appreciated the availability of PDF version, so that I can carry it everywhere with my laptop and index it with Beagle.</p>
]]></content:encoded>
			</item>
		<item>
		<title>OpenSSL : CVE-2009-3555 security fix and mod_ssl client authentication breakage</title>
		<link>/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html</link>
		<comments>/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html#comments</comments>
		<pubDate>Sat, 28 Nov 2009 16:08:50 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[openSUSE]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[Vulnerability]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=524</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=524</guid>
		<description><![CDATA[A security advisory on OpenSSL has recently been published. Details are there and there. It is vulnerable to a MiTM attack where the attacker can intercept and retrieve the credential to a trusted HTTPS website, by intercepting the session cookie sent back to the client. A proof of concept of an attack against Twitter was...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>A security advisory on OpenSSL has recently been published. Details are <a title="CVE-2009-3555" href="http://secunia.com/advisories/cve_reference/CVE-2009-3555/">there</a> and <a title="renegociation vulnerability" href="http://www.securegoose.org/2009/11/tls-renegotiation-vulnerability-cve.html">there</a>.</p>
<p>It is vulnerable to a <strong>MiTM attack </strong>where the attacker can intercept and retrieve the credential to a trusted HTTPS website, by intercepting the session cookie sent back to the client.</p>
<p>A proof of concept of an attack against Twitter was made.</p>
<p>Fine. But so far, <strong>the answer was to just disable any renegociation</strong>.</p>
<p>This actually causes some issues with SSL session timeout and totally broke client authentication.</p>
<p>I got into problems because of the latter. I am using client authentication for some location of my web server, and I recently could not connect anymore to these with the following log in apache :</p>
<pre>[Tue Nov 24 16:56:15 2009] [debug] ssl_engine_kernel.c(1912): OpenSSL:Exit: error in SSLv3 read client hello A
[Tue Nov 24 16:56:15 2009] [error] [client x.x.x.x] Re-negotiation handshake failed: Not accepted by client!?</pre>
<p>I first was not aware of the openssl patch and tried almost anything possible. My focus was, of course, on the certificate and the client.<br />
But, a nice guy on IRC #suse,<strong> Stittel</strong>, had a good hunch and suggested me to look at the CVE-2009-3555 fix.</p>
<p>After more tests, it was quickly confirmed to work well with older versions of OpenSSL (as shipped in Debian Lenny).<br />
Finally, I downgraded the OpenSSL version on my openSUSE box to a version prior to the CVE-2009-3555 fix and it just worked fine.</p>
<p>Then, I dig into it and found a lot of interesting reports <a href="https://bugzilla.redhat.com/show_bug.cgi?id=533125" target="_blank">there</a> and <a href="http://old.nabble.com/TLS-renegotiation-disabling-:-mod_ssl-and-OpenSSL--0.9.8l-td26285568.html" target="_blank">there</a>. So far it is a real mess.<br />
In short, the breakage will stay as long as browsers don&#8217;t also include a patch to avoid renegotiation.<br />
So far, I could not find a browser that does include a patch.<br />
If anyone reading it knows a version that does it, please let me know.</p>
<p>Meanwhile, you have actually the choice between :</p>
<ul>
<li>low security by deactivating client authentication on your server</li>
<li>low security by keeping a vulnerable version of OpenSSL</li>
</ul>
<p>As my server is not very exposed, I chose the latter, but that&#8217;s not satisfying.  It is not recommended, but if like me you need to use client authentication with mod_ssl on openSUSE 11.2, do :</p>
<pre>% zypper install --from repo-oss openssl openssl-certs libopenssl0_9_8 libopenssl0_9_8-32bit</pre>
<p>where repo-oss is the alias to the 11.2 release (without updates) on your system.</p>
<p>What a brutal way to fix an issues without much notification and consideration to the users ! Even the log message is wrong and just confusing the administrator&#8230;</p>
<p><em>PS 1 : thanks again to Stittel for the good hint (I hope you will come by here) and to the always nice and helpful #suse channel in general ;)</em></p>
<p><em>PS 2 : <a href="https://bugzilla.novell.com/show_bug.cgi?id=558176" target="_blank">bug reported</a> on openSUSE bugzilla</em></p>
]]></content:encoded>
			<wfw:commentRss>/2009/11/28/openssl-cve-2009-3555-security-fix-and-mod_ssl-client-authentication-breakage.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New book about ModSecurity</title>
		<link>/2009/11/15/new-book-about-modsecurity.html</link>
		<pubDate>Sun, 15 Nov 2009 13:49:48 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Injection]]></category>
		<category><![CDATA[mod-security]]></category>
		<category><![CDATA[ModSecurity]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=520</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=520</guid>
		<description><![CDATA[There will be a new book about mod-security coming out :  ModSecurity 2.5. ModSecurity is essential when it comes to secure any web site. It will make the work of the attacker much harder and  it may save you even if your favorite dynamic pages have a security hole. However, it must be configured wisely...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2009/11/15/new-book-about-modsecurity.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>There will be a new book about mod-security coming out :  <a title="Modsecurity 2.5" href="http://www.packtpub.com/modsecurity-2-5/book" target="_blank">ModSecurity 2.5</a>.</p>
<p style="text-align: center;"><a href="/wp-content/uploads/2009/11/1847194745.js" /></a></p>
<p>ModSecurity is essential when it comes to secure any web site.</p>
<p>It will make the work of the attacker much harder and  it may save you even if your favorite dynamic pages have a security hole.<br />
However, it must be configured wisely to be efficient. It is just a firewall that works at the application layer : you need to know the attacker point of view and the basics before writing any mod-security rules, otherwise at best it will useless (and at worst, it will kick legitimate traffic off).</p>
<p>So, stay tuned :  I will talk more about the ModSecurity stuff and publish a review about this book soon.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">http://www.packtpub.com/modsecurity-2-5/book</div>
]]></content:encoded>
			</item>
		<item>
		<title>How to stop Firefox from prompting for the client certificate</title>
		<link>/2008/11/16/how-to-stop-firefox-from-prompting-for-the-client-certificate.html</link>
		<comments>/2008/11/16/how-to-stop-firefox-from-prompting-for-the-client-certificate.html#comments</comments>
		<pubDate>Sun, 16 Nov 2008 22:46:33 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mode-ssl]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=303</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=303</guid>
		<description><![CDATA[I am using a client certificate to authenticate against some Apache HTTPS website. By default, Firefox 3 has a very annoying setting : it will prompt you with a box to select your certificate, every time the browser access to a file. I quickly realized that there is not setting in the preference tab to...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2008/11/16/how-to-stop-firefox-from-prompting-for-the-client-certificate.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>I am using a client certificate to authenticate against some Apache HTTPS website.</p>
<p>By default, Firefox 3 has a very annoying setting : it will prompt you with a box to select your certificate, every time the browser access to a file.</p>
<p>I quickly realized that there is not setting in the preference tab to change this behavior. That sucks, really !</p>
<p>Fortunately, it is possible to tweak it within the <strong>about:config</strong> page. Set the <strong>security.default_personal_cert entry</strong> with <em><strong>Select Automatically</strong></em> instead of <em><strong>Ask Every Time</strong></em>.</p>
<p>But what a dumb behavior !</p>
<p>It is like the alert page that Firefox displays every time a self-signed certificate is used. I am now wondering if the developers really understood well what a certificate is !</p>
<div id="attachment_304" style="width: 310px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2008/11/capture-1.png" rel="lightbox[303]"><img class="size-medium wp-image-304" title="Setting Firefox properly for Client certificate" src="/wp-content/uploads/2008/11/capture-1.png" alt="Setting Firefox properly for Client certificate" width="300" height="187" /></a><p class="wp-caption-text">Setting Firefox properly for Client certificate</p></div>
]]></content:encoded>
			<wfw:commentRss>/2008/11/16/how-to-stop-firefox-from-prompting-for-the-client-certificate.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How-to : Mod-security 2 set-up for Apache 2</title>
		<link>/2008/07/13/how-to-mod-security-2-set-up-for-apache-2.html</link>
		<pubDate>Sun, 13 Jul 2008 01:13:54 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[mod-security]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[regxp]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=114</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=114</guid>
		<description><![CDATA[Mod-security is a security proxy for Apache. It adds a frontal layer filtering unwanted clients, malformed packets and malicious requests. It is especially usefull if your website is dynamic, involving php, sql, javascript, etc. With such a complex environment, as you can never be sure that your website is not vulnerable or up-to-date enough, something...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2008/07/13/how-to-mod-security-2-set-up-for-apache-2.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>Mod-security is a security proxy for Apache. It adds a frontal layer filtering unwanted clients, malformed packets and malicious requests.</p>
<p>It is especially usefull if your website is dynamic, involving php, sql, javascript, etc. With such a complex environment, as you can never be sure that your website is not vulnerable or up-to-date enough, something like mod-security provides an interesting extra-security layer.<br />
<span id="more-114"></span></p>
<p>Due to license issues, mod-security is no more shipped with Debian &#8211; it was until Debian Sarge.</p>
<p>Fortunately, the Debian maintainer continue to provide some packages on his website.</p>
<p>So, the easy way to set up mod-security on your Debian system is to add this line in your <strong>/etc/apt/source.list</strong> file :</p>
<pre lang="bash">$ echo "deb http://etc.inittab.org/~agi/debian/libapache-mod-security2/ etch/" >> /etc/apt/source.list</pre>
<p>
Then type in the usual sequence :</p>
<pre lang="bash">$ aptitude update && aptitude install libapache-mod-security2</pre>
<p>You could also download the source from <a title="mod-security" href="http://www.modsecurity.org/download/index.html">the official website</a>.<br />
<br />
Once it is done, comes the configuration part. The configuration is critical because any mistake on it will make it at best useless, or at worst blocking your website.<br />
You have the choice between creating your rules from scratch or getting some ready made.<br />
Creating your rules will require a lot of time and expertise in the http protocol, php, sql, and any other service that you offer with Apache.<br />
That was not really my case, so I started to look for some ready made rules on google. I could not get good ones. Most of tutorial gives only some very basic and incomplete rules : useless. I found a good paper, notably containing some specific rules for WordPress, but the rules were written for mod-security v1 whereas it is now in its second version.<br />
Oh, did I forget to tell you ? Most of the syntax was changed between the two versions !!! Not very nice, even if it was worth doing it.</p>
<p>Finally, I came to find a way with the rules provided by this website, <a title="Go Root ? mod-security rules" href="http://gotroot.com/tiki-index.php?page=Setup+of+mod_security">Got Root ?</a>. They provide quite up-to-date rules, with a delay of 30 days subscription-free, which is quite acceptable for what I want to do. After all, Php exploits and Sql injection technics don&#8217;t change every day.</p>
<p>The rules are also complete and spread over several files, one for each category in : generic rules, blacklist, usergents, proxies, rootkits&#8230;</p>
<p>We can fetch them with a little script. They suggest to add it as a cron job, but you <strong><em>should not</em></strong>, except if you don&#8217;t mind that your website becomes unavailable ! These rules always require testing, some of them may be broken or require customizing&#8230; be careful and always check what&#8217;s inside the rule files !</p>
<p>Here is the small script, <strong>modsec.sh</strong>, that I made to retrieve the rules and put them in the right directory :</p>
<pre lang="bash">#!/bin/sh

wget http://www.gotroot.com/downloads/ftp/mod_security/2.0/apache2/apache2-gotrootrules-modsec2.0-latest.tar.gz
if [ -e apache2-gotrootrules-modsec2.0-latest.tar.gz ]
then
tar -xzvf apache2-gotrootrules-modsec2.0-latest.tar.gz -C /etc/apache2/modsecurity/
fi
rm apache2-gotrootrules-modsec2.0-latest.tar.gz
/etc/init.d/apache2 restart</pre>
<p>
Make it executable and run it :</p>
<pre lang="bash"># chmod +x modsec.sh
$ ./modsec.sh</pre>
<p>
Now, let&#8217;s edit the <strong>/etc/apache2/apache2.conf </strong>file.</p>
<p>Just before these lines (probably at the bottom of the file) :</p>
<pre lang="bash"># Include the virtual host configurations:
Include /etc/apache2/sites-enabled/</pre>
<p>
Add these :</p>
<pre lang="bash">#Turn the filtering engine On or Off
SecRuleEngine On
SecRequestBodyAccess On
SecResponseBodyAccess Off

# Handling of file uploads
# TODO Choose a folder private to Apache.
# SecUploadDir /opt/apache-frontend/tmp/
SecUploadKeepFiles Off

# Maximum request body size we will
# accept for buffering
SecRequestBodyLimit 131072
# Store up to 128 KB in memory
SecRequestBodyInMemoryLimit 131072
# Buffer response bodies of up to
# 512 KB in length
SecResponseBodyLimit 524288

SecDebugLog /var/log/apache2/modsec_debug.log
SecDebugLogLevel 0
# Serial audit log
SecAuditEngine RelevantOnly
SecAuditLogRelevantStatus ^5
SecAuditLogParts ABIFHZ
SecAuditLogType Serial
SecAuditLog /var/log/apache2/modsec_audit.log

#should mod_security inspect POST payloads
#SecRuleScanPOST On

# by default log and deny suspicious requests with HTTP status 500
SecDefaultAction log,auditlog,deny,status:403,phase:2,t:none

#First, add in your exclusion rules:
#These MUST come first!
Include /etc/apache2/modsecurity/exclude.conf

#Application protection rules
Include /etc/apache2/modsecurity/rules.conf

#Comment spam rules
Include /etc/apache2/modsecurity/blacklist.conf

#Bad hosts, bad proxies and other bad players
Include /etc/apache2/modsecurity/blacklist2.conf

#Bad clients, known bogus useragents and other signs of malware
Include /etc/apache2/modsecurity/useragents.conf

#Known bad software, rootkits and other malware
Include /etc/apache2/modsecurity/rootkits.conf

#Signatures to prevent proxying through your server
#only rule these rules if your server is NOT a proxy
#Include /etc/apache2/modsecurity/proxy.conf

#Additional rules for Apache 2.x ONLY!  Do not add this line if you use Apache 1.x
Include /etc/apache2/modsecurity/apache2-rules.conf</pre>
<p>As you can see, we just include the rule files we just downloaded. You can easily activate or deactivate some to fit your needs.</p>
<p>You will probably notice that there is a performance impact after activating mod-security &#8211; not so big to me, but it also depends on your traffic. It is up to you to optimize the number of activated rules to make it faster.</p>
<p>If some page appear to be blocked, check the<strong> /var/log/apache2/error.log </strong>for something like :</p>
<pre lang="text">[Fri Jul 11 19:33:08 2008] [error] [client 192.168.222.21] ModSecurity: Access
denied with code 500 (phase 2). Match of "rx ^HTTP/(0\\\\.9|1\\\\.0|1\\\\.1|1\\
\\.2)$" against "REQUEST_PROTOCOL" required. [<strong>id "340000"</strong>] [msg "Bad HTTP Proto
col"] [severity "ALERT"] [hostname "www.phocean.net"] [uri "/"] [unique_id "72F
col"] [severity "ALERT"] [hostname "www.phocean.net"] [uri "/"] [unique_id "72F
mG38AAAEAACa@AVUAAAAA"]</pre>
<p>The ID number of the blocking rule is given. Just grep to find the faulty rule and correct / deactivate it :</p>
<pre lang="bash">$ grep 340000 /etc/apache2/modsecurity</pre>
<p>Regxp knowledge required ! :D</p>
]]></content:encoded>
			</item>
	</channel>
</rss>
