<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1024057" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1024057</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147530</link>
    <description> &lt;p&gt;Whenever possible I include files only in the same directory, or secure files in a non-browsable web directory accessed through a path, not a variable.&lt;/p&gt;
&lt;p&gt;i.e. include(&#039;this/is/the/actual/path/to/the/file.php&#039;);&lt;/p&gt;
&lt;p&gt;Where the browser viewable files are somewhere else like &#039;this/is/the/actual/path/to/www/files/&#039;.&lt;/p&gt;
&lt;p&gt;That way the important information isn&#039;t browsable (in case of php failure, errors, et cetera).&lt;/p&gt;
 </description>
     <pubDate>Mon, 15 Mar 2004 03:26:22 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1147530 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147526</link>
    <description> &lt;p&gt;Ah, I didn&#039;t know you were talking about variable includes. I see what you mean now.&lt;/p&gt;
 </description>
     <pubDate>Sun, 14 Mar 2004 22:47:10 +0000</pubDate>
 <dc:creator>Chroder</dc:creator>
 <guid isPermaLink="false">comment 1147526 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147524</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;Chroder wrote:&lt;/strong&gt; &quot;dot dot slash&quot; simply means &quot;up one directory&quot;...&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That&#039;s exactly why.  Because it goes up one directory.  And if you string them back to back (../../../), you can go up more than one directory.&lt;/p&gt;
&lt;p&gt;Say someone uses a form upload script to send a malicious shell script into your /tmp directory.  Then they navigate to a page on your site that uses include($folder/$file);  They may be able to adjust $folder and $file to execute the malicious file.&lt;/p&gt;
&lt;p&gt;And along the same lines of eval(), you must filter anything in system(), shell_exec(), exec(), passthru(), and the backtick operator (``).&lt;/p&gt;
 </description>
     <pubDate>Sun, 14 Mar 2004 22:28:11 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1147524 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147520</link>
    <description> &lt;p&gt;I was wondering that too. &quot;dot dot slash&quot; simply means &quot;up one directory&quot;...&lt;/p&gt;
 </description>
     <pubDate>Sun, 14 Mar 2004 22:13:24 +0000</pubDate>
 <dc:creator>Chroder</dc:creator>
 <guid isPermaLink="false">comment 1147520 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147519</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;Mark Hensler wrote:&lt;/strong&gt; Any variables used in file paths for include() or require() calls should never contain dot dot slash (../ or ..\).&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt; I don&#039;t use this method, but curious as to why include(&#039;../$folder/file.php&#039;) is bad.&lt;/p&gt;
&lt;p&gt;If you have a variable in a include (or require) tag, this could be hijacked sure (reason to not do it) but how does the ../ or ..\ effect it?&lt;/p&gt;
 </description>
     <pubDate>Sun, 14 Mar 2004 22:11:32 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1147519 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147438</link>
    <description> &lt;p&gt;Simply put, filter your data.  Before you use a variable from get/post/cookie/etc, check to make sure there are no invalid (or only valid) characters (im assuming strings).&lt;/p&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;p&gt;Any variables used in file paths for include() or require() calls should never contain dot dot slash (../ or ..\).&lt;/p&gt;
&lt;p&gt;Variables printed to the html source should first be cleansed of any Cross Site Scripting (ex: javascript code).&lt;/p&gt;
&lt;p&gt;Any variables inserted into a database should be escaped (to prevent breaking the sql code).&lt;/p&gt;
&lt;p&gt;Any variables put through an eval() call should be *very* closely scrutinized.&lt;/p&gt;
 </description>
     <pubDate>Sat, 13 Mar 2004 07:09:42 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1147438 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147430</link>
    <description> &lt;p&gt;&lt;a href=&quot;http://www.sitepoint.com/article/write-secure-scripts-php-4-2&quot; class=&quot;bb-url&quot;&gt;http://www.sitepoint.com/article/write-secure-scripts-php-4-2&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 13 Mar 2004 00:28:53 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1147430 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147429</link>
    <description> &lt;p&gt;Thanks Chroder,&lt;/p&gt;
&lt;p&gt;Great stuff.. going to test all these ...very useful&lt;/p&gt;
&lt;p&gt;Thanks guys&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Mar 2004 23:59:38 +0000</pubDate>
 <dc:creator>emma12345</dc:creator>
 <guid isPermaLink="false">comment 1147429 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147428</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;forwardtrends wrote:&lt;/strong&gt; on any login screens .. make sure the user can only type in letters or numbers into the textfields. A simple apostraphe &#039; will break the code string your using and past that you can guess what is possible.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Oh yes that&#039;s very true, I saw this happen in a cgi script..cheers&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Mar 2004 23:52:27 +0000</pubDate>
 <dc:creator>emma12345</dc:creator>
 <guid isPermaLink="false">comment 1147428 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/script-security-help#comment-1147427</link>
    <description> &lt;p&gt;If your working with a database, escape all of the database characters that could cause problems. For example, say you have a user log in accepting a username and password to get access to a special client area:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;User inputs:&lt;br /&gt;User: hax0r&amp;#039; or &amp;#039;&amp;#039;=&amp;#039;&lt;br /&gt;Pass: hax0r&amp;#039; or &amp;#039;&amp;#039;=&amp;#039;&lt;br /&gt;&lt;br /&gt;SQL Query run:&lt;br /&gt;SELECT * FROM users WHERE user=&amp;#039;hax0r&amp;#039; or &amp;#039;&amp;#039;=&amp;#039;&amp;#039; AND pass=&amp;#039;hax0r&amp;#039; or &amp;#039;&amp;#039;=&amp;#039;&amp;#039;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Since &quot;&quot; does indeed equal &quot;&quot; (blank string equals blank string), the query would return with rows and the &quot;hax0r&quot; would have access. A solution to this would be to escape your data you stick into your query. For example, using the addslashes() function for PHP. This would make the query&lt;br /&gt;
[INDENT]SELECT * FROM users WHERE user=&#039;hax0r\&#039; or \&#039;\&#039;=\&#039;&#039; AND pass=&#039;hax0r\&#039; or \&#039;\&#039;=\&#039;&#039;[/INDENT]&lt;br /&gt;
Which would not return any rows.&lt;/p&gt;
&lt;p&gt;Another thing would be to double check where you&#039;re values are coming from.  There are a couple of places that data could come from, amongst them are: sessions, cookies, get, post. So if you have something like this:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$access &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;yes&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// found secret area!!!&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
The user could simply go&lt;br /&gt;
[INDENT]script.php?access=yes[/INDENT]&lt;br /&gt;
So if you make sure your getting the data from where you want to be getting it from, you should be alrignt.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$access &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;no&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// code to check login or whatever&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$access &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;yes&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// found secret area!!!&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
In that example, the access variable is set at the start of the script, so the same exploitation could not be used.&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Mar 2004 23:50:09 +0000</pubDate>
 <dc:creator>Chroder</dc:creator>
 <guid isPermaLink="false">comment 1147427 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
