<?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/"
		>
<channel>
	<title>Comments on: Protect Against Shell Script Hacks</title>
	<atom:link href="http://life-of-brian.com/2008/01/protect-against-shell-script-hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://life-of-brian.com/2008/01/protect-against-shell-script-hacks/</link>
	<description>My name is Brian.  Welcome to my life.</description>
	<lastBuildDate>Wed, 01 Feb 2012 02:12:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Brian</title>
		<link>http://life-of-brian.com/2008/01/protect-against-shell-script-hacks/comment-page-1/#comment-602</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Wed, 21 Jan 2009 01:28:52 +0000</pubDate>
		<guid isPermaLink="false">http://life-of-brian.com/?p=557#comment-602</guid>
		<description>@Amr,

Unless your server has some strange settings, that shouldn&#039;t pose a problem. The server won&#039;t execute a file with a .gif extension, even if it has .php in there somewhere. It&#039;ll attempt to load it like a picture. Since the file format won&#039;t be valid, it won&#039;t actually display anything (except maybe a broken image icon).

If you wanted to stop an upload script from the allowing the file (since it would be dangerous if the infiltrator could rename the script somehow once it had been uploaded), you&#039;d need to edit the upload script&#039;s validation code. It probably checks for the last three characters in the filename and assumes that is the file extension. 

Instead, you could change this to a regex check for anything that includes &quot;.php.&quot; You could also explode the filename on &quot;.&quot; and check each part to see if it is equal to &quot;php.&quot; In the example you provided, the explosion would result in &quot;xxxxx,&quot; &quot;php,&quot; and &quot;gif.&quot; It&#039;d be easy for your script to tell that there&#039;s a .php extension in there somewhere.</description>
		<content:encoded><![CDATA[<p>@Amr,</p>
<p>Unless your server has some strange settings, that shouldn&#8217;t pose a problem. The server won&#8217;t execute a file with a .gif extension, even if it has .php in there somewhere. It&#8217;ll attempt to load it like a picture. Since the file format won&#8217;t be valid, it won&#8217;t actually display anything (except maybe a broken image icon).</p>
<p>If you wanted to stop an upload script from the allowing the file (since it would be dangerous if the infiltrator could rename the script somehow once it had been uploaded), you&#8217;d need to edit the upload script&#8217;s validation code. It probably checks for the last three characters in the filename and assumes that is the file extension. </p>
<p>Instead, you could change this to a regex check for anything that includes &#8220;.php.&#8221; You could also explode the filename on &#8220;.&#8221; and check each part to see if it is equal to &#8220;php.&#8221; In the example you provided, the explosion would result in &#8220;xxxxx,&#8221; &#8220;php,&#8221; and &#8220;gif.&#8221; It&#8217;d be easy for your script to tell that there&#8217;s a .php extension in there somewhere.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amr Abdallah M.</title>
		<link>http://life-of-brian.com/2008/01/protect-against-shell-script-hacks/comment-page-1/#comment-594</link>
		<dc:creator>Amr Abdallah M.</dc:creator>
		<pubDate>Tue, 20 Jan 2009 09:35:39 +0000</pubDate>
		<guid isPermaLink="false">http://life-of-brian.com/?p=557#comment-594</guid>
		<description>Dear Brian i really found what you wrote the closest to what i am looking for but here is the issue, i found some shell scripts that masked as gif and jpeg files and they are in fact a php shell script, here an example for the format i cought
xxxxx.php.gif something in that format the site will see as a picture file but its in fact a script what can i do about it</description>
		<content:encoded><![CDATA[<p>Dear Brian i really found what you wrote the closest to what i am looking for but here is the issue, i found some shell scripts that masked as gif and jpeg files and they are in fact a php shell script, here an example for the format i cought<br />
xxxxx.php.gif something in that format the site will see as a picture file but its in fact a script what can i do about it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cocaman</title>
		<link>http://life-of-brian.com/2008/01/protect-against-shell-script-hacks/comment-page-1/#comment-122</link>
		<dc:creator>cocaman</dc:creator>
		<pubDate>Sun, 30 Nov 2008 04:21:40 +0000</pubDate>
		<guid isPermaLink="false">http://life-of-brian.com/?p=557#comment-122</guid>
		<description>yep, you are right. the tool/script is very powerful and worked on many servers.

i thought about the disallowing of uploading php-files, but i have decided to just not allow to php files to be executed in the upload directory and any other directories php files should not run. hope this helps</description>
		<content:encoded><![CDATA[<p>yep, you are right. the tool/script is very powerful and worked on many servers.</p>
<p>i thought about the disallowing of uploading php-files, but i have decided to just not allow to php files to be executed in the upload directory and any other directories php files should not run. hope this helps</p>
]]></content:encoded>
	</item>
</channel>
</rss>

