<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>php security blog</title>
	<atom:link href="http://phpsecurity.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpsecurity.wordpress.com</link>
	<description>security threads for web developers from bernd essl</description>
	<pubDate>Fri, 03 Oct 2008 13:29:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>become a hacker with webgoat</title>
		<link>http://phpsecurity.wordpress.com/2008/09/15/become-a-hacker-with-webgoat/</link>
		<comments>http://phpsecurity.wordpress.com/2008/09/15/become-a-hacker-with-webgoat/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 11:35:14 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[Information]]></category>

		<category><![CDATA[Injection]]></category>

		<category><![CDATA[LFI]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[RFI]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[XSS]]></category>

		<category><![CDATA[sql]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[flaws]]></category>

		<category><![CDATA[hacking]]></category>

		<category><![CDATA[learn]]></category>

		<category><![CDATA[security]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[webgoat]]></category>

		<category><![CDATA[websecurity]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/?p=78</guid>
		<description><![CDATA[WebGoat is a insecure web application which is designed to teach web  application security concepts.
You can try hacking: Access Control Flaws, Authentication Flaws, Session Management Flaws, Cross-Site Scripting (XSS), Buffer Overflows, Injection Flaws, Improper Error Handling, Insecure Storage,  Denial of Service, Insecure Configuration, Web Services and AJAX Security.
There is a &#8220;Lesson Plan&#8221; a [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>WebGoat is a insecure web application which is designed to teach web  application security concepts.<br />
You can try hacking: Access Control Flaws, Authentication Flaws, Session Management Flaws, Cross-Site Scripting (XSS), Buffer Overflows, Injection Flaws, Improper Error Handling, Insecure Storage,  Denial of Service, Insecure Configuration, Web Services and AJAX Security.</p>
<p>There is a &#8220;Lesson Plan&#8221; a kind of tutorial and in the &#8220;Hints Menu&#8221; you can view the parameters, cookies, the Code and the solution.<br />
It&#8217;s a lot of fun and you learn more about web application security.</p>
<p><span id="more-78"></span><br />
You can download the app from http://code.google.com/p/webgoat/.</p>
<p>It comes with the Java Runtime Environment and a configured Tomcat 5.5<br />
server and should run on any platform.</p>
<p>If you are using Linux or OSX you must download http://webgoat.googlecode.com/svn/tags/webgoat-5.1/main/webgoat.sh  to start webgoat.<br />
Put the webgoat.sh in your unpacked webgoat directory and start it<br />
with the terminal:</p>
<p>$ sh webgoat.sh start8080</p>
<p>On Windows it should run throw a double-click on webgoat8080.bat.</p>
<p>Browse to http://guest:guest@127.0.0.1:8080/WebGoat/attack with your<br />
browser and start your first lesson.</p>
<p>happy hacking</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/78/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/78/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/78/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/78/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/78/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=78&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2008/09/15/become-a-hacker-with-webgoat/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>
	</item>
		<item>
		<title>hide your JavaScript</title>
		<link>http://phpsecurity.wordpress.com/2008/03/02/hide-your-javascript/</link>
		<comments>http://phpsecurity.wordpress.com/2008/03/02/hide-your-javascript/#comments</comments>
		<pubDate>Sun, 02 Mar 2008 12:28:57 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[Information]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[base62]]></category>

		<category><![CDATA[encode]]></category>

		<category><![CDATA[obfuscate]]></category>

		<category><![CDATA[packer]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/?p=77</guid>
		<description><![CDATA[If there is a reason why you don&#8217;t want humans to read your JavaScript code, you can use the packer from
http://dean.edwards.name/packer/ to obfuscated it (online).
The packer compress the code to one line, deletes all comments and has the option to encode it with Base62. You can put the generated code in your code, it should [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If there is a reason why you don&#8217;t want humans to read your JavaScript code, you can use the packer from<br />
<a href="http://dean.edwards.name/packer/">http://dean.edwards.name/packer/</a> to obfuscated it (online).</p>
<p>The packer compress the code to one line, deletes all comments and has the option to encode it with Base62. You can put the generated code in your code, it should work with any browser.<br />
You must correctly terminate all JavaScript statements with semi-colons.</p>
<p>Here an example script and the output from the packer:<br />
<span id="more-77"></span></p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">
var a, b;</p>
<p>a = &#8220;hello &#8220;;<br />
b = &#8220;world!&#8221;;</p>
<p>function send_msg(a, b) {<br />
    // alert a and b<br />
    alert(a +b);<br />
}</p>
<p>send_msg(a, b);
</p></div>
<p>after packing </p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">var a,b;a=&#8221;hello &#8220;;b=&#8221;world!&#8221;;function send_msg(a,b){alert(a+b)}send_msg(a,b);</div>
<p>after packing and Base62 encoding</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">eval(function(p,a,c,k,e,r){e=String;if(!&#8221;.replace(/^/,String)){while(c&#8211;)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return&#8217;\w+&#8217;};c=1};while(c&#8211;)if(k[c])p=p.replace(new RegExp(&#8217;\b&#8217;+e(c)+&#8217;\b&#8217;,'g&#8217;),k[c]);return p}(&#8217;6 0,1;0=&#8221;5 &#8220;;1=&#8221;3!&#8221;;4 2(0,1){7(0+1)}2(0,1);&#8217;,8,8,&#8217;a|b|send_msg|world|function|hello|var|alert&#8217;.split(&#8217;|'),0,{}))</div>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/77/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/77/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=77&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2008/03/02/hide-your-javascript/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>
	</item>
		<item>
		<title>hardening wordpress</title>
		<link>http://phpsecurity.wordpress.com/2008/02/26/hardening-wordpress/</link>
		<comments>http://phpsecurity.wordpress.com/2008/02/26/hardening-wordpress/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 10:26:43 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[security]]></category>

		<category><![CDATA[web]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/?p=76</guid>
		<description><![CDATA[I had positive feedback after posting my article about hardening Joomla!, so I will now focus on the blog-software wordpress.
Here are a couple of tips that you can use to make your wordpress a bit securer.
Change the default name of your administrator login (admin) and choose a strong password for all your accounts. It&#8217;s also [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I had positive feedback after posting my article about hardening Joomla!, so I will now focus on the blog-software wordpress.<br />
Here are a couple of tips that you can use to make your wordpress a bit securer.</p>
<p>Change the default name of your administrator login (admin) and choose a strong password for all your accounts. It&#8217;s also a good idea to use different login- and author-names, wordpress has also a great user levels.<br />
<span id="more-76"></span><br />
Hide the version of wordpress by removing the generator-meta-tag. You find it in the template code it should look something like this:<br />
&lt;meta name=&#8221;generator&#8221; content=&#8221;WordPress &#8221; /&gt;<br />
Please note it&#8217;s possible to view the version in the feed.</p>
<p>If your register-globals settings are on, try to disable them (php.ini or .htaccess).</p>
<p>Turn your Magic quotes for incoming GET/POST/Cookie data on, again SQL injections.</p>
<p>Restrict access with a .htaccess in your wp-admin/ folder. Take a look on an older posting <a href="http://phpsecurity.wordpress.com/2007/12/22/htaccess-tips-and-tricks/">http://phpsecurity.wordpress.com/2007/12/22/htaccess-tips-and-tricks/</a> where you find solutions for limiting by IP addresses and password protection.</p>
<p>Delete disabled templates and plugins that you don&#8217;t need from your webspace.</p>
<p>Block wordpress-folders from being indexed by search engines.<br />
Add the following line to your robots.txt:<br />
Disallow: /wp-*</p>
<p>With an online tool from blogsecurity.net, you can scan your wordpress. You need a plugin before doing that.<br />
http://blogsecurity.net/wordpress/news-140707/<br />
http://blogsecurity.net/cgi-bin/wp-scanner.cgi</p>
<p>Disable public browsing of the plugin folder, by putting an empty index.html in wp-content/plugins/.</p>
<p>And last but not least, update your wordpress, your plugins and make regular backups of your site and database.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/76/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/76/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=76&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2008/02/26/hardening-wordpress/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>
	</item>
		<item>
		<title>playing with a backdoor</title>
		<link>http://phpsecurity.wordpress.com/2008/02/14/playing-with-a-backdoor/</link>
		<comments>http://phpsecurity.wordpress.com/2008/02/14/playing-with-a-backdoor/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 20:27:42 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[Information]]></category>

		<category><![CDATA[Injection]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[backdoor]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[netcat]]></category>

		<category><![CDATA[ngrep]]></category>

		<category><![CDATA[security]]></category>

		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/?p=67</guid>
		<description><![CDATA[I played last night with a backdoor shell that I found on the net and will show you how this works and how you can find traces if you are the system administrator.
I used 2 vm&#8217;s (virtual machines), both based on Debian/Linux one called &#8220;victim&#8221; it simulates the cracked server where the backdoor runs and [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I played last night with a backdoor shell that I found on the net and will show you how this works and how you can find traces if you are the system administrator.</p>
<p>I used 2 vm&#8217;s (virtual machines), both based on Debian/Linux one called &#8220;victim&#8221; it simulates the cracked server where the backdoor runs and the other box called &#8220;hacky&#8221; where the bad guy is sitting in front :)</p>
<p>The first step of the bad guy is to start a server that listens on some port (12345) on his box, a good program for this is netcat, the command could be something like: netcat -l -p 12345</p>
<p><span id="more-67"></span></p>
<p><img src='http://phpsecurity.files.wordpress.com/2008/02/a1_master_setup.png' alt='setup' /></p>
<p>After compiling the backdoor in an executable program on the cracked server (&#8221;victim&#8221;), the bad guy starts it and sends a shell to his box home.</p>
<p><img src='http://phpsecurity.files.wordpress.com/2008/02/1_victim_setup.png' alt='start the backdoor' /></p>
<p>Back at the shell of the bad guy we see that the backdoor sends us some information about the box and the banner of the author of the script.</p>
<p><img src='http://phpsecurity.files.wordpress.com/2008/02/2_master_info.png' alt='ping from backdoor' /></p>
<p>The bad guy can now send every command to the cracked server, like &#8220;hostname&#8221; and he gets the hostname which is &#8220;victim&#8221; back</p>
<p><img src='http://phpsecurity.files.wordpress.com/2008/02/3_sendhostname.png' alt='send hostname' /></p>
<p>So what can a system administrator do in this case?</p>
<p>First of all, don&#8217;t panic and plug out the computer, a lot of traces could be destroyed after you do that.</p>
<p>A good way is to check the process list, with something like &#8220;ps ax&#8221; or &#8220;ps fax&#8221;. As you can see there is the process of the backdoor (marked red)</p>
<p><img src='http://phpsecurity.files.wordpress.com/2008/02/4_detective_psax.png' alt='find backdoor with ps ax' /></p>
<p>We know now the process ID the port and the IP where the shell is listening. Now it&#8217;s time for another great program  called ngrep. With ngrep you can sniff network traffic in nearly the same way you can use the normal grep on Linux.<br />
Start ngrep on the port that the backdoor uses.</p>
<p><img src='http://phpsecurity.files.wordpress.com/2008/02/6_start-ngrep.png' alt='sniffing with ngrep' /></p>
<p>The bad guy sends the command &#8220;uptime&#8221;.</p>
<p><img src='http://phpsecurity.files.wordpress.com/2008/02/7_send_uptime_cmd.png' alt='send uptime' /></p>
<p>And the administrator sees in his ngrep output the &#8220;uptime&#8221; request also.</p>
<p><img src='http://phpsecurity.files.wordpress.com/2008/02/8_ngrep_sniff.png' alt='ngrep sniffed something' /></p>
<p>Yes this was a very lucky system administrator, in the real life crackers use encrypted backdoors or rootkit which can hide processes or manipulate commands like ps.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/67/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/67/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=67&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2008/02/14/playing-with-a-backdoor/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2008/02/a1_master_setup.png" medium="image">
			<media:title type="html">setup</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2008/02/1_victim_setup.png" medium="image">
			<media:title type="html">start the backdoor</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2008/02/2_master_info.png" medium="image">
			<media:title type="html">ping from backdoor</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2008/02/3_sendhostname.png" medium="image">
			<media:title type="html">send hostname</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2008/02/4_detective_psax.png" medium="image">
			<media:title type="html">find backdoor with ps ax</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2008/02/6_start-ngrep.png" medium="image">
			<media:title type="html">sniffing with ngrep</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2008/02/7_send_uptime_cmd.png" medium="image">
			<media:title type="html">send uptime</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2008/02/8_ngrep_sniff.png" medium="image">
			<media:title type="html">ngrep sniffed something</media:title>
		</media:content>
	</item>
		<item>
		<title>hardening the famous PHP-CMS Joomla!</title>
		<link>http://phpsecurity.wordpress.com/2008/02/04/hardening-the-famous-php-cms-joomla/</link>
		<comments>http://phpsecurity.wordpress.com/2008/02/04/hardening-the-famous-php-cms-joomla/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 16:34:10 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[Information]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[cms]]></category>

		<category><![CDATA[joomla]]></category>

		<category><![CDATA[security]]></category>

		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/2008/02/04/hardening-the-famous-php-cms-joomla/</guid>
		<description><![CDATA[I&#8217;m not a big fan of Joomla! but a client wanted to use it and so I had a closer look on it, to make it a bit securer.
For the moment I work with the 1.0.14 version and read that the Joomla1.5 work with safe mode on and has some nice security features.
Here are some [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m not a big fan of Joomla! but a client wanted to use it and so I had a closer look on it, to make it a bit securer.<br />
For the moment I work with the 1.0.14 version and read that the Joomla1.5 work with safe mode on and has some nice security features.<br />
Here are some tips which you can also use if you aren&#8217;t a Joomla head.</p>
<p><span id="more-66"></span></p>
<p>- always upgrade to newer stable versions, you can check if there is an upgrade for your Joomla! in your Admin panel System-&gt;Version Check<br />
- put a .htaccess file in your &#8220;administrator&#8221;-folder to protect all the files in the folder and subfolders<br />
- change your administrator login, default is &#8220;admin&#8221; to another name and make sure the password is strong enough<br />
- change the permissions of your config file</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">
chmod 644 configuration.php
</div>
<p>- if you can use SSL without any pain use it.<br />
- delete temporary installation files and images you don&#8217;t need from Joomla!&#8217;s subdirectories<br />
- if you plan to install and use extensions, take a look at security lists for it, like http://secunia.com/search/?search=Joomla and keep them fresh</p>
<p>all changes in the php.ini are global so be careful with changes!<br />
- disable function that could be a security risk with &#8220;disable_functions&#8221;</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">
disable_functions = show_source, system, shell_exec, passthru, exec, popen, proc_open
</div>
<p>- Magic quotes for incoming GET/POST/Cookie data again SQL injections</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">
magic_quotes_gpc = On
</div>
<p>- Turn off your Register Globals</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">
register_globals = Off
</div>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/66/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/66/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=66&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2008/02/04/hardening-the-famous-php-cms-joomla/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>
	</item>
		<item>
		<title>hide your php source code (expired)</title>
		<link>http://phpsecurity.wordpress.com/2008/01/02/hide-your-php-source-code/</link>
		<comments>http://phpsecurity.wordpress.com/2008/01/02/hide-your-php-source-code/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 23:30:58 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[Information]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[bcompiler]]></category>

		<category><![CDATA[crypt]]></category>

		<category><![CDATA[phpbytecode]]></category>

		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/2008/01/02/hide-your-php-source-code/</guid>
		<description><![CDATA[I&#8217;m a big fan of the open source philosophy but sometimes it&#8217;s useful to have an unreadable binary source code.
In this posting i will show you how to use and how to install bcompiler to encode your scripts in phpbytecode, enabling you to protect the source code.

First we need a source file (source.php) and convert [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m a big fan of the open source philosophy but sometimes it&#8217;s useful to have an unreadable binary source code.<br />
In this posting i will show you how to use and how to install bcompiler to encode your scripts in phpbytecode, enabling you to protect the source code.<br />
<span id="more-63"></span><br />
First we need a source file (source.php) and convert it with make_bytecode.php to a byte code file (crypt.php).</p>
<p>The source.php is an example php file you can add your own code here.</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">
&lt;?php<br />
if ($_GET['foo'] == &#8220;bar&#8221;) {<br />
    echo &#8220;bar&#8221;;<br />
} else {<br />
    echo &#8220;foo&#8221;;<br />
}<br />
?&gt;</div>
<p>make_bytecode.php converts the source.php to crypt.php. Make sure that crypt.php is writeable.</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">
&lt;?php<br />
$f = fopen(&#8221;crypt.php&#8221;, &#8220;w&#8221;);<br />
bcompiler_write_header($f);<br />
bcompiler_write_file($f, &#8220;source.php&#8221;);<br />
bcompiler_write_footer($f);<br />
?&gt;
</div>
<p>After executing make_bytecode.php in your browser or command line crypt.php should be generated.</p>
<p>As you can see in the picture below the source code of crypt.php isn&#8217;t readable but you can execute the php code like any other php file.</p>
<p><img src='http://phpsecurity.files.wordpress.com/2007/12/bcompiler_test.png' alt='bcompiler crypt file output' /></p>
<p><strong>Install:</strong></p>
<p>The package and information you can find here:<br />
<a href="http://pecl.php.net/package/bcompiler">http://pecl.php.net/package/bcompiler</a><br />
I installed bcompiler on Debian Etch, but it should work on any Linux systems and on windows too. </p>
<p>If not installed you have to install the php-developer package (php4 or php5):<br />
    <code>sudo aptitude install php5-dev</code></p>
<p>I also had to install the libbz2-dev, to prevent the error message &#8220;configure: error: Please reinstall the BZip2 distribution&#8221; from the pecl installer.<br />
    <code>sudo aptitude install libbz2-dev</code></p>
<p>After that I installed bcompiler version 0.8 over the pecl installer:<br />
    <code>sudo pecl install channel://pecl.php.net/bcompiler-0.8</code></p>
<p>Make sure that the installer return this line at the end &#8220;install ok: channel://pear.php.net/bcompiler-0.8&#8243;.<br />
If not check the error messages and try to fix it!</p>
<p>Add <code>extension=bcompiler.so</code> to your php.ini</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/63/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/63/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=63&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2008/01/02/hide-your-php-source-code/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>

		<media:content url="http://phpsecurity.files.wordpress.com/2007/12/bcompiler_test.png" medium="image">
			<media:title type="html">bcompiler crypt file output</media:title>
		</media:content>
	</item>
		<item>
		<title>Spam protection with Akismet</title>
		<link>http://phpsecurity.wordpress.com/2007/12/23/spam-protection-with-akismet/</link>
		<comments>http://phpsecurity.wordpress.com/2007/12/23/spam-protection-with-akismet/#comments</comments>
		<pubDate>Sun, 23 Dec 2007 19:32:20 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[spam]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[akismet]]></category>

		<category><![CDATA[antispam]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/2007/12/23/spam-protection-with-akismet/</guid>
		<description><![CDATA[Akismet, or Automattic Kismet, is a text spam filtering service created by Automattic, the corporation which employs most of the main developers of WordPress.
When a new comment is posted on your site, Akismet webs service catches the comment and tests whether a comment is valued as &#8220;spam&#8221; or &#8220;not spam&#8221;.
This is a good protection because [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://akismet.com/">Akismet</a>, or Automattic Kismet, is a text spam filtering service created by Automattic, the corporation which employs most of the main developers of WordPress.</p>
<p>When a new comment is posted on your site, Akismet webs service catches the comment and tests whether a comment is valued as &#8220;spam&#8221; or &#8220;not spam&#8221;.<span id="more-62"></span><br />
This is a good protection because a lot of bloggers and the WordPress software use Akismet and flag new spam pattern to the Akismet site.</p>
<p>If you have a comment form on your webapp you can protect it with the Akismet-service and some PHP code around. I use it for a python application and it catches a lot of comment spam day for day and as Douglas Adams says &#8220;I may not have gone where I intended to go, but I think I have ended up where I needed to be.&#8221;.</p>
<p>First you need  to generate a WordPress API key on this page. You don&#8217;t need to get a blog, choose the &#8220;just an account&#8221; option when signing up.<br />
<a href="http://wordpress.com/signup/">http://wordpress.com/signup/</a></p>
<p>There are two (and sure more) classes, that make a implementation in your own webapp easy as possible.<br />
Take a look at the docs on both sites:</p>
<p>PHP 4 class by Bret Kuhns:<br />
<a href="http://miphp.net/pages/akismet_docs">http://miphp.net/pages/akismet_docs</a></p>
<p>PHP 5 class by Alex Potsides:<br />
<a href="http://www.achingbrain.net/stuff/akismet/#usage">http://www.achingbrain.net/stuff/akismet/#usage</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/62/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/62/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=62&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2007/12/23/spam-protection-with-akismet/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>
	</item>
		<item>
		<title>.htaccess tips and tricks</title>
		<link>http://phpsecurity.wordpress.com/2007/12/22/htaccess-tips-and-tricks/</link>
		<comments>http://phpsecurity.wordpress.com/2007/12/22/htaccess-tips-and-tricks/#comments</comments>
		<pubDate>Sat, 22 Dec 2007 14:20:02 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[Information]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[.htpasswd]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[auth]]></category>

		<category><![CDATA[htaccess]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/2007/12/22/htaccess-tips-and-tricks/</guid>
		<description><![CDATA[.htaccess (hypertext access) is the default name of Apache&#8217;s directory-level configuration file. .htaccess is placed in a particular directory, and the directives in the .htaccess file apply to that directory, and all subdirectories thereof. 
The most common feature is to restrict access to a folder by force the user to a login prompt, but there [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>.htaccess (hypertext access) is the default name of Apache&#8217;s directory-level configuration file. .htaccess is placed in a particular directory, and the directives in the .htaccess file apply to that directory, and all subdirectories thereof. </p>
<p>The most common feature is to restrict access to a folder by force the user to a login prompt, but there are some other helpful things also that I show you in this posting.</p>
<p><span id="more-54"></span></p>
<p>Allow access only for the IP 127.0.0.1</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:1em 1em 10px;">
order deny,allow<br />
allow from 127.0.0.1<br />
deny from all
</div>
<p>Forbid access to files with extensions .bak, .sql, .inc.</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">&lt;FilesMatch &#8220;\.(bak|sql|inc)$&#8221; &gt;<br />
deny from all<br />
&lt;/FilesMatch&gt;</div>
<p>This line make the “.txt” extension to executable PHP scripts.</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">AddType application/x-httpd-php .txt</div>
<p>Redirceting from web folder &#8220;bla&#8221; to http://phpsecurity.wordpress.com/</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">Redirect /bla http://phpsecurity.wordpress.com/</div>
<p>Rewriting you can use to make better reading URLs. It&#8217;s very handy for SEO and looks much more friendlier than long-cryptic looking URLs for your visitors.<br />
In this example the URL can be http://example.org/de/ or http://example.org/en/ and the Rewrite engine catches the parameters in the brackets and give the value “de” or “en” to the $lang to index.php.</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">RewriteEngine on<br />
RewriteRule ^(de|en)/$ /test/index.php?lang=$1</div>
<p>Last but not least, set a password prompt to any directory you want</p>
<p>on linux you create a .htpasswd file with:</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">htpasswd -c /path_to_folder/.htpasswd username</div>
<p>than you put this lines to your .htaccess:</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:0.5em;">AuthUserFile /path_to_folder/.htpasswd<br />
AuthGroupFile /dev/null<br />
AuthName &#8220;name&#8221;<br />
AuthType Basic<br />
&lt;Limit GET&gt;<br />
require valid-user<br />
&lt;/Limit&gt;
</div>
<p>If you have any problems with .htaccess and you have access to your server, look in the error logs of your apache server. You find them in /var/log/apache2/error.log (depending on system).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/54/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/54/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=54&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2007/12/22/htaccess-tips-and-tricks/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>
	</item>
		<item>
		<title>The null byte to hack includes</title>
		<link>http://phpsecurity.wordpress.com/2007/12/09/the-null-byte-to-hack-includes/</link>
		<comments>http://phpsecurity.wordpress.com/2007/12/09/the-null-byte-to-hack-includes/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 19:43:19 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[Injection]]></category>

		<category><![CDATA[LFI]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[RFI]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[include]]></category>

		<category><![CDATA[inclusion]]></category>

		<category><![CDATA[local file inclusion]]></category>

		<category><![CDATA[null]]></category>

		<category><![CDATA[null byte]]></category>

		<category><![CDATA[remote file inclusion]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/2007/12/09/the-null-byte-to-hack-includes/</guid>
		<description><![CDATA[The null byte (also null terminator) is a character with the value zero, present in the ASCII and Unicode character sets. Strings end if there is a null character.
In PHP this character looks like this %00.
Ok whats the deal with null bytes?
A lot of people think that this method below, to include a file which [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The null byte (also null terminator) is a character with the value zero, present in the ASCII and Unicode character sets. Strings end if there is a null character.<br />
In PHP this character looks like this %00.</p>
<p>Ok whats the deal with null bytes?</p>
<p>A lot of people think that this method below, to include a file which has a fix extension (.php), is a bullet prof one, but that&#8217;s not true.</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:1em 1em 10px;">&lt;?php<br />
    include ($_GET['site'].&#8221;.php&#8221;);<br />
?&gt;
</div>
<p>If you call the script with a null byte in the URL it&#8217;s possible to include any local or remote site!</p>
<p>http://example.com/?site=../../../../etc/passwd%00</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/60/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/60/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=60&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2007/12/09/the-null-byte-to-hack-includes/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>
	</item>
		<item>
		<title>Protect your application against SQL injections part 2</title>
		<link>http://phpsecurity.wordpress.com/2007/12/06/protect-your-application-against-sql-injections-part-2/</link>
		<comments>http://phpsecurity.wordpress.com/2007/12/06/protect-your-application-against-sql-injections-part-2/#comments</comments>
		<pubDate>Thu, 06 Dec 2007 17:23:36 +0000</pubDate>
		<dc:creator>b23</dc:creator>
		
		<category><![CDATA[Injection]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[sql]]></category>

		<category><![CDATA[Database]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[security]]></category>

		<category><![CDATA[sql-injection]]></category>

		<guid isPermaLink="false">http://phpsecurity.wordpress.com/2007/12/06/protect-your-application-against-sql-injections-part-2/</guid>
		<description><![CDATA[In part 1 we made sure that the value is an integer, but what if a value could be a string?
You have to escape special characters in a string for using in a SQL statement. This means that a single quote (&#8217;) get a backslash before (\&#8217;).
There are escape functions for each popular database:

MySQL: mysql_real_escape_string()
PostgreSQL: [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In <a href="http://phpsecurity.wordpress.com/2007/12/05/protect-your-application-against-sql-injections-part-1/">part 1</a> we made sure that the value is an integer, but what if a value could be a string?<br />
You have to escape special characters in a string for using in a SQL statement. This means that a single quote (&#8217;) get a backslash before (\&#8217;).</p>
<p>There are escape functions for each popular database:</p>
<p><span id="more-56"></span></p>
<p>MySQL: mysql_real_escape_string()<br />
PostgreSQL: pg_escape_string()<br />
SQLite: sqlite_escape_string() </p>
<p>You can also use PDO&#8217;s prepared statements support. PDO uses the native prepared statement support for your database.<br />
As you can see in the next example $_GET['name'] would be escaped, before the query touches the database.</p>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:1em 1em 10px;">
&lt;?php<br />
prepare(&#8221;INSERT INTO user (name) VALUES (<strong>?</strong>)&#8221;);<br />
$s-&gt;bindParam(1, $_GET['name']);<br />
$s-&gt;execute();<br />
?&gt;
</div>
<div style="border:1px dashed rgb(140, 172, 187);overflow:auto;background-color:rgb(247, 249, 250);color:rgb(101, 101, 101);font-size:12px;margin-bottom:10px;padding:1em 1em 10px;">
&lt;?php<br />
// Using named parameters<br />
$s = $db-&gt;prepare(&#8221;INSERT INTO user (name) VALUES (<strong>:name</strong>)&#8221;);<br />
$s-&gt;execute(array(&#8217;name&#8217; =&gt; $_GET['name']);<br />
?&gt;
</div>
<p>There are some database abstraction layer (DAL) for PHP, such as AdoDB, PEAR::MDB2, or Zend_Db. Most DAL&#8217;s provide support for prepared statements and quoting like PDO.</p>
<p>It&#8217;s up to you which protection you use, but think about that your database is the heart of your website.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpsecurity.wordpress.com/56/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpsecurity.wordpress.com/56/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpsecurity.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpsecurity.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpsecurity.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpsecurity.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpsecurity.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpsecurity.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpsecurity.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpsecurity.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpsecurity.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpsecurity.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpsecurity.wordpress.com&blog=1858945&post=56&subd=phpsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsecurity.wordpress.com/2007/12/06/protect-your-application-against-sql-injections-part-2/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/b23dev-128.jpg" medium="image">
			<media:title type="html">b23</media:title>
		</media:content>
	</item>
	</channel>
</rss>