<?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>Luc Stepniewski&#039;s Blog &#187; security</title>
	<atom:link href="http://www.gradstein.info/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gradstein.info</link>
	<description></description>
	<lastBuildDate>Thu, 29 Dec 2011 22:59:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://www.gradstein.info/?pushpress=hub'/>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Fail2ban Configuration for NGINX anomalies</title>
		<link>http://www.gradstein.info/security/fail2ban-configuration-nginx-anomalies/</link>
		<comments>http://www.gradstein.info/security/fail2ban-configuration-nginx-anomalies/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 22:52:52 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[rules]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=439</guid>
		<description><![CDATA[Fail2ban is a really cool log analyzer (mostly) that can block ips using several different methods (iptables, ipfw, ip route blackhole, etc.). The problem is that you have to define filters (regexes in fact) that will trigger the ban for each service, because each one has a different way to report anomalies. There are not [...]]]></description>
			<content:encoded><![CDATA[<p>Fail2ban is a really cool log analyzer (mostly) that can block ips using several different methods (iptables, ipfw, ip route blackhole, etc.). The problem is that you have to define filters (regexes in fact) that will trigger the ban for each service, because each one has a different way to report anomalies. There are not so much given examples <a href="http://www.fail2ban.org/wiki/index.php/Fail2ban:Community_Portal" title="Fail2ban community portal" class="liexternal">on the official wiki</a>. On other websites I couldn&#8217;t find anything about nginx filters. Even worse, several <a href="http://codelog.climens.net/2011/02/13/using-fail2ban-with-nginx-in-debian/" title="Example of wrong example" class="liexternal">websites</a> report that you can use the filters defined  for Apache2, which is false, they will <strong>NOT</strong> work, the logs are very different.</p>
<p>For example, here is a trace for a non existent requested resource:</p>
<p><code>2011/12/29 16:13:33 [error] 3212#0: *241787 open() "/opt/foo/default/admin/phpmyadmin/index.php" failed (2: No such file or directory), client: 58.19.239.205, server: , request: "GET //admin/phpmyadmin/index.php HTTP/1.1", host: "88.191.135.71"</code></p>
<p>So, to be able to detect such hack tentative and block it, create a file named nginx-noscript.conf, and put:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>Definition<span style="color: #7a0874; font-weight: bold;">&#93;</span>
failregex = open\<span style="color: #7a0874; font-weight: bold;">&#40;</span>\<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #ff0000;">&quot;/\S*(\.php|\.asp|\.exe|\.pl)\S*&quot;</span> failed.<span style="color: #000000; font-weight: bold;">*</span>client: <span style="color: #000000; font-weight: bold;">&lt;</span>HOST<span style="color: #000000; font-weight: bold;">&gt;</span>,.<span style="color: #000000; font-weight: bold;">*</span>
ignoreregex =</pre></div></div>

<p>Then, add its definition in an entry in the /etc/fail2ban/jail.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>nginx<span style="color: #7a0874; font-weight: bold;">&#93;</span>
enabled = <span style="color: #c20cb9; font-weight: bold;">true</span>
port = http,https
filter = nginx-noscript
logpath = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">*/*</span>error.log
maxretry = <span style="color: #000000;">6</span></pre></div></div>

<p>Here, if there are more than 6 occurences of a failed 404 request in less than 600 seconds (<a href="http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Jail_Options" title="Fail2ban Jail options" class="liexternal">the default value</a>, modifiable with the &#8216;findtime&#8217; variable), the ip will be added to the ban list.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/security/fail2ban-configuration-nginx-anomalies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security patching WordPress themes against Cross-Script Attacks (XSS)</title>
		<link>http://www.gradstein.info/security/security-patching-wordpress-themes-against-cross-script-attacks-xss/</link>
		<comments>http://www.gradstein.info/security/security-patching-wordpress-themes-against-cross-script-attacks-xss/#comments</comments>
		<pubDate>Mon, 11 Jun 2007 21:27:02 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/wordpress/security-patching-wordpress-themes-against-cross-script-attacks-xss/</guid>
		<description><![CDATA[A nice article explaining the vulnerability in Worpdress themes (in fact anything using php :-) was published some days ago. Now, there&#8217;s even a vulnerability scanner available (done in Perl). I ran it on several of the blogs I manage, and all of them were vulnerable to XSS (wp-scanner also tests other vulnerabilities) :-( I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/wp-content/uploads/wp_scanner.png" onclick="ps_imagemanager_popup(this.href,'WP Scanner','781','431');return false" onfocus="this.blur()" class="liimagelink"><img src="/wp-content/uploads/.thumbs/.wp_scanner.png" alt="WP Scanner" title="WP Scanner" align="right" width="96" height="53" border="0" /></a>A <a href="http://blogsecurity.net/wordpress/articles/article-070607/" class="liexternal">nice</a> article explaining the vulnerability in Worpdress themes (in fact anything using php :-) was published some days ago. Now, there&#8217;s even a <a href="http://blogsecurity.net/wordpress/tools/wp-scanner/" class="liexternal">vulnerability scanner available</a> (done in Perl).</p>
<p>I ran it on several of the blogs I manage, and <strong>all of them were vulnerable to XSS</strong> (wp-scanner also tests other vulnerabilities) :-(<br />
I followed the advices on blogsecurity&#8217;s website and modified all of the search functions I could find. Now wp-scanner doesn&#8217;t report any vulnerability (<em>it doesn&#8217;t mean it is cracker-proof, but it&#8217;s a good start</em>).</p>
<p>So if anybody else uses the <a href="http://www.deanjrobinson.com/wordpress/redoable" class="liexternal">Redoable theme</a> like me, you should patch the <code>header.php</code> file. Near the top of the file, find the <code>"Search for"</code> string, and enclose the <code>$s</code> string with the <code>htmlspecialchars()</code> method:</p>
<p class="code">Search for &lt;?php echo htmlspecialchars($s); }</p>
<p>Do the same for the <code>searchform.php</code> file:</p>
<p class="code">searchform&#8221; action=&#8221;&lt;?php echo htmlspecialchars($_SERVER['PHP_SELF']);</p>
<p>An even better protection would be to use the <a href="http://www.modsecurity.org/" class="liexternal">mod_security module</a> for Apache/Apache2, which can detect and block these kind of attacks. But this requires that you control your server.<br />
To prevent web visitors from sending tags, you can add the following rule in your virtual host:</p>
<p class="code">SecFilter &#8220;&lt;(.|\n)+&gt;&#8221;</p>
<p>Now, when someone requests &lt; anything &gt;, the visitor gets a 403 error, and in your audit log, you now have:</p>
<p class="code">==36d82a37==============================<br />
Request: www.gradstein.info 82.67.175.56 &#8211; - [11/Jun/2007:11:10:56 +0200] &#8220;GET /?s=%3Cwpscan%3E HTTP/1.1&#8243; 403 202 &#8220;-&#8221; &#8220;Mozilla/5.0&#8243; &#8211; &#8220;-&#8221;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
GET /?s=%3Cwpscan%3E HTTP/1.1<br />
mod_security-message: Access denied with code 403. Pattern match &#8220;<(.|\\n)+>&#8221; at REQUEST_URI [severity "EMERGENCY"]<br />
mod_security-action: 403<br />
HTTP/1.1 403 Forbidden<br />
Content-Length: 202
</p>
<p class="information">Please note, that mod_security does not correct your application. Here if you only use mod_security, WordPress theme will still be vulnerable on the underlaying level. It is OK to use mod_security, but it is much much more advisable to correct the origin of the problem and not cover it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/security/security-patching-wordpress-themes-against-cross-script-attacks-xss/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Security monitoring of Debian alerts is less than practical</title>
		<link>http://www.gradstein.info/debian/security-monitoring-of-debian-alerts-is-less-than-practical/</link>
		<comments>http://www.gradstein.info/debian/security-monitoring-of-debian-alerts-is-less-than-practical/#comments</comments>
		<pubDate>Tue, 12 Sep 2006 14:17:00 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/uncategorized/security-monitoring-of-debian-alerts-is-less-than-practical/</guid>
		<description><![CDATA[I was looking for a program (command-line) that would allow me to check if a Debian system was up to date against all the offical security annoucements (DSA). Something like the program glsa-check which is available for Gentoo systems. I just found two, none of them being really useful: forgotten_name: It works, but the bad [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking for a program (command-line) that would allow me to check if a Debian system<br />
was up to date against all the offical security annoucements (DSA). Something like the program glsa-check which is available for Gentoo systems.</p>
<p>I just found two, none of them being really useful:</p>
<ul>
<li>forgotten_name: It works, but the bad point is that the inner working is to test the upgrade for ALL packages, which is quite slow&#8230;</li>
<li>tiger: They cheated a little, as they made a &#8220;static&#8221; file used to compare to a filesystem.</li>
</ul>
<p>So I decided to make my own. Alas, the people responsible for Debian security<br />
don&#8217;t seem to give any easy way to get the DSA in a stable/correct way.</p>
<p>Here are the different possibilities, and why they&#8217;re hard/impossible to use:</p>
<ul>
<li>There&#8217;s a &#8220;<a href="http://search.debian.org/" class="liexternal">search engine</a>&#8221; that is supposed to allow you to search for CVE entries, but it doesn&#8217;t work (has it worked at one time?) and now you only get a message &#8220;Debian Search disabled&#8221;.</li>
<li>You can get the &#8220;latest&#8221; security alerts (DSA) from the <a href="http://www.debian.org/security/" class="liexternal">Debian security page</a>, even in a <a href="http://www.debian.org/security/dsa" class="liexternal">RDF format</a>. That would be cool, except:<span style="display: block" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"></span>
<ul>
<li>It&#8217;s just the 15 or less last alerts</li>
<li>The contents are just a title, a link, a two words description and the issued date</li>
</ul>
</li>
<li>There is the security-announce mailing list. Not really practical.</li>
</ul>
<p>To correct the problem of the 15 or less entries in the distributed RDF file, I took instead the &#8220;<a href="http://www.debian.org/security/2006/" class="liexternal">year</a>&#8221; page which gives exactly the same thing but in HTML. Some regexp, and we get the same result as the RDFs, but with the whole list of DSAs (but still not enough information).</p>
<p>Next, to get the detailed data, that is, the affected packages and the corrected version numbers (the most important things) we need to download the corresponding DSA page. For example, for the DSA 1174, you would get the content of the page http://www.debian.org/security/2006/dsa-1174 .</p>
<p>Here begins the fun. That page doesn&#8217;t have a static structure at all! Many inconsistencies are making the parsing of the page unreliable.<br />
For example, let&#8217;s just start with the DSA number. For example, for the DSA 1174, you find that on the details page, it&#8217;s 1174-1.</p>
<p>Next, you would think that with the use of templates, that page would have some kind of fixed format. Que nenni! The text is not always the same. For example, the text &#8216;has been fixed in&#8217; isn&#8217;t always formatted the same way.</p>
<p>About the affected packages, you have a paragraph named &#8216;Affected Packages&#8217;, which is inconsistent with the really affected packages (never more that one package), which can be found later in the page in &#8216;Fixed in&#8217;.</p>
<p>Redhat is submitting its alerts to <a href="http://oval.mitre.org/" class="liexternal">OVAL</a>, which uses a really nice format and also gives an interpreter for the language. I saw just one or two messages on the OVAL mailing list about debian :-(</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/debian/security-monitoring-of-debian-alerts-is-less-than-practical/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using memcached

Served from: www.stepniewski.fr @ 2012-02-06 07:51:55 -->
