<?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>MIH SWAT &#187; security</title>
	<atom:link href="http://www.mihswat.com/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mihswat.com</link>
	<description>Headquarters of the Strategic Worldwide Applications and Technologies Team</description>
	<lastBuildDate>Tue, 31 Jan 2012 09:59:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Security: Are you thinking about it?</title>
		<link>http://www.mihswat.com/2009/10/01/security-are-you-thinking-about-it/</link>
		<comments>http://www.mihswat.com/2009/10/01/security-are-you-thinking-about-it/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 10:13:46 +0000</pubDate>
		<dc:creator>Rafael Dohms</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[development cycle]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[teams]]></category>

		<guid isPermaLink="false">http://www.mihswat.com/?p=823</guid>
		<description><![CDATA[Security is a recurring topic when discussing Technology. Taking security for granted when you are developing an application, even if it is a very simple application is a huge mistake which can have grave consequences. I have ran into many &#8230; <a href="http://www.mihswat.com/2009/10/01/security-are-you-thinking-about-it/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Security is a recurring topic when discussing Technology. Taking security for granted when you are developing an application, even if it is a very simple application is a huge mistake which can have grave consequences. <span id="more-823"></span><br />
I have ran into many excuses for ignoring security &#8211; especially this one: &#8220;This is just a simple application, it has no sensitive data&#8221;. The point may seem valid to the developer who is under immense time pressure, but the consequences of neglecting security can be serious. <a href="http://blog.calevans.com/2009/08/27/will-speak-for-cab-fare/">Cal Evans</a> in his Open Teams session demonstrates the impact of deadlines when he tells us about a project with an impossible due date. Upon questioning the due date to the marketing department their reply was simple: &#8220;Because that&#8217;s when the brochures are done&#8221;. This demonstrates the  all too frequent lack of understanding of the complexity of issues around web development shown by the business side of organisations.</p>
<p>Whatever the reason for neglecting security may be, such neglect can compromise much more than just the &#8220;non-sensitive&#8221; application data. Consider for example a recent incident at one of the biggest Brazilian mobile companies. An issue was found in a file called popup.php. The code in the file had the apparently simple objective of appending the company logo and loading a given file&#8217;s content into a popup window. So the excuse of &#8220;non-sensitive&#8221; data seemed to apply in this case.</p>
<p>We can easily imagine that the need for this page probably originated in the &lt;insert non-tech department&gt; and got escalated to the tech department with high priority (late on a Friday afternoon). In the rush the priority was to &#8220;Just get it done&#8221;, and ignore the worries about security. &#8220;No problem&#8221; you say, &#8220;leave it like that during the weekend and redo it on Monday following the proper protocols&#8221;. What happens of course is that code is never looked at again&#8230;.until the day THE EPIC FAIL happens.</p>
<p>In retrospect we can easily see how the popup.php file led to THE EPIC FAIL. The final URL used by the popup.php file had a &#8220;url&#8221; GET var attached to it, the value of which usually pointed to another html or PHP file. This is an open invitation to try and point the GET to any file that would be &#8220;unexpected&#8221;, like so:</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2009/09/url2.jpg"><img class="alignnone size-medium wp-image-824" src="http://www.mihswat.com/wp-content/uploads/2009/09/url2-300x22.jpg" alt="Url" width="300" height="22" /></a></p>
<p>The result of this request immediately made obvious that at least 2 security issues were overlooked by the developer. Can you see which ones?</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2009/09/erro.jpg"><img class="alignnone size-medium wp-image-825" style="border: 1px solid black" src="http://www.mihswat.com/wp-content/uploads/2009/09/erro-300x58.jpg" alt="Error" width="300" height="58" /></a></p>
<p>The first mistake here was leaving display_errors on &#8211; and this shows us the second mistake(s).  The obvious one was neglecting to stick to the rule: &#8220;Filter input, escape output&#8221;. The developer obviously  actually executed an include on the file specified in the URL. We can see that he did not check in any way the value provided in the &#8220;url&#8221; parameter, but he should at least have checked whehther the file was still in the site&#8217;s file tree.</p>
<p>To turn this exploit into something dangerous you simply need to start passing it sensitive files, like /etc/passwd or try to load the apache httpd.conf file (which actually worked in this case).</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2009/09/passwd.jpg"><img class="alignnone size-medium wp-image-826" style="border: 1px solid black" src="http://www.mihswat.com/wp-content/uploads/2009/09/passwd-300x42.jpg" alt="passwd" width="300" height="42" /></a></p>
<p>Analyzing these files showed that the problem was severe. The actual site had little valuable information, but it did show that the server had much more on it than just this site &#8211; this qualifies as an EPIC FAIL because it compromised all systems on that server. Another factor that contributed to the severity of the problem was Twitter. This flaw was only fixed <em>2 days after it was first reported</em> and in the interval the detail of the exploit was widely circulated on Twitter, giving everyone the chance to look at configuration and other files. Only the victim knows if any sensitive data was compromised, but given the creativity of hackers nowadays, something was compromised for sure.</p>
<p>This demonstrates that security is not a simple &#8220;injection&#8221; or &#8220;pill&#8221; you can give your application after it is live &#8211; security needs to come from the ground up, leave the quick fixes for the occasional software bug. Your development cycle must include security concerns in the form of tests, validations or anything else you can think of. <a href="http://owasp.org">OWASP</a> is a great source of points to think about. No feature should roll out the door if it did not take security into consideration. One approach is to incorporate security into your &#8220;Definition of Done&#8221;, so that a task can only be complete after security steps are taken to validate it. Peer review can further contribute to enhanced security &#8211; two heads are better than one. Managers should be as worried about this as the programmers should be. An example of such a Definition of Done is:</p>
<ul>
<li>Developed</li>
<li>Tested (Unit Tests written and executed)</li>
<li>Documentation (proper doc file or PHPDoc blocks for code segments)</li>
<li>Peer review</li>
<li>Security check (for known flaws, like input filtering)</li>
<li>Load Testing</li>
</ul>
<p>Every task should include the above. Even though it may cost some project development time, it will save you even more time and effort if someone attempts to hack your site. Including security in the set of tasks gives the developer time to plan each feature and reduces the risk of exploits being released. Taking security into account is part of becoming a professional developer and leaving behind the code-hacker ethic which means just coding and not considering the environment in which the application exists. </p>
<p>Needless to say the security-conscious approach has to be embraced by management because it is usually up to them to fight the battle for more development time and proper development cycles, and not to simply give in to external pressures &#8211; which leads to the risk of distributing dangerous code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mihswat.com/2009/10/01/security-are-you-thinking-about-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Review: Essential PHP Security</title>
		<link>http://www.mihswat.com/2009/02/02/review-essential-php-security/</link>
		<comments>http://www.mihswat.com/2009/02/02/review-essential-php-security/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 09:48:28 +0000</pubDate>
		<dc:creator>Rafael Dohms</dc:creator>
				<category><![CDATA[book]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[shiflett]]></category>

		<guid isPermaLink="false">http://www.mihswat.com/?p=582</guid>
		<description><![CDATA[Even though it was published in 2005, the issues that &#8220;Essential PHP Security&#8221; addresses is still very relevant today. Written by Chris Shiflett, the book goes through various security aspects associated with a PHP application, and for that reason its &#8230; <a href="http://www.mihswat.com/2009/02/02/review-essential-php-security/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="float: right, padding: 5px;"><img class="size-full wp-image-470 alignright" style="float: right;" src="http://www.rafaeldohms.com.br/wp-content/uploads/phpseccover.gif" alt="phpseccover" width="180" height="236" /></span></p>
<p>Even though it was published in 2005, the issues that &#8220;Essential PHP Security&#8221; addresses is still very relevant today. Written by Chris Shiflett, the book goes through various security aspects associated with a PHP application, and for that reason its content can be considered up to date and applicable to various day-to- day situations faced by developers.<span id="more-582"></span></p>
<p>The book has a very easy going approach to exposing the various aspects of security it addresses. These aspects are very clearly exposed and separated into differenct chapters, covering everything from forms to includes and security in shared hosting environments. Each topic is analyzed in detail and internally divided into exploits and attack strategies for that security flaw. In this way the book becomes an easy to access reference book where its possible to go directly to the chapter that addresses the specific aspect you are coding for right now and allowing you to know which flaws to look out for. The introductory chapter presents Principles and Practice of Security which can be applied in any application and any language,  for example &#8220;Defense in Depth&#8221;, which demonstrates the fact that security is much bigger than merely analyzing specific points of you application.</p>
<p>Even thought is has been published a few years ago, the book addresses topics like XSS that play a important role in the AJAX driven web we observe nowadays. Old friends like Session Hijacking and SQL Injection are analyzed from various points of view, aligned to the various segments of an application. This structure makes for a very light and enjoyable reading experience which can easily be fit into a few spare moments,  or even in the waiting room of the occasional visit to the doctor&#8217;s office (it worked for me anyway).</p>
<p>This book deserves to be part of any developer&#8217;s bookshelf, at least to serve as a reminder and inspiration for reflection, even in a world where more and more Frameworks internalize all aspects of security &#8211; but as I always say, we developers should always know what is going on behind the curtains.</p>
<p><strong>Essential PHP Security A Guide to Building Secure Web Applications</strong></p>
<p>By Chris Shiflett<br />
October 2005<br />
Pages: 124<br />
ISBN 10: 0-596-00656-X | ISBN 13: 9780596006563</p>
<p>You can buy the book from <a href="http://www.amazon.com/Essential-PHP-Security-Chris-Shiflett/dp/059600656X">Amazon</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mihswat.com/2009/02/02/review-essential-php-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

