<?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>LeeseIT Blogs &#187; MySQL</title>
	<atom:link href="http://www.leeseit.com/blogs/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.leeseit.com/blogs</link>
	<description>A Blog where Intelligence and Technology meet</description>
	<lastBuildDate>Wed, 02 Jun 2010 14:44:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Quickie</title>
		<link>http://www.leeseit.com/blogs/2006/08/28/php-quickie/</link>
		<comments>http://www.leeseit.com/blogs/2006/08/28/php-quickie/#comments</comments>
		<pubDate>Tue, 29 Aug 2006 01:10:03 +0000</pubDate>
		<dc:creator>Leroy Leese</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blogs.leeseit.com/wordpress/?p=3</guid>
		<description><![CDATA[So you want to validate inputs, eh?  If you said, &#8220;No&#8221;, think again.�  Well here is a little tip for you.  If you are passing in any kind of number that you use as an index in a table, you better do something like this:
$val = strval(intval($_GET['val'])); 
&#8220;Why?&#8221; you ask?
The reason is [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to validate inputs, eh?  If you said, &#8220;No&#8221;, think again.�  Well here is a little tip for you.  If you are passing in any kind of number that you use as an index in a table, you better do something like this:</p>
<p><code>$val = strval(intval($_GET['val'])); </code></p>
<p>&#8220;Why?&#8221; you ask?</p>
<p>The reason is simple (and I don&#8217;t think I am giving away any hacking secrets here) &#8211; If you are going to use this number to retrieve a value in a query, ie <code>"SELECT something FROM table WHERE ref = " . $_GET['val']</code>, someone could easily &#8211; and I mean EASILY do a bait and switch like this&#8230;</p>
<p>If you are expecting <code>$_GET['val'] = "1"</code>, they could put <code>$_GET['val'] = "1; DELETE FROM table;"</code></p>
<p>Unclear?  The way they can do this is simply this:</p>
<p><code>http://www.yoursite.com/index.php?val=1</code></p>
<p>VS.</p>
<p><code>http://www.yoursite.com/index.php?val=1;DELETE FROM table</code></p>
<p>Do you see how easy that was?  They just cleared out your table and you didn&#8217;t even have a chance.  They terminated your query, and ran another one right under your nose.  And you will not have a record of it except the apache logs showing the GET string. If they couldn&#8217;t figure out the table&#8217;s name, it might take a while, and you might catch them, but why take the chance?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leeseit.com/blogs/2006/08/28/php-quickie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
