• Clarity on Microsoft Security Advisory 2416728 and WSS 3.0 / MOSS 2007

    UPDATE 8:39P 9/21/2010 - Looks like the SharePoint Team blog post has been updated with new information. While you could do the steps below for WSS 3.0/MOSS 2007, they are not needed. Only SharePoint 2010 and WSS 2.0 are affected.

    There have been some questions on whether or not WSS 3.0 and MOSS 2007 are affected by the Microsoft Security Advisory 2416728. Since the reported vulnerability deals with .Net Framework, specifically ASP.NET and error pages WSS 3.0 and MOSS 2007 may be affected (see above for update).

    The SharePoint Team blog has some workaround steps for SharePoint 2010 that help to mitigate the attack. So what are the steps for WSS/MOSS? If you read the advisory, it becomes clear that there are 2 things that are needed for the workaround.

    1. You need to create a custom error page, this can be named anything, but error2.aspx is easy enough. You need to copy the code provided in the advisory into this page and you need to copy this file to the web application. For SharePoint you will want to copy the file to the _layouts directory and not inside of a SharePoint site.
    2. You need to update the web.config to point to the new error page. This step will change per the version of .Net installed on the computer hosting the web application.

    So what are the steps? Well, they are almost identical to the SharePoint 2010, with 2 minor differences.

    1. Browse to the SharePoint installation directory at %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\template\layouts.
    2. Create a new file called error2.aspx in this directory with the following content:
      <%@ Page Language="C#" AutoEventWireup="true" %>
      <%@ Import Namespace="System.Security.Cryptography" %>
      <%@ Import Namespace="System.Threading" %>
      
      <script runat="server">
         void Page_Load() {
            byte[] delay = new byte[1];
            RandomNumberGenerator prng = new RNGCryptoServiceProvider();
      
            prng.GetBytes(delay);
            Thread.Sleep((int)delay[0]);
              
            IDisposable disposable = prng as IDisposable;
            if (disposable != null) { disposable.Dispose(); }
          }
      </script>
      
      <html>
      <head runat="server">
          <title>Error</title>
      </head>
      <body>
          <div>
              An error occurred while processing your request.
          </div>
      </body>
      </html>
    3. Navigate to %SystemDrive%\inetpub\wwwroot\wss\virtualdirectories.
    4. For each subfolder in this directory, do the following:
      1. Edit web.config
    5. Find the customErrors node and if the .Net Framework 3.5 SP1 is installed, change it to; 

      <customErrors mode="On" redirectMode="ResponseRewrite"
      defaultRedirect="/_layouts/error2.aspx" />

    If .Net Framework 3.5 or less is installed change the line to;

    <customErrors mode="On" defaultRedirect="/_layouts/error2.aspx" />

    1. Save your changes
    2. Run iisreset /noforce

     

    The reason that the web.config customErrors line is different for computers with .Net 3.5 or below is that the redirectMode property was not available before .Net 3.5 SP1.

  • Tip 39: Set Visual Upgrade Back to Previous Version Part Deux

    This tip is for SharePoint Foundation 2010, SharePoint Server 2010 and Search Server 2010 Express.

    So you have your heart set on the WSS 3.0/MOSS 2007 look; I know, how could you not just looooove it? But have just installed a fresh new SharePoint 2010 farm. Or, you have visual upgraded your sites after an upgrade from WSS 3.0/MOSS 2007 to SharePoint 2010 and want that 2007 look and feel. So how can you go back?

    pubwebv3

    As it turns out, it’s easy with the power of PowerShell. The scriptlets below will show you how you can switch from version to version for every site in a site collection and to switch a single site.

    To change the look and feel for every site in a site collection to WSS 3.0/MOSS 2007, use the following example code:

    $SiteCollection=Get-SPsite http://SiteCollection
    foreach($SPWeb in $SiteCollection.AllWebs){$SPWeb.UIversion=3;$SPWeb.update();}

    To change the look and feel for every site in a site collection to SharePoint 2010, use the following example code:

    $SiteCollection=Get-SPsite http://SiteCollection
    foreach($SPWeb in $SiteCollection.AllWebs){$SPWeb.UIversion=4;$SPWeb.update();}

    To change the look and feel for 1 site in a site collection to WSS 3.0/MOSS 2007, use the following example code:

    $SPWeb=Get-SPWeb http://Site

    $SPWeb.UIversion=3;$SPWeb.Update();

    To change the look and feel for 1 site in a site collection to SharePoint 2010, use the following example code:

    $SPWeb=Get-SPWeb http://Site

    $SPWeb.UIversion=4;$SPWeb.Update();

     

    So now you can go back and forth all day basking in your new found Visual Upgrade power! Next, SharePoint 2010 with laser beams!