<?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>RubberNeck Designs &#187; Web Security</title>
	<atom:link href="http://www.rubberneckdesigns.com/category/web-security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubberneckdesigns.com</link>
	<description>Web Developer Notes &#38; Sharing</description>
	<lastBuildDate>Sat, 10 Apr 2010 15:22:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Drupal Comments In A Block</title>
		<link>http://www.rubberneckdesigns.com/drupal-6/drupal-comments-in-a-block/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6/drupal-comments-in-a-block/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 15:22:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[User Iterface Design]]></category>
		<category><![CDATA[Web Security]]></category>

		<guid isPermaLink="false">http://www.rubberneckdesigns.com/?p=298</guid>
		<description><![CDATA[Why would you need to put Drupal comments into a block?  Well, recently I was working with another developer that decided to use Quick Tabs to create a menu that would show the current content type&#8217;s comments. Quick Tabs uses blocks, so there is one reason I can think of.
Ok, so getting the content type&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Why would you need to put Drupal comments into a block?  Well, recently I was working with another developer that decided to use Quick Tabs to create a menu that would show the current content type&#8217;s comments. Quick Tabs uses blocks, so there is one reason I can think of.</p>
<p>Ok, so getting the content type&#8217;s comments into a block is pretty easy once you know how.</p>
<p>This method will require you to use PHP code from within the block you will create to show the comments. So the first thing is to make sure that this is possible by going to site building and then modules and turning on the <strong>PHP Filter</strong> under the category of Core Optional (if it is not already on that is).</p>
<p><strong>NOTE: </strong>Check at <code>admin/settings/filters</code> to be sure that only trusted roles can use the PHP filter, otherwise your web site could be vulnerable to attack. By default, only the administrator can use this filter.</p>
<p>Create a new block and select a region for it. Put the following code on the <strong>body</strong> textarea:</p>
<p><img class="alignnone size-medium wp-image-308" title="comments in block php code for drupal" src="http://www.rubberneckdesigns.com/wp-content/uploads/2010/04/Screen-shot-2010-04-10-at-11.04.14-AM-300x186.jpg" alt="comments in block php code for drupal" width="300" height="186" /></p>
<p>Do not forget to select the <strong>PHP filter</strong> from the list of the <em>input filters</em>. After entering the rest of the settings for your block click save.</p>
<p>Now your new block should be ready to assign to whatever region you want. If the page you load has comments related to it. They should now appear via the block.</p>
<p>The arg() funtion may seem a bit cryptic if you&#8217;re new to Drupal. Here is a quick explanation from <a href="http://www.g-loaded.eu/2009/05/07/drupal-tip-list-a-nodes-taxonomy-terms-inside-a-block/#comment-12266">George Notaras</a> in his post: <a title="Drupal Tip: List a node’s taxonomy terms inside a Block" rel="bookmark" href="http://www.g-loaded.eu/2009/05/07/drupal-tip-list-a-nodes-taxonomy-terms-inside-a-block/">Drupal Tip: List a node’s taxonomy terms inside a Block</a> which I found helpful in compiling this information.</p>
<blockquote><p><span style="color: #0000ff;"><em>&#8220;Now to some technical details about <strong>arg(0)</strong> and <strong>arg(1)</strong>, which probably seem a bit cryptic to a user that is not experienced with Drupal (like me). Assume we have the following <strong>URL</strong> to a node: <code>www.example.org/node/23</code>, which means that the <strong>path</strong> to the page is <code>/node/23</code>. Well, </em><em>arg(0) is the <code>node</code> part and </em><em>arg(1) is the second part; <code>23</code> that is. Read about the <a href="http://api.drupal.org/api/function/arg">arg()</a> function.&#8221;</em></span></p></blockquote>
<p>I hope this was helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6/drupal-comments-in-a-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Protect Against SQL Injection</title>
		<link>http://www.rubberneckdesigns.com/ajax-web-design/how-to-protect-against-sql-injection/</link>
		<comments>http://www.rubberneckdesigns.com/ajax-web-design/how-to-protect-against-sql-injection/#comments</comments>
		<pubDate>Thu, 07 May 2009 17:44:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Security]]></category>

		<guid isPermaLink="false">http://rubberneckdesigns.com/?p=74</guid>
		<description><![CDATA[One of the most common web security problems is SQL Injection. As the name implies, SQL injections works by introducing malicious SQL code where it doesn&#8217;t belong. Since it is SQL code you could probably guess that the attacker &#8220;injects&#8221; his poison via database queries. Web developers often pass some sort of variable to their [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most common web security problems is SQL Injection. As the name implies, SQL injections works by introducing malicious SQL code where it doesn&#8217;t belong. Since it is SQL code you could probably guess that the attacker &#8220;injects&#8221; his poison via database queries. Web developers often pass some sort of variable to their database queries. Very common are variables that are influenced by user input. User input, to variable, then to query,- get it? So, there is a need for a way of eliminating the user&#8217;s ability to manipulate the variable in any way that could effect the query.</p>
<p><strong>What Happens With SQL Injection</strong></p>
<p>By passing an unexpected string of code into a user input, such a form, an attacker send damaging code that causes an otherwise good query to go haywire. For example:<span id="more-74"></span></p>
<div id="attachment_73" class="wp-caption alignleft" style="width: 384px"><img class="size-full wp-image-73" title="code snippet sql injection unprotected" src="http://www.rubberneckdesigns.com.php5-5.dfw1-2.websitetestlink.com/wp-content/uploads/2009/05/picture-8.png" alt="unprotected query is vulnerable" width="374" height="18" /><p class="wp-caption-text">unprotected query is vulnerable</p></div>
<p>The above snippet of code works as long as users put in the expected information. An attacker, will instead, make clever use of a few extra characters. You likely know by now that SQL requires a semi-colon at the end of each query. PHP automatically adds it in if you omit it. Because of this, the attacker, by closing the string and using the closing parenthesis to finish the query followed by a semi colon, can add an additional query to drop the table.<img class="size-full wp-image-75" title="example of SQL Injection" src="http://www.rubberneckdesigns.com.php5-5.dfw1-2.websitetestlink.com/wp-content/uploads/2009/05/picture-9.png" alt="example of SQL Injection" width="349" height="14" /></p>
<div class="mceTemp">
<dl id="attachment_75" class="wp-caption alignnone" style="width: 359px;">
<dd class="wp-caption-dd"><span style="color: #888888;">example of SQL Injection</span></dd>
</dl>
</div>
<p>This is what we in the world of secure web development refer to as a &#8216;bad thing&#8217;!<br />
Scary isn&#8217;t it? Attackers have used this method to not only drop tables and destroy records, but also to retrieve highly sensitive information.</p>
<p><strong>How to Protect Against SQL Injection</strong></p>
<p>OK, after that scary bit of information, you&#8217;ll be glad to know that protecting yourself is really not all that hard. The hard part is always remembering when and where to do it.</p>
<p>Protecting against SQL Injection is a simple matter of calling a PHP function that renders data safe ( or cleansed ) for use in a query. There are a few methods for cleansing user input in PHP depending on the PHP extension you are using. We will be discussing the mysql extension.The name of the function is:<br />
<span style="color: #0000ff;">mysql_real_escape_string()</span>. Notice in this snippet how it is used:</p>
<div id="attachment_72" class="wp-caption alignnone" style="width: 480px"><img class="size-full wp-image-72" title="code snippet mysql_real_escape_string" src="http://www.rubberneckdesigns.com.php5-5.dfw1-2.websitetestlink.com/wp-content/uploads/2009/05/picture-7.png" alt="How to protect again SQL Injection" width="470" height="205" /><p class="wp-caption-text">How to protect again SQL Injection</p></div>
<p>See how easy it is?  Just take the user input (in this case a post ) and pass it through the <span style="color: #0000ff;">mysql_real_escape_string()</span> function, (as shown on line 7 ). Then use the &#8220;cleansed&#8221; variable in the query ( as shown on line 9 ).</p>
<p>It is so easy to protect against this, yet it is often overlooked or forgotten. SO remember to use <span style="color: #0000ff;">mysql_real_escape_string()</span> to cleanse your input to help guard against SQL Injection.</p>
<p>There is more to learn and be discussed so feel free to stop back or drop me any suggestions or tips to share.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/ajax-web-design/how-to-protect-against-sql-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Error Reporting and Security</title>
		<link>http://www.rubberneckdesigns.com/php/php-error-reporting-and-security/</link>
		<comments>http://www.rubberneckdesigns.com/php/php-error-reporting-and-security/#comments</comments>
		<pubDate>Thu, 07 May 2009 15:55:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Security]]></category>

		<guid isPermaLink="false">http://rubberneckdesigns.com/?p=60</guid>
		<description><![CDATA[Error reporting in PHP gives valuable insight during the development stages. This Insight can be a great aid to problem solving. There are others, however who are interested in why your web site has failed on occasion. The information thrown out by many PHP errors gives the kind of information about your web application that [...]]]></description>
			<content:encoded><![CDATA[<p>Error reporting in PHP gives valuable insight during the development stages. This Insight can be a great aid to problem solving. There are others, however who are interested in why your web site has failed on occasion. The information thrown out by many PHP errors gives the kind of information about your web application that can make you vulnerable to crackers (malicious web site breakers). In fact apart from reading the code itself, error reporting is some of the most valuable intelligence an attacker can gather when looking for vulnerabilities in your web application.</p>
<p>So, what should be done once you launch your new web site? Well, as proud as you may be of your new creative geniuses, a wise web developer has the humility to recognize that bugs are still likely to surface from time to time. While you do not want any attackers to see error <span id="more-60"></span>reporting, the information is still valuable to you for squishing bugs. You can (and should) write your error reporting to a file. Actually, PHP does this by default. If you are on a shared server, though, you likely will not have access to this file. You will need to write these errors to your own file.</p>
<p><strong>Don&#8217;t Worry, Witting Errors to a File Is Easy</strong><br />
All you need to do is make a few adjustments in you php.ini file. Here are a few php.ini directives that are relevant:</p>
<p>•    <span style="color: #808080;">display_errors</span> This directive controls whether PHP errors should be sent to the screen. For the production environment this should be turned off.<br />
•    <span style="color: #808080;">error_reporting</span> This directive controls which errors that should be reported. You should set this to E_ALL and you should fix all issues that appear by doing this.<br />
•    <span style="color: #808080;">log_errors</span> This directive controls whether errors should be logged to a file. I would recommend that you always turn this on.<br />
•    <span style="color: #808080;">error_log</span> This is the path of the file errors should be written to. This is only applies if log_errors is turned on obviously.</p>
<p>Your directory structure effects how<span style="color: #808080;"> error_log</span> is set, since it involves creating a path to the error log.</p>
<p>The important thing to remember is that you want to be cautious about what information your error reporting is throwing out to the client. Whenever, possible keep it private. While it should be safely tucked away, it does provide valuable information to you as a web developer. So, keep it handy.</p>
<p>There are many other things to consider in safely setting up a PHP environment with security in mind. We will discuss these in future posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/php/php-error-reporting-and-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
