<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Pádraic Brady</title>
	<atom:link href="http://blog.astrumfutura.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.astrumfutura.com</link>
	<description>PHP, Zend Framework and Other Crazy Stuff</description>
	<lastBuildDate>Wed, 15 May 2013 14:46:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license>		<item>
		<title>Publishing Security Disclosures In Consumable Formats For Simpler Aggregation and Security Checking</title>
		<link>http://blog.astrumfutura.com/2013/05/publishing-security-disclosures-in-consumable-formats-for-simpler-aggregation-and-security-checking/</link>
		<comments>http://blog.astrumfutura.com/2013/05/publishing-security-disclosures-in-consumable-formats-for-simpler-aggregation-and-security-checking/#comments</comments>
		<pubDate>Wed, 15 May 2013 14:43:34 +0000</pubDate>
		<dc:creator>padraic</dc:creator>
				<category><![CDATA[PHP General]]></category>
		<category><![CDATA[PHP Security]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=998</guid>
		<description><![CDATA[This is a branch off from a separate discussion on the PHP-FIG mailing list about other ways the Framework Interoperability Group can encourage and foster wider interoperability among its member projects (and by extension, the whole PHP community). I&#8217;ll start by noting two interesting developments in recent months and one long standing best practice. 1.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F05%2Fpublishing-security-disclosures-in-consumable-formats-for-simpler-aggregation-and-security-checking%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F05%2Fpublishing-security-disclosures-in-consumable-formats-for-simpler-aggregation-and-security-checking%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=php&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="mceTemp">
<dl class="wp-caption alignright zemanta-img" style="width: 210px;">
<dt class="wp-caption-dt"><a href="http://commons.wikipedia.org/wiki/File:Cooperation.svg" target="_blank"><img class="zemanta-img-inserted zemanta-img-configured" title="English: Decentralised cooperation, many-to-ma..." src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b8/Cooperation.svg/300px-Cooperation.svg.png" alt="English: Decentralised cooperation, many-to-ma..." width="200" /></a></dt>
</dl>
</div>
<p>This is a branch off from a separate discussion on the PHP-FIG <a href="https://groups.google.com/forum/?fromgroups=#!forum/php-fig" target="_blank">mailing list</a> about other ways the Framework Interoperability Group can encourage and foster wider interoperability among its member projects (and by extension, the whole PHP community). I&#8217;ll start by noting two interesting developments in recent months and one long standing best practice.</p>
<h2>1. Launch of the SensioLabs Security Advisory Checker</h2>
<p>The <a href="https://security.sensiolabs.org/" target="_blank">SensioLabs Security Advisor Checker</a> is described on its website as follows.</p>
<blockquote><p>You manage your PHP project dependencies with Composer, right? But are  you sure that your project does not depend on a package with known  security issues? The SensioLabs security advisories checker is a simple  tool, available as a web service or as an online application, that uses  the information from your composer.lock file to check for known security  vulnerabilities. This checker is a frontend for the security advisories  database.</p></blockquote>
<p>The service operates by having people submit vulnerability data, as YAML files, to a centralised Github repository through pull requests. The upside is that the vulnerability data can be peer reviewed and centrally dispersed either online or via a service API. The downside is that you need to find vulnerability disclosures and people to submit them. The service currently covers Symfony, Zend Framework, Doctrine, Twig and FriendsOfSymfony bundles. It&#8217;s a tiny sample of packages available through Composer. I&#8217;m also not entirely sure if it&#8217;s sufficiently fine grained to report vulnerabilities on a project&#8217;s sub-packages where you have no direct dependency on the aggregate package (e.g. using zendframework/zend-db instead of zendframework/zendframework). That said, this is a working model of a service for checking your dependencies.</p>
<p>That said, the service exhibits an ambitious idea &#8211; projects sharing their vulnerability disclosures or advisories in a way that allows for automatically checking if any of your projects need to have their dependencies updated for security reasons.</p>
<h2>2. <a class="zem_slink" title="OWASP" rel="wikipedia" href="http://en.wikipedia.org/wiki/OWASP" target="_blank">OWASP</a>&#8216;s Top 10 security risks for 2013 includes &#8220;A9 &#8211; Using Components with Known Vulnerabilities&#8221;</h2>
<p><a href="https://www.owasp.org/index.php/Top_10_2013-A9" target="_blank">This is a new entry</a> onto OWASP&#8217;s Top 10 (which is currently at release candidate status for 2013). In summary, it recognises that applications are becoming ever more dependent on code not developed internally. We&#8217;ve had web application frameworks for years. Composer and Github have unleashed a storm of accessible libraries, bundles, modules, and other units of reuse that have revealed Not Invented Here (<a class="zem_slink" title="Not invented here" rel="wikipedia" href="http://en.wikipedia.org/wiki/Not_invented_here" target="_blank">NIH Syndrome</a>) as a psychological problem in ways not previously possible.</p>
<p>As reliance on externally controlled dependencies increases, so too does the risk of your applications using insecure dependencies. This is a risk that requires a lot of work to mitigate. For each dependency, you need to do a security review (no, I&#8217;m not kidding), check for security disclosures (whether voluntary or involuntary) and ensure that you end up rolling out to production with safe versions.</p>
<p>Quoting from the OWASP advice on preventing the use of components with known vulnerabilities…</p>
<blockquote><p>One option is not to use components that you didn’t write. But realistically, the best way to deal with this risk is to ensure that you keep your components up-to-date. Many open source projects (and other component sources) do not create vulnerability patches for old versions. Instead, most simply fix the problem in the next version. Software projects should have a process in place to:</p>
<p>1. Identify the components and their versions you are using, including all dependencies. (e.g., the versions plugin)</p>
<p>2. Monitor the security of these components in public databases, project mailing lists, and security mailing lists, and keep them up-to-date.</p>
<p>3. Establish security policies governing component use, such as requiring certain software development practices, passing security tests, and acceptable licenses.</p></blockquote>
<h2>3. Disclosing security vulnerabilities in a timely and responsible manner is a best practice</h2>
<p>As programmers, we have a responsibility to users to disclose security vulnerabilities and fix them in a timely manner to ensure that those users are protected from harm. It&#8217;s almost impossible not to end up in such a situation at some point in your career. In fact, it may even be impossible for it not to happen multiple times in a single year!</p>
<p>The sad truth, however, is that disclosing security vulnerabilities can be terribly hit and miss. I&#8217;ve seen people ignore vulnerabilities or fix them but fail to disclose the fact to their users. Opinions over the severity of a vulnerability can vary dramatically within even a small group of programmers. Nobody likes to air their dirty laundry in public but not doing so can mean someone including a dependency with a known vulnerability without any means of becoming aware of that vulnerability.</p>
<p>It is always a good thing to come clean. Fixing a vulnerability, disclosing it, and having a good security policy in place prevents the reputational damage you might suspect would occur. It&#8217;s usually the secretive rollout of fixes that gets you in trouble when someone is attacked or the reporter discloses the vulnerability through other means (usually making note of your refusal to come clean).</p>
<p>The method of disclosure is usually in release notes, commit messages, blog posts or emails. This article suggests using formats that are more fundamentally consumable and standardised.</p>
<h2>Centralised Tracking Of Decentralised Vulnerability Data?</h2>
<p>Being aware of these three, we can see the immediate value in something like SensioLabs security advisory checking service. You have dependencies which very likely have had or will have vulnerabilities, and you probably would love to know about those before releasing a new project build to production servers. The problem is that this involves work in importing vulnerability data into the checking service and, failing that at present, a trawl of the internet for vulnerability disclosure blog posts, commit messages and emails. What would happen if, as a means of improving interoperability and common security, more vendors published their disclosures at fixed URIs in just one or two easily consumable formats (e.g. YAML or RSS/Atom)?</p>
<p>For example, instead of relying on someone submitting a pull request to SensioLabs each time Library X discloses a vulnerability, one could simply store a URI to Library X&#8217;s disclosure feed and/or a YAML formatted summary stored in its git repository. The SensioLabs service, or something like it, could now pull in vulnerabilities automatically assuming Library X uses a predetermined consumable format. This sounds, at least to me, as a more sustainable system.</p>
<p>If a sufficient number of packages on Composer followed this practice, we&#8217;d have something quite brilliant and possibly easier to promote in the community. People are now very familiar with maintaining a composer.json file. Adding one more file, in lieu of an alternative RSS/Atom feed, is not that big of a stretch if enough projects request it of their dependencies. The rest would be down to the boring work of agreeing formats, procedures and other technical aspects with a view towards, *if* called for, a PSR on the topic.</p>
<p>Let me know what you all think in the comments or catch me on the PHP-FIG mailing list.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/?px"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=09a961f7-bdfa-4d55-932d-9a94de8c4b59" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2013/05/publishing-security-disclosures-in-consumable-formats-for-simpler-aggregation-and-security-checking/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>20 Point List For Preventing Cross-Site Scripting In PHP</title>
		<link>http://blog.astrumfutura.com/2013/04/20-point-list-for-preventing-cross-site-scripting-in-php/</link>
		<comments>http://blog.astrumfutura.com/2013/04/20-point-list-for-preventing-cross-site-scripting-in-php/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 14:23:51 +0000</pubDate>
		<dc:creator>padraic</dc:creator>
				<category><![CDATA[PHP General]]></category>
		<category><![CDATA[PHP Security]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Content Security Policy]]></category>
		<category><![CDATA[Cross-Site Scripting]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=987</guid>
		<description><![CDATA[Summarising knowledge has as much value as writing a 200 page treatise on a topic, so here is a list of 20 brief points you should bear in mind when battling Cross-Site Scripting (XSS) in PHP. Minus my usual book length brain fart . Chances are good that ignoring or acting contrary to any one]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F04%2F20-point-list-for-preventing-cross-site-scripting-in-php%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F04%2F20-point-list-for-preventing-cross-site-scripting-in-php%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=Content+Security+Policy,Cross-Site+Scripting,xss&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="wp-caption alignright" style="width: 250px"><a href="http://www.flickr.com/photos/7550402@N02/2427863697" target="_blank"><img class="zemanta-img-inserted zemanta-img-configured" title="Watching some asshat fail at cross site script..." src="http://farm4.static.flickr.com/3062/2427863697_335b7e324b_m.jpg" alt="Watching some asshat fail at cross site script..." width="240" height="194" /></a><p class="wp-caption-text">Watching some asshat fail at cross site scripting attacks against gearfuse.com. (Photo credit: vissago)</p></div>
<p>Summarising knowledge has as much value as writing a 200 page treatise on a topic, so here is a list of 20 brief points you should bear in mind when battling Cross-Site Scripting (XSS) in PHP. Minus my usual book length brain fart <img src='http://blog.astrumfutura.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Chances are good that ignoring or acting contrary to any one of these will lead to a potential XSS vulnerability. It&#8217;s not necessarily a complete list &#8211; if you think something needs to be added, let everyone know in the comments.</p>
<ol>
<li>Never pass data from untrusted origins into output without either escaping or sanitising it.</li>
<li>Never forget to validate data arriving from an untrusted origin using relevant rules for the context it&#8217;s used in.</li>
<li>Remember that anything not explicitly defined in source code has an untrusted origin.</li>
<li>Remember that htmlentities() is incompatible with XML, including HTML5&#8242;s XML serialisation &#8211; use htmlspecialchars().</li>
<li>Always include ENT_QUOTES, ENT_SUBSTITUTE and a valid character encoding when calling htmlspecialchars().</li>
<li>Never use htmlspecialchars() as the primary means of escaping Javascript, CSS or URL parts.</li>
<li>Never use json_encode() to escape Javascript strings unless using PHP 5.3 and RTFM.</li>
<li>Use rawurlencode() to escape strings being inserted into URLs and then HTML escape the entire URL.</li>
<li>Never ever pass escaped or sanitised data from untrusted origins into a Javascript execution context: a string later executed as Javascript, e.g. setAttribute(&#8220;onclick&#8221;, &#8220;PLEASEGODNOTHERE&#8221;).</li>
<li>Validate all complete URLs if constructed from untrusted data.</li>
<li>Never validate URLs using filter_var(). It doesn&#8217;t work and allows Javascript and Data URIs through.</li>
<li>Never include resources loaded over unsecured HTTP on a page loaded over HTTPS.</li>
<li>Sanitise raw HTML from untrusted origins using HTMLPurifier before injecting it into ouput.</li>
<li>Sanitise the output of Markdown, BBCode and other HTML replacements using HTMLPurifier before injecting it into output.</li>
<li>Remember that HTMLPurifier is the only HTML sanitiser worth using.</li>
<li>Adopt the <a class="zem_slink" title="Content Security Policy" rel="wikipedia" href="http://en.wikipedia.org/wiki/Content_Security_Policy" target="_blank">Content Security Policy</a> (CSP) header and abandon the use of inline CSS and Javascript where feasible.</li>
<li>Always transmit, with content, a valid Content-Type header referencing a valid character encoding.</li>
<li>Ensure that cookies for use solely by the server are marked <a class="zem_slink" title="HTTP cookie" rel="wikipedia" href="http://en.wikipedia.org/wiki/HTTP_cookie" target="_blank">HttpOnly</a>.</li>
<li>Ensure that cookies which must only be transmitted over HTTPS are marked Secure.</li>
<li>Always review dependencies and other third party code for potential XSS vulnerabilities and vectors.</li>
</ol>
<p>Cross-Site Scripting remains, by far, the most common vulnerability in web applications. Things that will sink your application, framework or library become very obvious from the list. There are more than enough naughty applications, frameworks and libraries around that you should have little trouble identifying offenders with grep and some mental acrobatics. Rumour has it that you can now locally search any project on Github without even cloning a repository.</p>
<p>Yes, some entries are reminders. It&#8217;s surprising how many people try to avoid HTMLPurifier in favour of the month&#8217;s Regular Expression Powered Miracle option which is riddled with holes or have formulated the belief that, contrary to its official syntax rules, Markdown magically prevents Cross-Site Scripting.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/?px"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=de56bd69-b157-4424-a839-9112901732bc" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2013/04/20-point-list-for-preventing-cross-site-scripting-in-php/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Mockery 0.8.0 Has Been Unleashed!</title>
		<link>http://blog.astrumfutura.com/2013/04/mockery-0-8-0-has-been-unleashed/</link>
		<comments>http://blog.astrumfutura.com/2013/04/mockery-0-8-0-has-been-unleashed/#comments</comments>
		<pubDate>Tue, 02 Apr 2013 11:23:22 +0000</pubDate>
		<dc:creator>padraic</dc:creator>
				<category><![CDATA[PHP General]]></category>
		<category><![CDATA[PHP Security]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Mock object]]></category>
		<category><![CDATA[mockery]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=932</guid>
		<description><![CDATA[I&#8217;m very happy to announce the release of Mockery 0.8.0. Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succint API capable of clearly defining all possible object operations]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F04%2Fmockery-0-8-0-has-been-unleashed%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F04%2Fmockery-0-8-0-has-been-unleashed%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=Mock+object,mockery,unit+testing&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;m very happy to announce the <a href="https://github.com/padraic/mockery" target="_blank">release of Mockery 0.8.0</a>.</p>
<blockquote><p>Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succint API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit&#8217;s phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.</p></blockquote>
<p>The new version of Mockery is the first in a year (since 0.7.2) and is packed with new features, bug fixes and even better support for PHP&#8217;s OOP model. It&#8217;s also the first version to be released with my new co-conspirator, Dave Marshall (<a href="https://twitter.com/davedevelopment" target="_blank">@davedevelopment</a>), who threatens to make me redundant as a maintainer! This version focuses primarily on stability but it&#8217;s worth reviewing the README for the new sections on <a href="https://github.com/padraic/mockery#creating-partial-mocks" target="_blank">Creating Partial Mocks</a> and <a href="https://github.com/padraic/mockery#behaviour-modifiers" target="_blank">Behaviour Modifiers</a> for mock objects.</p>
<p>For those who haven&#8217;t been using dev-master in their composer.json project file, you can now update to the 0.8.0 stable tag using Composer or grab the 0.8.0 package from the PEAR channel at <a href="http://pear.survivethedeepend.com" target="_blank">http://pear.survivethedeepend.com</a>.</p>
<p>A very special thanks to those who opened pull requests and reported issues over the past year.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/?px"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=e9b3597c-3cd5-4b64-a0ba-36b086dea3aa" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2013/04/mockery-0-8-0-has-been-unleashed/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Predicting Random Numbers In PHP &#8211; It&#8217;s Easier Than You Think!</title>
		<link>http://blog.astrumfutura.com/2013/03/predicting-random-numbers-in-php-its-easier-than-you-think/</link>
		<comments>http://blog.astrumfutura.com/2013/03/predicting-random-numbers-in-php-its-easier-than-you-think/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 15:35:59 +0000</pubDate>
		<dc:creator>padraic</dc:creator>
				<category><![CDATA[PHP General]]></category>
		<category><![CDATA[PHP Security]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=911</guid>
		<description><![CDATA[The Zend Framework team recently released versions 2.0.8 and 2.1.4 to address a number of potential security issues including advisory ZF2013-02 &#8220;Potential Information Disclosure and Insufficient Entropy vulnerabilities in Zend\Math\Rand and Zend\Validate\Csrf Components&#8221;. Quite the mouthful! In short, Zend Framework used the mt_rand() function to generate random numbers in situations where neither openssl_pseudo_random_bytes() nor mcrypt_create_iv()]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F03%2Fpredicting-random-numbers-in-php-its-easier-than-you-think%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F03%2Fpredicting-random-numbers-in-php-its-easier-than-you-think%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=php&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="mceTemp">
<dl class="wp-caption alignright zemanta-img" style="width: 310px;">
<dt class="wp-caption-dt"><a href="http://commons.wikipedia.org/wiki/File:Wuerfel5.jpg" target="_blank"><img class="zemanta-img-inserted zemanta-img-configured" title="Dice for various games, especially for rolepla..." src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Wuerfel5.jpg/300px-Wuerfel5.jpg" alt="Dice for various games, especially for rolepla..." width="300" height="225" /></a></dt>
</dl>
</div>
<p>The <a class="zem_slink" title="Zend Framework" rel="homepage" href="http://framework.zend.com/" target="_blank">Zend Framework</a> team recently released versions 2.0.8 and 2.1.4 to address a number of potential security issues <a href="http://framework.zend.com/security/advisory/ZF2013-02" target="_blank">including advisory ZF2013-02</a> &#8220;Potential Information Disclosure and Insufficient Entropy vulnerabilities in Zend\Math\Rand and Zend\Validate\Csrf Components&#8221;. Quite the mouthful!</p>
<p>In short, Zend Framework used the mt_rand() function to generate random numbers in situations where neither openssl_pseudo_random_bytes() nor mcrypt_create_iv() were available. This is possible when the openssl and mcrypt extensions are not installed/compiled with PHP. The mt_rand() function is a particularly weak <a class="zem_slink" title="Pseudorandom number generator" rel="wikipedia" href="http://en.wikipedia.org/wiki/Pseudorandom_number_generator" target="_blank">Pseudorandom Number Generator</a> (PRNG) selected for speed over security so it should never be used unless for obviously trivial use cases. Consider the following as food for thought:</p>
<pre>if ($_GET['rand'] == mt_rand()) {
    exec($_GET['command']);
}</pre>
<p>This example has two characteristics. It has nothing to do with cryptography and it gives attackers something interesting to work with if they can guess what mt_rand() will return. It demonstrates that the concept of reserving good <a class="zem_slink" title="Random number generation" rel="wikipedia" href="http://en.wikipedia.org/wiki/Random_number_generation" target="_blank">random number generation</a> solely for &#8220;cryptographic&#8221; purposes is entirely false and misleading. You should use good generators for all but the most trivial purposes. If guessing a random number or string leads to an unauthorised outcome, then using mt_rand() is a security vulnerability. This applies to a whole range of uses for random number generators: session IDs, API tokens, CSRF tokens, nonces and unique ids. These all rely on randomness as do core functions like uniqid() and array_rand(). What happens if they are predictable?</p>
<p>What makes mt_rand() and uniqid() such bad choices for anything when it comes to security? I wrote a new chapter for the slowly expanding security book I&#8217;m writing which you can read here online:</p>
<p><a href="http://phpsecurity.readthedocs.org/en/latest/Insufficient-Entropy-For-Random-Values.html" target="_blank">http://phpsecurity.readthedocs.org/en/latest/Insufficient-Entropy-For-Random-Values.html</a></p>
<p>The extremely short and sweet version is that all of PHP&#8217;s internally used and externally exposed PRNGs use seeds. Those seeds are based on limited information like current seconds, microseconds, and process PID. These values are not very uncertain and even partially predictable, i.e. they have &#8220;insufficient entropy&#8221;. If you use the same seed, those PRNGs output the exact same values every time. If you get a random value from a server, you can brute force it to get the seed used (e.g. use HTTP Date head to guess seconds and twinned requests to minimise microsecond deltas). Servers can output brute forcible random numbers either automatically (i.e. Session IDs) or by design (e.g. CSRF Tokens). Now an attacker can predict future values &#8211; for the same PHP process! Finally, there&#8217;s this thing called KeepAlive that lets an attacker reuse the same PHP process multiple times…and predict random values on future requests. For example, the token generated when resetting an account password that is appended to a secret reset password URL sent by email to the account owner whose account can inject unsanitised HTML into any part of a website.</p>
<p>In any case, take the time to read the longer book chapter <img src='http://blog.astrumfutura.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . It has a lot more practical information including a walkthrough of a theoretical attack and links to some tools publicly available for mounting proof of concept attacks. I also discuss solutions including <a href="https://github.com/ircmaxell/RandomLib" target="_blank">Anthony Ferrara&#8217;s RandomLib</a>.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/?px"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=71435e6d-260f-4fee-9311-d4423de5208a" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2013/03/predicting-random-numbers-in-php-its-easier-than-you-think/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Getting Ahead In Security By Watching The Neighbours</title>
		<link>http://blog.astrumfutura.com/2013/01/getting-ahead-in-security-by-watching-the-neighbours/</link>
		<comments>http://blog.astrumfutura.com/2013/01/getting-ahead-in-security-by-watching-the-neighbours/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 11:40:53 +0000</pubDate>
		<dc:creator>padraic</dc:creator>
				<category><![CDATA[PHP General]]></category>
		<category><![CDATA[PHP Security]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Arbitrary code execution]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=886</guid>
		<description><![CDATA[As some of you are likely aware by now, Ruby On Rails posted a security advisory concerning critical remote code execution (RCE) vulnerabilities in its Action Pack for all versions of Rails since 2.0. This vulnerability can likely be used in a wide variety of potential attacks so you should immediately update any Rails applications]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F01%2Fgetting-ahead-in-security-by-watching-the-neighbours%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2013%2F01%2Fgetting-ahead-in-security-by-watching-the-neighbours%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=Arbitrary+code+execution,Frameworks,Ruby+On+Rails,symfony,yaml&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="mceTemp">
<dl class="wp-caption alignright zemanta-img" style="width: 250px;">
<dt class="wp-caption-dt"><a href="http://www.flickr.com/photos/61423903@N06/7557181168" target="_blank"><img class="zemanta-img-inserted zemanta-img-configured " src="http://farm8.static.flickr.com/7250/7557181168_91f4af2d99_m.jpg" alt="" width="240" height="135" /></a></dt>
</dl>
</div>
<p>As some of you are likely aware by now, <a class="zem_slink" title="Ruby on Rails" rel="homepage" href="http://rubyonrails.org" target="_blank">Ruby On Rails</a> <a href="https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion" target="_blank">posted a security advisory</a> concerning critical <a class="zem_slink" title="Arbitrary code execution" rel="wikipedia" href="http://en.wikipedia.org/wiki/Arbitrary_code_execution" target="_blank">remote code execution (RCE)</a> vulnerabilities in its Action Pack for all versions of Rails since 2.0.</p>
<p>This vulnerability can likely be used in a wide variety of potential attacks so you should immediately update any Rails applications you are currently running. There&#8217;s a good analysis of the issue over on <a href="http://www.insinuator.net/2013/01/rails-yaml/" target="_blank">http://www.insinuator.net/2013/01/rails-yaml/</a> and it raises the very real risk that the global nature of this vulnerability may make automated attacks or worms feasible. A concrete POC has not been released to give folk more time to update their applications before attackers figure out how to take advantage of this.</p>
<p>Yes, but HOOEY! How does this relate to PHP, Paddy?!</p>
<p>Code execution vulnerabilities are, by definition, hideous monsters. The ability for external inputs to enter an execution context (i.e. injecting or manipulating code that is executed on the server) can be difficult to spot through the haze of convenience that such machinations are often designed to deliver. In Rail&#8217;s case, that convenience was to automatically cast data entries in XML or YAML inputs into Ruby types including, unfortunately, Symbols and Objects.</p>
<p>These types of &#8220;buried&#8221; code execution vulnerabilities are still easy to locate in PHP, at least, because you are still restricted to normal code execution pathways in the absence of Ruby&#8217;s dark magic, e.g. eval(), include(), require_once(), system() and, let&#8217;s not forget, unserialize(). Anyone can perform a mini-audit using grep searches just by checking for instances of these and similar functions and then identifying whether they are in unusual places or accepting variable inputs that could be exploited. For example, a few years back many applications were found to be <a href="http://heine.familiedeelstra.com/security/unserialize" target="_blank">unserializing user inputs which allowed for code execution attacks by manipulating parameters to __wakeup() and __destruct() method calls</a>.</p>
<p>Rails is a battle hardened framework but all frameworks will suffer from unanticipated security vulnerabilities. You just won&#8217;t see them become as well publicised as Rails! It&#8217;s the nature of programming for programmers to err or fail to foresee unintended uses for their code. PHP applications and libraries are already suffering from any number of obviously pervasive ills including three security problems I called the Three Ugly Sisters <a href="http://webadvent.org/2012/the-three-ugly-sisters-by-p%C3%A1draic-brady" target="_blank">in my recent article for December&#8217;s Web Advent series</a> (SSL Peerjacking, XMl Injection and Cross-Site Scripting). We all have the capacity to do better on the security front.</p>
<p>No PHP project is immune to security vulnerabilities simply because of its size, user base, or funding. Even a good security audit is not immune to the blind spots of the reviewer, emerging security issues still flying under the radar and the continuing assault by researchers on practices and techniques we take for granted.</p>
<p>One part of being prepared for unexpected vulnerabilities is to find common ground with your competitors. Ruby on Rails is a web application framework. If you are a PHP framework developer and not monitoring Rails&#8217; or Django&#8217;s security woes then it&#8217;s time to start. We can learn a lot because, despite the barrier of a different programming language, many security problems are universal. Frameworks in Ruby, PHP, Java and Python can all run afoul of very similar vulnerabilities. Using that knowledge can lead into avenues of investigation you did not previously consider. Within PHP itself, monitoring frameworks like <a class="zem_slink" title="Zend Framework" rel="homepage" href="http://framework.zend.com/" target="_blank">Zend Framework</a> and <a class="zem_slink" title="Symfony" rel="homepage" href="http://symfony.com/" target="_blank">Symfony</a> can reveal security advisories that, in all probability, are not unique to those frameworks.</p>
<p>As a case in point, the Rails vulnerability I opened this article with led me to wonder if something similar might be possible in a PHP framework. So, I took a look at Symfony 2&#8242;s YAML component. <a href="http://jmsyst.com/" target="_blank">Johannes Schmitt</a> apparently had the same thought! As it happens, there are two possible points in the YAML classes where code execution could potentially be manipulated by untrusted input. The component is generally used to parse local configuration files (so typical Symfony applications will not be vulnerable) but there is nothing to stop it from being used as a generic YAML parser for other use cases such as user submitted files or YAML output from a remote API. As always, Fabien promptly set the Elves in his North Pole hideout on red alert and has already released fresh versions of Symfony 2.0 and 2.1 to rectify these issues. You can read the official advisory at <a href="http://symfony.com/blog/security-release-symfony-2-0-22-and-2-1-7-released" target="_blank">http://symfony.com/blog/security-release-symfony-2-0-22-and-2-1-7-released</a>.</p>
<p>The code execution vulnerabilities in Symfony&#8217;s YAML component relied on calls to include() and unserialize(). One included a file as PHP and parsed its output as YAML (disabled by default since Symfony 2.1 but still enabled by default on Symfony 2.0 versions) and the other unserialised objects stored to a YAML scalar value (enabled by default in all versions). As I mentioned earlier, grep can be really helpful in locating these types of problems &#8211; so get cracking on the command line!</p>
<p>To summarise…</p>
<p>Pay attention to competing applications or frameworks &#8211; their problems may also be your problems. If you&#8217;re worried about arbitrary code execution vulnerabilities then audit your code. You can even, as a sanity check, use grep to find uses of functions like eval(), unserialize(), etc and analyse where their parameters&#8217; might originate from. The answer &#8220;somewhere out there&#8221; or &#8220;how the heck am I supposed to know what crazy users will do&#8221; usually means it&#8217;s untrusted by definition. Keep in mind that code execution vulnerabilities can also appear in the form of arbitrary object instantiation, i.e. the constructor and destructors being executed for any object targeted even if there are no other method calls made. Manipulating code execution can be just as bad as arbitrary code execution.</p>
<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles</h6>
<ul class="zemanta-article-ul">
<li class="zemanta-article-ul-li"><a href="http://www.insinuator.net/2013/01/rails-yaml/" target="_blank">Analysis of Rails XML Parameter Parsing Vulnerability</a> (insinuator.net)</li>
<li class="zemanta-article-ul-li"><a href="http://arstechnica.com/security/2013/01/extremely-crtical-ruby-on-rails-bug-threatens-more-than-200000-sites/" target="_blank">Extremely crtical Ruby on Rails bug threatens more than 200,000 sites</a> (arstechnica.com)</li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/?px"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=e5ec32ef-ec7c-4de0-b2e3-35b1c1704dc7" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2013/01/getting-ahead-in-security-by-watching-the-neighbours/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Taking PHP Security Seriously By Taking It Seriously</title>
		<link>http://blog.astrumfutura.com/2012/10/taking-php-security-seriously-by-taking-it-seriously/</link>
		<comments>http://blog.astrumfutura.com/2012/10/taking-php-security-seriously-by-taking-it-seriously/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 20:37:20 +0000</pubDate>
		<dc:creator>padraic</dc:creator>
				<category><![CDATA[Irishisms]]></category>
		<category><![CDATA[PHP General]]></category>
		<category><![CDATA[PHP Security]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.astrumfutura.com/?p=859</guid>
		<description><![CDATA[Since the dawn of time, circa 1995 AD, PHP and Security have been at constant loggerheads over what priorities programmers should cling to. Programmers, by their very nature, are drawn to getting shit done inexpensively. Building tools, libraries and applications is a time consuming and expensive process and managing that process in the most efficient]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.astrumfutura.com%2F2012%2F10%2Ftaking-php-security-seriously-by-taking-it-seriously%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.astrumfutura.com%2F2012%2F10%2Ftaking-php-security-seriously-by-taking-it-seriously%2F&amp;source=padraicb&amp;style=normal&amp;service=bit.ly&amp;service_api=padraic%3AR_94101570b7e190f3de921bc15bb9438d&amp;hashtags=php&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="wp-caption alignright" style="width: 190px"><a href="http://www.flickr.com/photos/93907767@N00/67462572" target="_blank"><img class="zemanta-img-inserted zemanta-img-configured" title="The Singing Annoying Thing" src="http://farm1.static.flickr.com/27/67462572_f722d8de6a_m.jpg" alt="The Singing Annoying Thing" width="180" height="240" /></a><p class="wp-caption-text">The Singing Annoying Thing (Photo credit: DWZ)</p></div>
<p>Since the dawn of time, circa 1995 AD, PHP and Security have been at constant loggerheads over what priorities programmers should cling to. Programmers, by their very nature, are drawn to getting shit done inexpensively. Building tools, libraries and applications is a time consuming and expensive process and managing that process in the most efficient manner possible has been a focus of untold years of study and experimentation. Interestingly, whereas open source code is subject to greater public review it is not necessarily driven by those same needs.</p>
<p>Many open source programmers are happy to waste countless hours in the pursuit of perfection, to try new things that companies&#8217; would blanche at funding and to spread word through their social networks of every possible attractive idea to dare peek out of a window. Only in the open source world could someone suggest completely rewriting a sizeable chunk of code without having project managers and accountants hustle them off to the broom cupboard for a private chat. Not that those two groups are always aware of the costs of fixing stuff that isn&#8217;t broken!</p>
<p>Nevertheless, for all of open source&#8217;s charms it also carries around a terrible monster. Programmers will nearly always claim to take security seriously while writing source code which obviously doesn&#8217;t agree with this publicly proclaimed sentiment. Take such developments in-house to a proprietary setting and that same result is a recipe for utter disaster and a possible ass kicking out of the nearest door. Companies are risk intolerant when the risk offers no potential gain.</p>
<p>Our open source endeavors need to appeal to enterprises and other conservative programmers &#8211; not simply to the masses of PHP programmers attracted by shiny new stuff displacing ancient scarred stuff that still works reliably despite a decade of warfare on the frontlines. We also need to be concious that PHP Security is largely viewed as an oxymoron. Putting both of those words into the same phrase is considered a joke in many quarters. Whether we like it or not, PHP has a higher benchmark to meet and we&#8217;re not meeting it.</p>
<p>Consider for a moment your browser. All modern browsers are maintained by groups which understand a fundamental market force. If your browser fucks up security badly enough, users will use another browser that they perceive as being more secure. The obvious corrective action is to improve security, mitigate the risks of browser based vulnerabilities, and push improvements on multiple fronts to create a <a class="zem_slink" title="Defence in depth" rel="wikipedia" href="http://en.wikipedia.org/wiki/Defence_in_depth" target="_blank">Defense In Depth</a> approach protecting against one of the ultimate sources of security problems: The Web Programmer.</p>
<p>It&#8217;s not just browsers. Both <a class="zem_slink" title="OpenID Foundation" rel="homepage" href="http://openid.net" target="_blank">OpenID</a> and <a class="zem_slink" title="OAuth" rel="homepage" href="http://oauth.net" target="_blank">OAuth</a> utilise restrictive cryptographic schemes because, at the end of the day, programmers would otherwise find a way to screw it up. Indeed, the idea of OAuth 2.0 doing away entirely with cryptographic signatures was met with relief in some quarters followed by the realisation that it would now depend on programmers correctly implementing HTTPS &#8211; so it was added back in!</p>
<p>Unlike browsers and open standards, PHP appears to defy these shared realities. Let&#8217;s consider a web application which allows users to send messages to numerous other web applications. It&#8217;s a simple message exchange system not unlike email with the benefit that all messages are encrypted and communicated across HTTPS. When the browser acts as a client, we can be reasonably sure that this is a secure client. Browsers are market driven products so they are intolerant of security vulnerabilities. When a web application acts as the client, a different picture emerges. Web applications don&#8217;t have friendly icons and other visual cues indicating the use of a secure <a class="zem_slink" title="Transport Layer Security" rel="wikipedia" href="http://en.wikipedia.org/wiki/Transport_Layer_Security" target="_blank">SSL/TLS</a> connection. Like most Twitter clients in PHP, chances are good that it actually doesn&#8217;t even use SSL/TLS properly. Just because the security vulnerability is not obvious, it doesn&#8217;t excuse its existence. It is, afterall, a SECURITY VULNERABILITY that would allow anyone capable of intercepting network traffic from the vulnerable application to examine all of its users&#8217; messages in complete defiance of what users&#8217; expect.</p>
<p>From a conservative viewpoint, this is a complete nightmare. SSL/TLS is one of the most basic concepts on the internet. How can you NOT get it right? Isn&#8217;t there a box on a checklist for that? And yet, with every passing month, PHP programmers wheel out source code which not only gets it completely wrong but will even disable it deliberately rather than deal with the work of ensuring it&#8217;s secure.</p>
<p>Within this scenario, something has gone a wee bit wrong. Users expect their data to be protected. Not doing so is either a security vulnerability introduced by a lack of experience or an act of deliberate sabotage performed in the service of some other goal. Either way, such source code is dead, untrustworthy, in need of nuking. It should not be used, it should not be advocated, it should be publicly disclosed and, if it&#8217;s still not fixed, it should be abandoned and consigned to a historical archive of mistakes to bring out when teaching new programmers. More relevantly, we should ask ourselves why this scenario sounds so familiar&#8230;</p>
<p>SSL/TLS issues are as common as sand on a beach in PHP. If I were not a PHP programmer with a severe bias, I might begin writing a blog post about how insecure and dangerous PHP is. Oh&#8230;wait&#8230;;).</p>
<p>The moral of the story is pretty simple. If you respect a user&#8217;s right to have their data handled securely, use libraries and applications that are themselves secure. Otherwise, just use libraries that are insecure, inherit their security vulnerabilities, and pray that nobody ever notices how completely irresponsible you are. It would also be healthy to quit pretending that PHP is a &#8220;secure programming language&#8221; &#8211; it&#8217;s not. It will only ever be as secure as the programmers writing it can accomplish. PHP itself contains so many default insecure settings and functions that writing insecure source code is just matter of opening an editor and typing.</p>
<p>This is, of course, not the correct conclusion&#8230;it&#8217;s merely a symptom of an underlying disease that desperately needs to be addressed.</p>
<p>If I ask any number of PHP programmers why they are sabotaging SSL/TLS and exposing their users to umpteen zillion other security vulnerabilities, there is a common trend in their responses. Most programmers treat security as an afterthought and engage in zero self-directed education about security in general. The most common response is actually shock, followed by denial, followed by excited elation at the idea of fixing stuff, followed by the sobering realisation that someone somewhere is an evil fucker for making their lives harder by not telling them all this sooner. Some graduate further into taking security seriously, seriously.</p>
<p>This is actually PHP&#8217;s current failing: Knowledge.</p>
<p>If I go digging for information about how to do some simple set of security tasks, like output escaping, I will be faced with a massive wall of misinformation. Some of it dates from ancient blog posts written in the early 2000s that have been regurgitated blindly ad nauseam. Some is completely wrong just because the writer never actually tested any of it against known vectors. Some is based on personal experience alone. A tiny fraction is perfected knowledge lost in the noise of a hundred other chattering idiots. And threading its way through everything is the constant barrage of popular excuses that defy logic, common sense, and simple security principles such as Defense In Depth &#8211; the simple is popular, the more complicated truth not.</p>
<p>In PHP, programmers have created their own mini-reality based on a set of beliefs that dismisses all else as heresy to be ignored. In the absence of knowledge, we&#8217;ve founded a religion that makes it okay to tolerate security vulnerabilities, to excuse ourselves from fixing them and to foist solutions on the PHP community as the One True Way. Through it all we ignore the reality of serving the needs of the user. They are the ones who stand to suffer from our failings.</p>
<p>PHP Security is a war on a religion that is stoutly defended.</p>
<p>Signs of this religious dogmatic approach to PHP Security are everywhere. The last PHP Security book I picked up was so incredibly stupid that it now probably occupies egg cartons and cereal boxes made from recycled material (though secretly I hope it made it to toilet paper). Incremental improvements to security, based on a concensus of security experts across multiple programming languages, have been openly ridiculed and debated. Something as simple as enabling secure SSL/TLS has ended up heading down a rabbit hole where apparently the ability to do so is itself unreliable in PHP&#8217;s core implementation compared to CURL and needs far more configuration to boot. Why bother? Just use CURL! A sign of another recurring theme is the PHP documentation&#8217;s weird aversion to explaining how it even addresses security issues or does so with the vaguest of nods as if unsure of itself. Then again, we do have settings like &#8220;allow_url_fopen&#8221; so maybe it is a bit crazy to expect anything else.</p>
<p>The only solution that I can imagine is the simplest: Knowledge! PHP is riddled with knowledge gaps, missing documentation, a lack of progressive improvement, reliable security tools and features, and people with the will and a flair for stubborness to accept the impossible task of tackling all of these and much more. A long as those gaps persist, the vacuum they leave behind will be filled with utter bullshit created by idiots and documentated as fact which promotes further inactivity because programmers at large then remain unaware that a problem even exists. A self sustaining cycle of ignorance emerges.</p>
<p>Eventually, we all need to start asking some simple questions. There&#8217;s a massive list of them unfortunately. However, if we ask enough basic questions, check for what everyone outside of PHP thinks the answer is, examine PHP with this new knowledge and a cold glare, we may actually find those simple questions revealing the very bits and pieces of knowledge we so desperately need.</p>
<p>Seriously, why is it that so many HTTPS dependent clients in PHP disable SSL/TLS protection by disabling peer verification or by never enabling it at all as the case may be? Why do PHP programmers appear to rally round such insecure libraries? How many third party applications have inherited that vulnerability from their dependencies? Are those dependencies themselves compiled from insecure HTTPS connections during deployment? How many of those have a Man-In-The-Middle eavesdropping and manipulating unprotected HTTP requests? Actually, that&#8217;s a trick question. It doesn&#8217;t matter how many &#8211; it only takes one MitM screwing over a single user of one application on a random day at any moment in history. You failed that user by abandoning your responsibility to them.</p>
<p>We can never predict how security vulnerabilities will be used &#8211; the concept of &#8220;low risk&#8221; is the ultimate fallacy generated by an appealing dogma with no foundation in acceptable security principles. It&#8217;s a lie. Like the one where no security measure is perfect and therefore we don&#8217;t need to try. Technically though, that last one is simple gibberish which roughly translates to &#8220;I don&#8217;t want to do my job&#8221;.</p>
<p>Knowledge is the essential ingredient to improving PHP Security. What you don&#8217;t know can bite you; what you do know can be hunted down and shot.</p>
<p>In our next edition of &#8220;The Raving Lunatic Who Escaped Custody In His Undies&#8221;, I will spend a bit more time focusing on this need for Knowledge, some developments in that arena, and a few examples of where it is already leading to a slightly more secure baseline for PHP applications.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/?px"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=eaa575e0-ca36-4088-9e47-018449938a0a" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.astrumfutura.com/2012/10/taking-php-security-seriously-by-taking-it-seriously/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
	</channel>
</rss>
