<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Footprints in the snow of a warped mind - Security</title>
    <link>http://blogs.thesitedoctor.co.uk/test/</link>
    <description>newtelligence powered</description>
    <language>en-us</language>
    <copyright>Tim</copyright>
    <lastBuildDate>Tue, 28 Apr 2009 17:49:48 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>timgaunt@gmail.com</managingEditor>
    <webMaster>timgaunt@gmail.com</webMaster>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=cf6f0226-db49-460d-8de9-7ab3075d6e84</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,cf6f0226-db49-460d-8de9-7ab3075d6e84.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,cf6f0226-db49-460d-8de9-7ab3075d6e84.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=cf6f0226-db49-460d-8de9-7ab3075d6e84</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h2>The Error
</h2>
        <p>
For those of you who have tried to rename your Umbraco installation directory to something
other than the default /umbraco/ you'll have found that TreeInit.aspx throws a JavaScript
error along the lines of:
</p>
        <p>
Message: Object expected 
<br />
Line: 1 
<br />
Char: 4236 
<br />
Code: 0 
<br />
URI: http://www.yourdomain.co.uk/youradmindirector/js/xloadtree.js
</p>
        <p>
As this only really affects the refresh of the tree/close of a couple of dialogues
I've not bothered fixing it but basically the issue is outlined well here: <a href="http://tinyurl.com/cx9atv">http://tinyurl.com/cx9atv</a></p>
        <h2>The Fix
</h2>
        <p>
If you're using extension less URLs already then it's easy as pie to sort:
</p>
        <ol>
          <li>
Open your UrlRewriting config file (/config/UrlRewriting.config) 
</li>
          <li>
Add this above "&lt;/rewrites&gt;": 
</li>
        </ol>
        <div class="code">
          <div style="display: none">
            <img onclick="showHideCodeDiv('633765388075525066_1', false)" align="top" src="http://blogs.sitedoc.co.uk/img/sc/PlusNoLines.gif" />
            <b>
              <span style="color: #00008b">&lt;...&gt;</span>
            </b>
          </div>
          <div style="display: block" id="open633765388075525066_1">
            <img onclick="showHideCodeDiv('633765388075525066_1', true)" align="top" src="http://blogs.sitedoc.co.uk/img/sc/minusNoTopLine.gif" />
            <span style="color: #0000ff">&lt;</span>
            <span style="color: #8b0000">add</span>
            <span style="color: #ff0000"> name</span>
            <span style="color: #8b0000">=</span>
            <span style="color: #0000ff">"missingjs"</span>  
<br /><img align="top" src="http://blogs.sitedoc.co.uk/img/sc/I.gif" /><span style="color: #ff0000">   
virtualUrl</span><span style="color: #8b0000">=</span><span style="color: #0000ff">"^~/##
YOUR ADMIN DIRECTORY GOES HERE ##_client/ui/(.*).js"</span>  
<br /><img align="top" src="http://blogs.sitedoc.co.uk/img/sc/I.gif" /><span style="color: #ff0000">   
rewriteUrlParameter</span><span style="color: #8b0000">=</span><span style="color: #0000ff">"ExcludeFromClientQueryString"</span>  
<br /><img align="top" src="http://blogs.sitedoc.co.uk/img/sc/I.gif" /><span style="color: #ff0000">   
destinationUrl</span><span style="color: #8b0000">=</span><span style="color: #0000ff">"~/umbraco_client/ui/$1.js"</span>  
<br /><img align="top" src="http://blogs.sitedoc.co.uk/img/sc/L.gif" /><span style="color: #ff0000">   
ignoreCase</span><span style="color: #8b0000">=</span><span style="color: #0000ff">"true"</span> <span style="color: #8b0000">/</span><span style="color: #0000ff">&gt;</span></div>
        </div>
        <p>
If you've not already using extension less URLs don't panic, that's easy to setup
you can <a href="http://www.urlrewriting.net/160/en/documentation.html">read all about
it here</a>. Alternatively you could just copy the js files from one folder to another
;)
</p>
        <h2>The Why
</h2>
        <p>
I don't know how many people already rename their admin dir from something else but
as Umbraco becomes a more popular choice of 
<abbr title="Content Management System">
CMS
</abbr>
you really should consider hiding the folder (the more popular it becomes, the more
people will become more familiar with the default admin directory of /umbraco/).
</p>
        <p>
Although there hasn't yet been a breach (<abbr title="As Far As I Am Aware">
AFAIAA
</abbr>
) if a vulnerability is found, the first step in prevention is obfuscation -hide your
admin directory! A <a href="http://www.google.co.uk/search?q=username+login+inurl%3Aadmin.asp">quick
Google search</a> will show you how easy some developers have made it for you to <a href="http://www.google.co.uk/search?q=username+login+inurl%3Aadmin.asp">find
their admin sites</a>.
</p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=cf6f0226-db49-460d-8de9-7ab3075d6e84" />
      </body>
      <title>Fix missing JavaScript file when you rename the Umbraco admin directory</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,cf6f0226-db49-460d-8de9-7ab3075d6e84.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2009/04/28/FixMissingJavaScriptFileWhenYouRenameTheUmbracoAdminDirectory.aspx</link>
      <pubDate>Tue, 28 Apr 2009 17:49:48 GMT</pubDate>
      <description>&lt;h2&gt;The Error
&lt;/h2&gt;
&lt;p&gt;
For those of you who have tried to rename your Umbraco installation directory to something
other than the default /umbraco/ you'll have found that TreeInit.aspx throws a JavaScript
error along the lines of:
&lt;/p&gt;
&lt;p&gt;
Message: Object expected 
&lt;br /&gt;
Line: 1 
&lt;br /&gt;
Char: 4236 
&lt;br /&gt;
Code: 0 
&lt;br /&gt;
URI: http://www.yourdomain.co.uk/youradmindirector/js/xloadtree.js
&lt;/p&gt;
&lt;p&gt;
As this only really affects the refresh of the tree/close of a couple of dialogues
I've not bothered fixing it but basically the issue is outlined well here: &lt;a href="http://tinyurl.com/cx9atv"&gt;http://tinyurl.com/cx9atv&lt;/a&gt; 
&lt;/p&gt;
&lt;h2&gt;The Fix
&lt;/h2&gt;
&lt;p&gt;
If you're using extension less URLs already then it's easy as pie to sort:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Open your UrlRewriting config file (/config/UrlRewriting.config) 
&lt;/li&gt;
&lt;li&gt;
Add this above &amp;quot;&amp;lt;/rewrites&amp;gt;&amp;quot;: 
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="code"&gt;
&lt;div style="display: none"&gt;&lt;img onclick="showHideCodeDiv(&amp;#39;633765388075525066_1&amp;#39;, false)" align="top" src="http://blogs.sitedoc.co.uk/img/sc/PlusNoLines.gif" /&gt;&lt;b&gt;&lt;span style="color: #00008b"&gt;&amp;lt;...&amp;gt;&lt;/span&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div style="display: block" id="open633765388075525066_1"&gt;&lt;img onclick="showHideCodeDiv(&amp;#39;633765388075525066_1&amp;#39;, true)" align="top" src="http://blogs.sitedoc.co.uk/img/sc/minusNoTopLine.gif" /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #8b0000"&gt;add&lt;/span&gt;&lt;span style="color: #ff0000"&gt; name&lt;/span&gt;&lt;span style="color: #8b0000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot;missingjs&amp;quot;&lt;/span&gt;&amp;#160; 
&lt;br /&gt;
&lt;img align="top" src="http://blogs.sitedoc.co.uk/img/sc/I.gif" /&gt;&lt;span style="color: #ff0000"&gt;&amp;#160;&amp;#160;&amp;#160;
virtualUrl&lt;/span&gt;&lt;span style="color: #8b0000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot;^~/##
YOUR ADMIN DIRECTORY GOES HERE ##_client/ui/(.*).js&amp;quot;&lt;/span&gt;&amp;#160; 
&lt;br /&gt;
&lt;img align="top" src="http://blogs.sitedoc.co.uk/img/sc/I.gif" /&gt;&lt;span style="color: #ff0000"&gt;&amp;#160;&amp;#160;&amp;#160;
rewriteUrlParameter&lt;/span&gt;&lt;span style="color: #8b0000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot;ExcludeFromClientQueryString&amp;quot;&lt;/span&gt;&amp;#160; 
&lt;br /&gt;
&lt;img align="top" src="http://blogs.sitedoc.co.uk/img/sc/I.gif" /&gt;&lt;span style="color: #ff0000"&gt;&amp;#160;&amp;#160;&amp;#160;
destinationUrl&lt;/span&gt;&lt;span style="color: #8b0000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot;~/umbraco_client/ui/$1.js&amp;quot;&lt;/span&gt;&amp;#160; 
&lt;br /&gt;
&lt;img align="top" src="http://blogs.sitedoc.co.uk/img/sc/L.gif" /&gt;&lt;span style="color: #ff0000"&gt;&amp;#160;&amp;#160;&amp;#160;
ignoreCase&lt;/span&gt;&lt;span style="color: #8b0000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&amp;#160;&lt;span style="color: #8b0000"&gt;/&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
If you've not already using extension less URLs don't panic, that's easy to setup
you can &lt;a href="http://www.urlrewriting.net/160/en/documentation.html"&gt;read all about
it here&lt;/a&gt;. Alternatively you could just copy the js files from one folder to another
;)
&lt;/p&gt;
&lt;h2&gt;The Why
&lt;/h2&gt;
&lt;p&gt;
I don't know how many people already rename their admin dir from something else but
as Umbraco becomes a more popular choice of 
&lt;abbr title="Content Management System"&gt;
CMS
&lt;/abbr&gt;
you really should consider hiding the folder (the more popular it becomes, the more
people will become more familiar with the default admin directory of /umbraco/).
&lt;/p&gt;
&lt;p&gt;
Although there hasn't yet been a breach (&lt;abbr title="As Far As I Am Aware"&gt;
AFAIAA
&lt;/abbr&gt;
) if a vulnerability is found, the first step in prevention is obfuscation -hide your
admin directory! A &lt;a href="http://www.google.co.uk/search?q=username+login+inurl%3Aadmin.asp"&gt;quick
Google search&lt;/a&gt; will show you how easy some developers have made it for you to &lt;a href="http://www.google.co.uk/search?q=username+login+inurl%3Aadmin.asp"&gt;find
their admin sites&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=cf6f0226-db49-460d-8de9-7ab3075d6e84" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,cf6f0226-db49-460d-8de9-7ab3075d6e84.aspx</comments>
      <category>ASP.Net</category>
      <category>Security</category>
      <category>The Site Doctor</category>
      <category>Umbraco</category>
      <category>Web Development</category>
    </item>
    <item>
      <trackback:ping>http://blogs.thesitedoctor.co.uk/test/Trackback.aspx?guid=4b25e0a2-9f4e-4abf-abd2-621a7a1d848f</trackback:ping>
      <pingback:server>http://blogs.thesitedoctor.co.uk/test/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,4b25e0a2-9f4e-4abf-abd2-621a7a1d848f.aspx</pingback:target>
      <dc:creator>Tim</dc:creator>
      <wfw:comment>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,4b25e0a2-9f4e-4abf-abd2-621a7a1d848f.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.thesitedoctor.co.uk/test/SyndicationService.asmx/GetEntryCommentsRss?guid=4b25e0a2-9f4e-4abf-abd2-621a7a1d848f</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.27seconds.com/">Doug Setzer</a> posted this comment in response
to my recent "<a href="http://blogs.thesitedoctor.co.uk/tim/2008/05/28/A+Seriously+Elegant+SQL+Injection.aspx">A
seriously elegant SQL Injection</a>" post and I thought it may be of interest to others
so have promoted it to a post...
</p>
        <hr />
        <p>
Well, I'll step up and say that I am the "mate" who had this done.  Tim's right
- *always* sanitize your inputs.  In my defence, this was a site that I inherited
from a previous contractor.  I'm not entirely absent of blame, I still should
have done a security sweep through the code.
</p>
        <p>
I'd like to document the steps that I went through once this was identified to try
and avoid this kind of thing in the future.
</p>
        <ol>
          <li>
Edit every web page that executes a query to sanitize any parameters that are passed
in.  Since the site was classic ASP, I used my "SQLStringFieldValue" function:<br /><a href="http://www.27seconds.com/kb/article_view.aspx?id=50">www.27seconds.com/kb/article_view.aspx?id=50</a></li>
          <li>
Modify the DB user account that is used to have *read only* access to the database 
</li>
          <li>
Modify the pages that DO write to the database to have *read/write* access to the
specific tables that are being changed.  This limits the number of places that
SQL Injection can occur to a smaller set than was previously possible.  I still
sanitize all of my input, but I'm extra spastic in these database calls. 
</li>
          <li>
Add database auditing (triggers writing to mirror tables with audit event indicator
&amp; date/time) to see when data changes occur.  This is still problematic with
the pages that have "write" permissions to the tables, but again- that footprint is
much smaller.</li>
        </ol>
        <ol>
My future plans are to move to a view/stored procedure based architecture.  I
can then limit write permissions to just the stored procedures and read permissions
to just the views.  My grand gusto plans are to move to using command objects
&amp; parameters, but I'd sooner re-write the entire site.
</ol>
        <hr />
        <p>
Although Doug's attack wasn't the same nihaorr1.com attack that's going around atm
it was similar so I would imagine other's will find this useful.
</p>
        <p>
It still amazes me how many developers still fail to sanitise strings, only last week
I came across another site (in PHP) that was allowing simple SQL injections to be
used to log into their administration system. It was down to a problem with the sanitization
string, but why not at least check your site before it goes live? It takes 2 minutes
and even less to fix...
</p>
        <p>
For those of you who need a few pointers, there's a good discussion or two about <a href="http://www.aspmessageboard.com/forum/asp.asp?M=896001&amp;T=896001&amp;F=20&amp;P=1#896004">sanitising
strings on the 4 Guys From Rolla site</a>.
</p>
        <img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=4b25e0a2-9f4e-4abf-abd2-621a7a1d848f" />
      </body>
      <title>A seriously elegant SQL Injection -how it was sorted</title>
      <guid isPermaLink="false">http://blogs.thesitedoctor.co.uk/test/PermaLink,guid,4b25e0a2-9f4e-4abf-abd2-621a7a1d848f.aspx</guid>
      <link>http://blogs.thesitedoctor.co.uk/test/2008/05/29/ASeriouslyElegantSQLInjectionHowItWasSorted.aspx</link>
      <pubDate>Thu, 29 May 2008 14:32:33 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.27seconds.com/"&gt;Doug Setzer&lt;/a&gt; posted this comment in response
to my recent "&lt;a href="http://blogs.thesitedoctor.co.uk/tim/2008/05/28/A+Seriously+Elegant+SQL+Injection.aspx"&gt;A
seriously elegant SQL Injection&lt;/a&gt;" post and I thought it may be of interest to others
so have promoted it to a post...
&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;
Well, I'll step up and say that I am the "mate" who had this done.&amp;nbsp; Tim's right
- *always* sanitize your inputs.&amp;nbsp; In my defence, this was a site that I inherited
from a previous contractor.&amp;nbsp; I'm not entirely absent of blame, I still should
have done a security sweep through the code.
&lt;/p&gt;
&lt;p&gt;
I'd like to document the steps that I went through once this was identified to try
and avoid this kind of thing in the future.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Edit every web page that executes a query to sanitize any parameters that are passed
in.&amp;nbsp; Since the site was classic ASP, I used my "SQLStringFieldValue" function:&lt;br&gt;
&lt;a href="http://www.27seconds.com/kb/article_view.aspx?id=50"&gt;www.27seconds.com/kb/article_view.aspx?id=50&lt;/a&gt; 
&lt;li&gt;
Modify the DB user account that is used to have *read only* access to the database 
&lt;li&gt;
Modify the pages that DO write to the database to have *read/write* access to the
specific tables that are being changed.&amp;nbsp; This limits the number of places that
SQL Injection can occur to a smaller set than was previously possible.&amp;nbsp; I still
sanitize all of my input, but I'm extra spastic in these database calls. 
&lt;li&gt;
Add database auditing (triggers writing to mirror tables with audit event indicator
&amp;amp; date/time) to see when data changes occur.&amp;nbsp; This is still problematic with
the pages that have "write" permissions to the tables, but again- that footprint is
much smaller.&lt;/li&gt;
&lt;/ol&gt;
&lt;ol&gt;
My future plans are to move to a view/stored procedure based architecture.&amp;nbsp; I
can then limit write permissions to just the stored procedures and read permissions
to just the views.&amp;nbsp; My grand gusto plans are to move to using command objects
&amp;amp; parameters, but I'd sooner re-write the entire site.
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;
Although Doug's attack wasn't the same nihaorr1.com attack that's going around atm
it was similar so I would imagine other's will find this useful.
&lt;/p&gt;
&lt;p&gt;
It still amazes me how many developers still fail to sanitise strings, only last week
I came across another site (in PHP) that was allowing simple SQL injections to be
used to log into their administration system. It was down to a problem with the sanitization
string, but why not at least check your site before it goes live? It takes 2 minutes
and even less to fix...
&lt;/p&gt;
&lt;p&gt;
For those of you who need a few pointers, there's a good discussion or two about &lt;a href="http://www.aspmessageboard.com/forum/asp.asp?M=896001&amp;amp;T=896001&amp;amp;F=20&amp;amp;P=1#896004"&gt;sanitising
strings on the 4 Guys From Rolla site&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.thesitedoctor.co.uk/test/aggbug.ashx?id=4b25e0a2-9f4e-4abf-abd2-621a7a1d848f" /&gt;</description>
      <comments>http://blogs.thesitedoctor.co.uk/test/CommentView,guid,4b25e0a2-9f4e-4abf-abd2-621a7a1d848f.aspx</comments>
      <category>ASP</category>
      <category>ASP.Net</category>
      <category>C#</category>
      <category>Development</category>
      <category>IIS</category>
      <category>Security</category>
      <category>SQL Server</category>
      <category>Web Development</category>
    </item>
  </channel>
</rss>