<?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>Aconiac Security Group Blog &#187; Tips &amp; Tricks</title>
	<atom:link href="http://blog.aconiac.com/category/tips-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.aconiac.com</link>
	<description>The official Aconiac company blog</description>
	<lastBuildDate>Wed, 19 May 2010 16:12:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Google isn&#8217;t sniffing &#8211; people are shouting!</title>
		<link>http://blog.aconiac.com/2010/05/19/google-isnt-sniffing-people-are-shouting/</link>
		<comments>http://blog.aconiac.com/2010/05/19/google-isnt-sniffing-people-are-shouting/#comments</comments>
		<pubDate>Wed, 19 May 2010 16:12:05 +0000</pubDate>
		<dc:creator>Michael Lind Mortensen</dc:creator>
				<category><![CDATA[Advice]]></category>
		<category><![CDATA[Politics]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[anonymity]]></category>
		<category><![CDATA[espionage]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[threats]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[vulnerabilities]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://blog.aconiac.com/?p=380</guid>
		<description><![CDATA[As some of you may have noticed, Google has received some heat the last couple of weeks due to claims that they intercepted private data from open wifi-networks when driving around to complete Google Street View coverage. One of the many articles on this subject can be found here: http://www.computerworld.com/s/article/9176810/Google_stops_sniffing_Wi_Fi_data_after_privacy_gaffe First off: I am very [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.aconiac.com/wp-content/uploads/2010/05/Google.png"><img class="alignleft size-medium wp-image-382" style="margin: 5px;" title="Google logo" src="http://blog.aconiac.com/wp-content/uploads/2010/05/Google-300x108.png" alt="" width="300" height="108" /></a>As some of you may have noticed, Google has received some heat the last couple of weeks due to claims that they intercepted private data from open wifi-networks when driving around to complete Google Street View coverage. One of the many articles on this subject can be found here: <a href="http://www.computerworld.com/s/article/9176810/Google_stops_sniffing_Wi_Fi_data_after_privacy_gaffe">http://www.computerworld.com/s/article/9176810/Google_stops_sniffing_Wi_Fi_data_after_privacy_gaffe</a></p>
<p>First off: I am very much against any form of privacy infringement and believe quite strongly that most forms of proactive surveillance against non-criminals are futile at best and damaging for national security at worst. However this whole case is just somewhat ridiculous.</p>
<p>Yes, Google made a mistake in not disabling that specific piece of software, but calling the data they gathered private is a bit of a joke. What they gathered was data sent unencrypted over a public network. If you&#8217;re sending confidential information over a public network unencrypted, Google stealing your deep-dark secrets is the least of your worries. They did it by mistake &#8211; many others do it intentionally!</p>
<p>In fact where I&#8217;m sitting right now, I can see no less than 7 open wifi-networks. Most are private homes and most of them have, according to <a href="http://www.kismetwireless.net/">Kismet</a>, traffic flowing over them right now. This means that if I wanted to, I could activate software like <a href="http://www.kismetwireless.net/">Kismet</a> or <a href="http://www.wireshark.org/">Wireshark</a> and use this to steal every single bit of unencrypted data sent over this network. In fact, I would be able to do this with almost no chance of ever being detected in doing so. Even if the network owners tried to catch me, they most likely would not be able to. That&#8217;s simply how easy and risk-free it is.</p>
<p>The reason why I can do this, is because wifi-networks work by transmitting data outward on a given frequency and then let all clients in that network receive all data. It&#8217;s then the client&#8217;s computer that needs to filter out what was meant for it and what was meant for everyone else. If a computer behaves &#8220;nicely&#8221; it&#8217;ll discard anything not meant for it, but if it&#8217;s been put up to intentionally receive everything, you&#8217;ve created a so called &#8220;sniffer&#8221; and all unencrypted data is up for graps.</p>
<p>While software like <a href="http://www.wireshark.org/">Wireshark</a> allows you to only &#8220;sniff&#8221; data sent over the network you&#8217;re connected to, <a href="http://www.kismetwireless.net/">Kismet</a> let&#8217;s you &#8220;sniff&#8221; from any network without ever connecting to that network. This effectively makes you completely invisible to the network owners, so they have no way of knowing, that you&#8217;re stealing everything they send.</p>
<p>Sadly, most users are completely oblivious to these facts and use open networks as if they we&#8217;re their home networks. And sadly in some cases they even are (as was the case with most of the 7 networks here). So effectively, when Google was driving around gathering private data from open wifi-networks, they weren&#8217;t really &#8220;sniffing&#8221; because they had no intention of gathering that data. The users on those networks were however shouting every single bit of so called &#8220;private&#8221; information in all directions, forcing Google wifi-analysis software to capture and save it.</p>
<p>Now, to be fair: Google weren&#8217;t really being smart here and should not have captured data sent over unencrypted networks. It was a bad move and while they didn&#8217;t intend to do so, it probably still didn&#8217;t give them a boost in their reputation!</p>
<p>That being said, I must however still say, that the real problem here is the user and the open networks. If you don&#8217;t want your data to be scooped up by Google, don&#8217;t send it unencrypted over an open network. Chances are someone far worse than Google is listening in &#8211; especially if it&#8217;s a public network near train stations or the like. Sending data over a open wifi-network is, for all intents and purposes, the equivalent of shouting the same information out your office window.</p>
<p>Back in April 2010 we published a blog post describing <a href="http://blog.aconiac.com/2010/04/15/the-secure-way-of-working-from-open-wifi-networks/">the secure way of working from open wifi-networks</a> &#8211; We recommend you read up on that and use the techniques mentioned there in order to keep private data private in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.aconiac.com/2010/05/19/google-isnt-sniffing-people-are-shouting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The secure way of working from open wifi-networks</title>
		<link>http://blog.aconiac.com/2010/04/15/the-secure-way-of-working-from-open-wifi-networks/</link>
		<comments>http://blog.aconiac.com/2010/04/15/the-secure-way-of-working-from-open-wifi-networks/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 00:09:15 +0000</pubDate>
		<dc:creator>Michael Lind Mortensen</dc:creator>
				<category><![CDATA[Advice]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[threats]]></category>
		<category><![CDATA[vulnerabilities]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://blog.aconiac.com/?p=353</guid>
		<description><![CDATA[Have you ever been on the road towards a meeting or a vacation, and then just suddenly stumbled upon an open network while waiting for a plane or drinking a cup of coffee? Most people probably have.. And have you even been a bit too tempted and logged onto this open network? Again, most probably [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.aconiac.com/wp-content/uploads/2010/04/918474_11530083.jpg"><img class="alignleft size-medium wp-image-354" style="margin-left: 5px; margin-right: 5px; margin-bottom: 5px;" title="How to use Wireless networks securely" src="http://blog.aconiac.com/wp-content/uploads/2010/04/918474_11530083-300x225.jpg" alt="" width="300" height="225" /></a>Have you ever been on the road towards a meeting or a vacation, and then just suddenly stumbled upon an open network while waiting for a plane or drinking a cup of coffee? Most people probably have..</p>
<p>And have you even been a bit too tempted and logged onto this open network? Again, most probably have.</p>
<p>Now, have you then started working while on this network and directly sent corporate information or handled information on your corporate systems? Sadly, many have and if you&#8217;re one of them: Read on! Using open networks directly for sensitive data (like corporate data) is a big security no-no!</p>
<p>So why would this be a problem? Isn&#8217;t it just free internet for the masses? Well, yes and no. Yes it&#8217;s probably a network you are completely free to use. It might even be a network owned by the office building, hotel, airport or which ever company you&#8217;re at. But due to the way wifi-networks are designed, everything you send over this network is completely public. Every person, on the network or simply in the vicinity, can easily set up a simple network scanner like Wireshark or Kismet and directly save all the information you send over this network, including all e-mails, websites you visit, data you send to websites, data you receive &#8211; plain and simply everything! And you have no way of detecting this! None what so ever! There is absolutely no way to check for eavesdroppers on an open unencrypted network.</p>
<p>To add insult to injury, eavesdropping on a network is extremely easy to do and there are several easy to use tools out there that hordes of 15 year old script kiddies love to use to steal as much information as they possibly can &#8211; for no other reason than: They can!</p>
<p>So are we advocating not using public open wifi-networks? No, not at all &#8211; you just need to use them correctly!</p>
<p>You can look at it like this: A public open wifi-network gives you a gateway on which you can build a connection to your workplace and work from there. How do you do this? Well basically there are several solutions here:</p>
<ul>
<li><strong>Make the network encrypted.</strong><strong><br />
</strong><strong> </strong><strong><span style="font-weight: normal;">Well normally you won&#8217;t have the option of doing this, but in most cases it is simply better to keep smaller networks encrypted and then only use encrypted networks. Preferably using WPA2-PSK or WPA-Enterprise as encryption schemes.</span></strong><strong> </strong>This is however most likely not a possible solution!</li>
<li><strong>Use a VPN connection<br />
<span style="font-weight: normal;">A VPN (</span></strong>Virtual Private Network) is a technology with which you can remotely connect to your organization&#8217;s network in a completely encrypted manner. It is by far the most transparently secure solution available and is generally the one we would suggest to companies wanting their employees to be mobile always.<br />
There are several VPN solutions available out there, including big corporate solutions from companies like Cisco and open source solutions like OpenVPN.</li>
<li><strong>Access resources with SSL/TLS<br />
<span style="font-weight: normal;">While VPN applies to all network traffic sent from your computer, there is also the other option of encrypting critical parts of your work like e-mail, FTP access, critical websites etc. There are protocols to support this for almost all the different kinds of traffic including: POP3S and IMAPS for email, SFTP for FTP and HTTPS for websites.<br />
Using this solution may in many ways be simpler, but it assumes you know beforehand every place from which you will be needing critical information. It also puts a considerable extra security concern onto the individual employee, since this person now has to deduce whether or not the given communication he/she is doing at the moment is secure or not. Using VPN, these concerns go away in most cases.</span></strong></li>
<li><strong>Remote desktop solutions<br />
</strong><strong><span style="font-weight: normal;">Another option, that&#8217;s somewhat similar to the VPN option, is to have the employee make a secure connection to a server at the workplace and from there open up a terminal service running another computer remotely. Solutions like this are available in many forms like VNC, RDP and proprietary solutions from companies like Citrix. This gives the employee a remote view of his/her workstation desktop even though he/she is no way near the actual office and, most importantly, it makes it possible for him/her to work securely from any network.</span></strong></li>
</ul>
<p>So you can look at it like this: If you&#8217;re not doing any of the above, you have a problem and should take it up with your company in order to get a security policy on the matter and making it safe for the company to work from anywhere! Mobility is one of the top priorities in business these days, and you really want to use the opportunities laid before you well, without screwing yourself because of bad security.</p>
<p>So remember: Public open networks aren&#8217;t bad, but you need to keep your assets safe while using them!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.aconiac.com/2010/04/15/the-secure-way-of-working-from-open-wifi-networks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New OWASP guide: Secure Application Development on Facebook</title>
		<link>http://blog.aconiac.com/2010/04/06/new-owasp-guide-secure-application-development-on-facebook/</link>
		<comments>http://blog.aconiac.com/2010/04/06/new-owasp-guide-secure-application-development-on-facebook/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 21:15:50 +0000</pubDate>
		<dc:creator>Michael Lind Mortensen</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[OWASP]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[social networks]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://blog.aconiac.com/?p=321</guid>
		<description><![CDATA[As we&#8217;ve covered in an earlier blogpost (http://blog.aconiac.com/2009/07/29/ruby-on-rails-security-guide/) OWASP is an organization working to improve web application security in the entire world, by means of a whole bunch of different free projects for developers, security professionals and end users. A few weeks ago, OWASP released a guide/article with the title &#8220;Secure Application Development on Facebook&#8221;,  basically giving [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.aconiac.com/wp-content/uploads/2010/04/FacebookSec.jpg"><img class="alignleft size-full wp-image-323" style="margin: 5px;" title="Facebook Security" src="http://blog.aconiac.com/wp-content/uploads/2010/04/FacebookSec.jpg" alt="Property of Facebook © 2010" width="200" height="258" /></a>As we&#8217;ve covered in an earlier blogpost (<a href="http://blog.aconiac.com/2009/07/29/ruby-on-rails-security-guide/">http://blog.aconiac.com/2009/07/29/ruby-on-rails-security-guide/</a>) OWASP is an organization working to improve web application security in the entire world, by means of a whole bunch of different free projects for developers, security professionals and end users.</p>
<p>A few weeks ago, OWASP released a guide/article with the title &#8220;Secure Application Development on Facebook&#8221;,  basically giving an outline of the security concerns involved in Facebook App development and how to make sure your application is sufficiently secure.</p>
<p>The guide/article can be found here: <a href="http://www.owasp.org/index.php/Facebook">http://www.owasp.org/index.php/Facebook</a>. The document is mainly designed for Facebook App developers, but can also be useful for decision makers wanting to understand the security architecture on Facebook (however certain sections should probably be skipped).</p>
<p>We highly recommend any company interested in Facebook Apps to read the guide from start to finish, and make it mandatory training for all Facebook related developers.</p>
<p>This is just one of many wonderful OWASP projects and in future blog posts we will look at some of the other great tools that are available to you, completely free of charge. If for some reason you don&#8217;t want to wait for these future blog posts, you can also just take a peak the the available projects straight away at: <a href="http://www.owasp.org/index.php/Category:OWASP_Project">http://www.owasp.org/index.php/Category:OWASP_Project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.aconiac.com/2010/04/06/new-owasp-guide-secure-application-development-on-facebook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Security Guide</title>
		<link>http://blog.aconiac.com/2009/07/29/ruby-on-rails-security-guide/</link>
		<comments>http://blog.aconiac.com/2009/07/29/ruby-on-rails-security-guide/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 00:47:07 +0000</pubDate>
		<dc:creator>Michael Lind Mortensen</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[vulnerabilities]]></category>

		<guid isPermaLink="false">http://blog.aconiac.com/?p=273</guid>
		<description><![CDATA[As is sadly often the case, well-meaning newcomers to programming take on the newest and/or most popular programming language/framework available. And as you might suspect, they usually get it wrong and make every design and security mistake possible along the way! This is a trend that we&#8217;ve seen with pretty much every popular programming language [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-276" title="Ruby on Rails logo" src="http://blog.aconiac.com/wp-content/uploads/2009/07/Ruby_on_Rails_logo-252x300.jpg" alt="Ruby on Rails logo" width="252" height="300" />As is sadly often the case, well-meaning newcomers to programming take on the newest and/or most popular programming language/framework available. And as you might suspect, they usually get it wrong and make every design and security mistake possible along the way!</p>
<p>This is a trend that we&#8217;ve seen with pretty much every popular programming language out there &#8211; like for example PHP, which sadly still holds the record for most insecure websites written in the language.</p>
<p id="firstHeading">One very popular web framework these days is Ruby on Rails, created by the very talented 29 year old Danish guy David Heinemeier Hansson. It uses a Model-View-Controller construction and emphasizes good design by such principles as DRY (Don&#8217;t Repeat Yourself). By all means it&#8217;s a very good web framework! But as with PHP, a lot of newcomers get it wrong. Either by not following the Ruby on Rails conventions or by ignoring security!</p>
<p>Now, we&#8217;re not here to teach you about design. If you want to learn more about proper software design, a good place to start is simply your local library. Look for books on topics like Design Patterns, Software Engineering, Extreme Programming, Test Driven Development and Agile Software Development.</p>
<p>However what we do want to teach you about, is proper security in Ruby on Rails! Luckily, we don&#8217;t have to take out extreme amounts of time from the work we need to do, to get you trained in RoR security &#8211; instead we can simply refer to the work already done by the OWASP organization. OWASP is an organization working to improve web application security in the entire world, by means of a whole bunch of different projects for developers, security professionals and end users. One of these projects is the <a title="Ruby on Rails Security Guide" href="http://www.owasp.org/index.php/Category:OWASP_Ruby_on_Rails_Security_Guide_V2">Ruby on Rails Security Guide V2 project</a> which includes a PDF file detailing the different security concerns and solutions concerning Ruby on Rails development.</p>
<p>If you are going to develop Ruby on Rails applications (or if you&#8217;re simply curious) please download the <a href="http://www.owasp.org/index.php/Category:OWASP_Ruby_on_Rails_Security_Guide_V2">Ruby on Rails Security Guide</a> from OWASP and read it before doing any production deployment of applications.</p>
<p>Note: If you&#8217;re too busy to go to the project page on OWASP and find the download link, then here&#8217;s a direct download link instead: <a title="Download the Security Guide directly" href="https://www.owasp.org/images/8/89/Rails_Security_2.pdf">Download the Security Guide</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.aconiac.com/2009/07/29/ruby-on-rails-security-guide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to: Protect your server from insecure php scripts</title>
		<link>http://blog.aconiac.com/2009/07/03/how-to-protect-your-server-from-insecure-php-scripts/</link>
		<comments>http://blog.aconiac.com/2009/07/03/how-to-protect-your-server-from-insecure-php-scripts/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 23:39:27 +0000</pubDate>
		<dc:creator>Michael Lind Mortensen</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.aconiac.com/?p=246</guid>
		<description><![CDATA[If you&#8217;ve ever programmed anything in PHP before, you&#8217;ve probably had situations where you needed to be careful with your scripts to make sure they were secure. (and if you haven&#8217;t, you probably have but just haven&#8217;t noticed) Making secure code is often times not as easy as you would hope, and while PHP does [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever programmed anything in PHP before, you&#8217;ve probably had situations where you needed to be careful with your scripts to make sure they were secure. (and if you haven&#8217;t, you probably have but just haven&#8217;t noticed)</p>
<p>Making secure code is often times not as easy as you would hope, and while PHP does provide certain methods to help you in your task, it still lets much of the hassle be up to you as the programmer. This construction, combined with the amount of PHP sites out there, leads to the sad fact that many insecure websites are written in PHP. And while your own website may be totally secure, perhaps because you read guides like <a href="http://phpsec.org/projects/guide/">PHP Security Guide</a> from PHP Security Consortium, there is absolutely no guarantee hosting users on your hosting server will do the same &#8211; so you need to protect yourself!</p>
<p>Protecting your server, and more importantly the users on it, is really a matter of several things. You need to make sure only the services you need are running, you need to secure access routes to the server (ssh, vnc, rdp etc.), you need to put in surveillance and detection systems (Nagios, Tripwire, Snort etc.), you need to make sure the data is backed up at all times, you need a proper firewall and tons of other things. Covering all these topics is way beyond this simple post however, so we&#8217;ll only focus on protecting yourself against badly coded PHP-scripts.</p>
<p>If a hosting user has a website on your server, say <a href="http://www.example.org/">http://www.example.org/</a>, and on this site he creates some PHP script that loads in a file and displays this in some way. Now this is obviously a stupid example, because when would you actually need this functionality? None the less, including files like this is sadly often times done indirectly, making it possible for an attacker to load in arbitrary files and gain full or partial access to the file content. In this example however we&#8217;ll simply look at a scheme like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">http:<span style="color: #000000; font-weight: bold;">//</span>www.example.org<span style="color: #000000; font-weight: bold;">/</span>script.php?<span style="color: #007800;">filename</span>=test.txt</pre></div></div>

<p>Where this script then loads in the content from test.txt.</p>
<p>This kind of setup is very problematic, because an attacker can easily take the request above and change it to load other files like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">http:<span style="color: #000000; font-weight: bold;">//</span>www.example.org<span style="color: #000000; font-weight: bold;">/</span>script.php?<span style="color: #007800;">filename</span>=..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">http:<span style="color: #000000; font-weight: bold;">//</span>www.example.org<span style="color: #000000; font-weight: bold;">/</span>script.php?<span style="color: #007800;">filename</span>=..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/</span>someothersite.com<span style="color: #000000; font-weight: bold;">/</span>secretfile.php</pre></div></div>

<p>Where the first one loads the password file on the server (it actually only includes usernames, passwords are in another file &#8211; but you get the point) and the second one could be perhaps a configuration file for another hosting user&#8217;s blog. This way the attacker could gain access to a complete list of users and some login information for another customer.</p>
<p>Both these situations are obviously unacceptable, and while you can&#8217;t protect your users from themselves (at least not easily), you can protect your good users from your more reckless users.</p>
<p>One way of doing this is by utilizing what&#8217;s called a chroot. Chrooting basically means taking an application and forcing it to do it&#8217;s work solely within a given directory, so that i.e. Apache was only allowed to function inside &#8220;/chroot/apache&#8221; and nowhere else. This prevents websites running on Apache from reading (and writing) files outside this chroot, so that an attacker can&#8217;t use the above attack to read the password file. Setting up such chroots aren&#8217;t always that easy, since everything Apache uses during runtime needs to be available in the chroot. One project has however attempted to make chrooting Apache much easier. This project is the Web Application Firewall Mod-Security, which can be found <a href="http://modsecurity.org/">here</a>. They use the so called <em>SecChroot</em> option to easily chroot your Apache.</p>
<p>Chrooting doesn&#8217;t however prevent a site in the chroot from reading data in another site stored in the same chroot. To prevent this kind of attack, you&#8217;d have to logically separate each running virtual host, by either setting up a dedicated Apache chroot for each virtual host (a bad solution) or use something called <em>suPHP</em>. By means of<em> suPHP</em>, which can be found <a href="http://www.suphp.org/">here</a>, we can make Apache run PHP scripts under the permissions of the owners of the scripts, instead of the normal Apache user which is shared between all virtual hosts. By doing this, we effectively make each virtual host able to only read/write files in its own directory and not spy on other virtual hosts data (assuming these have set correct permissions).</p>
<p>But what if we don&#8217;t trust this is enough? What if we want to be completely sure, that even if users set wrong permissions, a given user could still never read or write in another users virtual host? This can be accomplished by means of the php<em> open_basedir</em> option. The <em>open_basedir</em> option can be used to control in which directory the PHP scripts of a virtual host can work. This effectively means we&#8217;re actually chrooting the PHP scripts! The way you do this, is that you open up your virtual host configuration (which is probably stored somewhere like &#8220;/etc/apache2/vhosts/somevhostcom.conf&#8221;) and you then add the following within the &lt;VirtualHost&gt;&lt;/VirtualHost&gt; pair:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php_admin_value open_basedir <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>chroot<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/</span>somevhost.com</pre></div></div>

<p>Where &#8220;/var/chroot/apache/vhosts/somevhost.com&#8221; is the location of the virtual host directory. (be aware: If you&#8217;ve chrooted Apache, this path needs to be relative to the chroot and not the actual system).</p>
<p>Using <em>open_basedir</em> is not without it&#8217;s problems though. By making the PHP scripts run in what is effectively a chroot, they can&#8217;t i.e. write to the /tmp directory, which basically means file uploads won&#8217;t work. Be aware that chrooting in general can often lead to these types of issues, which is also why many server administrators just simply choose to take the risk and run Apache without chrooting.</p>
<p>Last but not least you can also use Mod-Security as what it was created as &#8211; a Web Application Firewall. A Web Application Firewall is a software firewall placed onto Apache, which then uses a complicated rule set to analyze traffic to the server and identify what kind of traffic is an attack and what is just normal use. These rules however have to be written, at least to some extent, manually and there are issues regarding making rules that catch illegal behavior but never stops legal requests &#8211; usually you have to accept some level of false-positives in attack detection if you want to be as secure as you can be.</p>
<p>That&#8217;s it! We hope you&#8217;ve become a bit more informed now and can get on with making your server secure against bad php scripts. Until next time &#8211; Keep safe!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.aconiac.com/2009/07/03/how-to-protect-your-server-from-insecure-php-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing X-Powered-By header for mod_rails</title>
		<link>http://blog.aconiac.com/2009/03/03/removing-x-powered-by-header-for-mod_rails/</link>
		<comments>http://blog.aconiac.com/2009/03/03/removing-x-powered-by-header-for-mod_rails/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 21:47:09 +0000</pubDate>
		<dc:creator>Michael Lind Mortensen</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.aconiac.com/?p=61</guid>
		<description><![CDATA[NOTE: This is a technical post regarding Apache on Linux with support for Ruby on Rails. Basic understanding of these concepts is necessary! Normally you want to make sure your server doesn&#8217;t give out any information about service versions, however mod_rails doesn&#8217;t provide any easy way of doing this within the module itself. There is [...]]]></description>
			<content:encoded><![CDATA[<p><strong>NOTE: This is a technical post regarding Apache on Linux with support for Ruby on Rails. Basic understanding of these concepts is necessary! </strong></p>
<p>Normally you want to make sure your server doesn&#8217;t give out any information about service versions, however mod_rails doesn&#8217;t provide any easy way of doing this within the module itself. There is however a fairly easy solution. Simply use mod_headers to remove the headers in Apache.</p>
<p>So how is it done? Very simple, just enable the module mod_headers and add the snippet below to httpd.conf or another included configuration file in Apache. Both actions have to be done as root of course.</p>
<p>Enable the mod_headers module <em>(This example is Linux Debian &#8211; it might be different for your system)</em></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /etc/apache2/mods-available/</span>
<span style="color: #666666; font-style: italic;"># a2enmod headers</span></pre></div></div>

<p>Add these lines to httpd.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Header always <span style="color: #7a0874; font-weight: bold;">unset</span> <span style="color: #ff0000;">&quot;X-Powered-By&quot;</span>
Header always <span style="color: #7a0874; font-weight: bold;">unset</span> <span style="color: #ff0000;">&quot;X-Runtime&quot;</span></pre></div></div>

<p>Restart the Apache server <em>(Again &#8211; this is Debian! It might be different for you)</em></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># apache2ctl restart</span></pre></div></div>

<p>And there you go. Try making e.g. a Nikto scan on the server and see if the headers aren&#8217;t there any more.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.aconiac.com/2009/03/03/removing-x-powered-by-header-for-mod_rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
