<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: MySecurity Component</title>
	<atom:link href="http://rossoft.wordpress.com/2006/08/23/mysecurity-component/feed/" rel="self" type="application/rss+xml" />
	<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/</link>
	<description>CakePHP Tips &#38; Tricks</description>
	<lastBuildDate>Tue, 08 Dec 2009 11:58:14 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: webroot</title>
		<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-17554</link>
		<dc:creator>webroot</dc:creator>
		<pubDate>Thu, 18 Jun 2009 16:30:53 +0000</pubDate>
		<guid isPermaLink="false">http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-17554</guid>
		<description>&lt;strong&gt;webroot...&lt;/strong&gt;

Howdy , your most important Grandparenting 101: Chat Rooms, Chat Definitions &#124; Be a Web Safe Kid was quite engaging when I saw it on Thursday searching for webroot....</description>
		<content:encoded><![CDATA[<p><strong>webroot&#8230;</strong></p>
<p>Howdy , your most important Grandparenting 101: Chat Rooms, Chat Definitions | Be a Web Safe Kid was quite engaging when I saw it on Thursday searching for webroot&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bret Kuhns</title>
		<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-17422</link>
		<dc:creator>Bret Kuhns</dc:creator>
		<pubDate>Mon, 21 Jan 2008 17:20:16 +0000</pubDate>
		<guid isPermaLink="false">http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-17422</guid>
		<description>Just in case anyone finds this post from google (like I did), I wanted to make note that this flaw seems to have been fixed in newer builds of cakePHP. I tested /controller/render/viewName on an active cakePHP app of mine and the missing action error was called.</description>
		<content:encoded><![CDATA[<p>Just in case anyone finds this post from google (like I did), I wanted to make note that this flaw seems to have been fixed in newer builds of cakePHP. I tested /controller/render/viewName on an active cakePHP app of mine and the missing action error was called.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rossoft</title>
		<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-435</link>
		<dc:creator>rossoft</dc:creator>
		<pubDate>Sun, 08 Oct 2006 10:38:33 +0000</pubDate>
		<guid isPermaLink="false">http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-435</guid>
		<description>@max: thanks for your posts.

I think that rendering arbitrary views are dangerours:  some views can contain sensitive information hard-coded in the .thtml file that only must be shown to certain users.</description>
		<content:encoded><![CDATA[<p>@max: thanks for your posts.</p>
<p>I think that rendering arbitrary views are dangerours:  some views can contain sensitive information hard-coded in the .thtml file that only must be shown to certain users.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: max</title>
		<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-434</link>
		<dc:creator>max</dc:creator>
		<pubDate>Sun, 08 Oct 2006 10:29:19 +0000</pubDate>
		<guid isPermaLink="false">http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-434</guid>
		<description>2 nao:
$this-&gt;forbidden_actions = array_unique(am($this-&gt;forbidden_actions, get_class_methods(get_parent_class($controller))));
...

This is not very scalable solution. I prefer to get base list of forbidden methods directly from &#039;Controller&#039; class, because for better code reuse one can have more then one level of hierarchy, e.g. class MyController extends GenericTableController extends AppController. All other non-action method must start with &#039;_&#039; and that&#039;s enough.

Without similar security code, badguy can use following nice hack.
http://your_server/cake/anycontroller/render/.htaccess - renders .htaccess from cake&#039;s /app dir, which can have valuable info.</description>
		<content:encoded><![CDATA[<p>2 nao:<br />
$this-&gt;forbidden_actions = array_unique(am($this-&gt;forbidden_actions, get_class_methods(get_parent_class($controller))));<br />
&#8230;</p>
<p>This is not very scalable solution. I prefer to get base list of forbidden methods directly from &#8216;Controller&#8217; class, because for better code reuse one can have more then one level of hierarchy, e.g. class MyController extends GenericTableController extends AppController. All other non-action method must start with &#8216;_&#8217; and that&#8217;s enough.</p>
<p>Without similar security code, badguy can use following nice hack.<br />
<a href="http://your_server/cake/anycontroller/render/.htaccess" rel="nofollow">http://your_server/cake/anycontroller/render/.htaccess</a> &#8211; renders .htaccess from cake&#8217;s /app dir, which can have valuable info.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: max</title>
		<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-433</link>
		<dc:creator>max</dc:creator>
		<pubDate>Sun, 08 Oct 2006 10:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-433</guid>
		<description>I guess views can&#039;t perform any model-desructive actions, because this is controller by, well, controller. This probably is the reason that plain $data is exported to the view, not the corresponding Model children. So rendering /admin_delete won&#039;t cause much trouble, but what&#039;s more F#cked up is that using this &#039;exploit&#039; one can render any file in the webroot dir. The only thing that saves CakePhp from full-scale priviledged documents theft is that one can&#039;t use &quot;/&quot; in the document name and thus can&#039;t browse neither config/ nor /etc/passwd or whatever. But! Maybe it is possible with replacing &quot;/&quot; with its UTF correspondant - I&#039;m not sure that all webservers handle this correctly, because there were some relevant issues not so long ago - and CakePhp simple preg_split will then pass all the path to the $action. Another similar possibly bad method is &quot;redirect&quot;, because if it is possible to pass UTF &#039;/&#039;, then it will be possible to use your CakePHP dispatcher as anonymous proxy.

Vote for putting this check into Dispatcher, but for now I use following in my AppController::beforeFilter().

&lt;code&gt;
	function _checkCanInvokeAction()
	{
		// for f$cking cakeError - or else it recursively creates-starts AppController
		if (empty($this-&gt;params[&#039;action&#039;])) return;

		// there are NO actions in the Controller, period!
		// thus any overriden method in children classes (like redirect in AppController or such)
		// can&#039;t be called from outside no matter that


		$classMethods = get_class_methods($this);  echo ss_as_string($classMethods); exit;
		$classMethodsBase = get_class_methods(&quot;Controller&quot;); 

		if (!in_array(strtolower($this-&gt;params[&#039;action&#039;]), $classMethods))
		{
			Debug::log(__FILE__,__LINE__, &quot;SECURITY: &quot;.$_SERVER[&quot;REMOTE_ADDR&quot;].&quot; tried to access non-existant action &#039;&quot;.$this-&gt;params[&#039;action&#039;].&quot;&#039;&quot;);
			return $this-&gt;cakeError(&#039;missingAction&#039;, array(
										array(&#039;className&#039; =&gt; Inflector::camelize($this-&gt;params[&#039;controller&#039;].&quot;Controller&quot;),
												&#039;action&#039; =&gt; $this-&gt;params[&#039;action&#039;],
												&#039;webroot&#039; =&gt; $this-&gt;webroot,
												&#039;url&#039; =&gt; $this-&gt;here,
												&#039;base&#039; =&gt; $this-&gt;base)));
		}

		if (in_array(strtolower($this-&gt;params[&#039;action&#039;]), $classMethodsBase))
		{
			Debug::log(__FILE__,__LINE__, &quot;SECURITY: &quot;.$_SERVER[&quot;REMOTE_ADDR&quot;].&quot; tried to access private action &#039;&quot;.$this-&gt;params[&#039;action&#039;].&quot;&#039;&quot;);
			return $this-&gt;cakeError(&#039;privateAction&#039;, array(
											array(&#039;className&#039; =&gt; Inflector::camelize($this-&gt;params[&#039;controller&#039;].&quot;Controller&quot;),
													&#039;action&#039; =&gt; $this-&gt;params[&#039;action&#039;],
													&#039;webroot&#039; =&gt; $this-&gt;webroot,
													&#039;url&#039; =&gt; $this-&gt;here,
													&#039;base&#039; =&gt; $this-&gt;base)));
		}
	}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I guess views can&#8217;t perform any model-desructive actions, because this is controller by, well, controller. This probably is the reason that plain $data is exported to the view, not the corresponding Model children. So rendering /admin_delete won&#8217;t cause much trouble, but what&#8217;s more F#cked up is that using this &#8216;exploit&#8217; one can render any file in the webroot dir. The only thing that saves CakePhp from full-scale priviledged documents theft is that one can&#8217;t use &#8220;/&#8221; in the document name and thus can&#8217;t browse neither config/ nor /etc/passwd or whatever. But! Maybe it is possible with replacing &#8220;/&#8221; with its UTF correspondant &#8211; I&#8217;m not sure that all webservers handle this correctly, because there were some relevant issues not so long ago &#8211; and CakePhp simple preg_split will then pass all the path to the $action. Another similar possibly bad method is &#8220;redirect&#8221;, because if it is possible to pass UTF &#8216;/&#8217;, then it will be possible to use your CakePHP dispatcher as anonymous proxy.</p>
<p>Vote for putting this check into Dispatcher, but for now I use following in my AppController::beforeFilter().</p>
<p><code><br />
	function _checkCanInvokeAction()<br />
	{<br />
		// for f$cking cakeError - or else it recursively creates-starts AppController<br />
		if (empty($this-&gt;params['action'])) return;</p>
<p>		// there are NO actions in the Controller, period!<br />
		// thus any overriden method in children classes (like redirect in AppController or such)<br />
		// can't be called from outside no matter that</p>
<p>		$classMethods = get_class_methods($this);  echo ss_as_string($classMethods); exit;<br />
		$classMethodsBase = get_class_methods("Controller"); </p>
<p>		if (!in_array(strtolower($this-&gt;params['action']), $classMethods))<br />
		{<br />
			Debug::log(__FILE__,__LINE__, "SECURITY: ".$_SERVER["REMOTE_ADDR"]." tried to access non-existant action '".$this-&gt;params['action']."'");<br />
			return $this-&gt;cakeError('missingAction', array(<br />
										array('className' =&gt; Inflector::camelize($this-&gt;params['controller']."Controller"),<br />
												'action' =&gt; $this-&gt;params['action'],<br />
												'webroot' =&gt; $this-&gt;webroot,<br />
												'url' =&gt; $this-&gt;here,<br />
												'base' =&gt; $this-&gt;base)));<br />
		}</p>
<p>		if (in_array(strtolower($this-&gt;params['action']), $classMethodsBase))<br />
		{<br />
			Debug::log(__FILE__,__LINE__, "SECURITY: ".$_SERVER["REMOTE_ADDR"]." tried to access private action '".$this-&gt;params['action']."'");<br />
			return $this-&gt;cakeError('privateAction', array(<br />
											array('className' =&gt; Inflector::camelize($this-&gt;params['controller']."Controller"),<br />
													'action' =&gt; $this-&gt;params['action'],<br />
													'webroot' =&gt; $this-&gt;webroot,<br />
													'url' =&gt; $this-&gt;here,<br />
													'base' =&gt; $this-&gt;base)));<br />
		}<br />
	}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jitka</title>
		<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-411</link>
		<dc:creator>Jitka</dc:creator>
		<pubDate>Mon, 02 Oct 2006 11:08:41 +0000</pubDate>
		<guid isPermaLink="false">http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-411</guid>
		<description>I think Your code is supposed to be in CakePHP core.

I can imagine websites with usage of admin routes and some simple session-based authorization in beforeFilter(). Then explore implementation of Controller::setAction() - what will happen when someone non-authorized opens 
http://your_server/users/setAction/admin_index/
or even
http://your_server/users/setAction/admin_delete/2/

???

Again: 
I think Your code is supposed to be in CakePHP core.

Have a nice day!</description>
		<content:encoded><![CDATA[<p>I think Your code is supposed to be in CakePHP core.</p>
<p>I can imagine websites with usage of admin routes and some simple session-based authorization in beforeFilter(). Then explore implementation of Controller::setAction() &#8211; what will happen when someone non-authorized opens<br />
<a href="http://your_server/users/setAction/admin_index/" rel="nofollow">http://your_server/users/setAction/admin_index/</a><br />
or even<br />
<a href="http://your_server/users/setAction/admin_delete/2/" rel="nofollow">http://your_server/users/setAction/admin_delete/2/</a></p>
<p>???</p>
<p>Again:<br />
I think Your code is supposed to be in CakePHP core.</p>
<p>Have a nice day!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nao</title>
		<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-258</link>
		<dc:creator>nao</dc:creator>
		<pubDate>Fri, 25 Aug 2006 20:43:49 +0000</pubDate>
		<guid isPermaLink="false">http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-258</guid>
		<description>function startup(&amp;$controller)
{
    $this-&gt;forbidden_actions = array_unique(am($this-&gt;forbidden_actions, get_class_methods(get_parent_class($controller))));
    if(!empty($controller-&gt;alowedActions)){
        $this-&gt;alowActions($controller-&gt;alowedActions);
    }
    if(!empty($controller-&gt;forbiddenActions)){
        $this-&gt;forbiddenActions($controller-&gt;forbiddenActions);
    }
.......
}

function alowActions($alowedActions)
{
    $this-&gt;forbidden_actions = array_diff($this-&gt;forbidden_actions, $alowedActions);
}

function forbiddenAction($forbiddenAction)
{
    $this-&gt;forbidden_actions = array_unique(am($this-&gt;forbidden_actions, $forbiddenAction));
}

(not tested)</description>
		<content:encoded><![CDATA[<p>function startup(&amp;$controller)<br />
{<br />
    $this-&gt;forbidden_actions = array_unique(am($this-&gt;forbidden_actions, get_class_methods(get_parent_class($controller))));<br />
    if(!empty($controller-&gt;alowedActions)){<br />
        $this-&gt;alowActions($controller-&gt;alowedActions);<br />
    }<br />
    if(!empty($controller-&gt;forbiddenActions)){<br />
        $this-&gt;forbiddenActions($controller-&gt;forbiddenActions);<br />
    }<br />
&#8230;&#8230;.<br />
}</p>
<p>function alowActions($alowedActions)<br />
{<br />
    $this-&gt;forbidden_actions = array_diff($this-&gt;forbidden_actions, $alowedActions);<br />
}</p>
<p>function forbiddenAction($forbiddenAction)<br />
{<br />
    $this-&gt;forbidden_actions = array_unique(am($this-&gt;forbidden_actions, $forbiddenAction));<br />
}</p>
<p>(not tested)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nao</title>
		<link>http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-257</link>
		<dc:creator>Nao</dc:creator>
		<pubDate>Fri, 25 Aug 2006 20:21:19 +0000</pubDate>
		<guid isPermaLink="false">http://rossoft.wordpress.com/2006/08/23/mysecurity-component/#comment-257</guid>
		<description>Hi Miguel,

Just a suggestion to prevent custom method in appController or in FixController (for FlexyFix).

function startup(&amp;$controller)
 {
    $this-&gt;forbidden_actions = am($this-&gt;forbidden_actions,      get_class_methods(get_parent_class($controller)));</description>
		<content:encoded><![CDATA[<p>Hi Miguel,</p>
<p>Just a suggestion to prevent custom method in appController or in FixController (for FlexyFix).</p>
<p>function startup(&amp;$controller)<br />
 {<br />
    $this-&gt;forbidden_actions = am($this-&gt;forbidden_actions,      get_class_methods(get_parent_class($controller)));</p>
]]></content:encoded>
	</item>
</channel>
</rss>
