« Previous Next »

Thread: Use URLRewrite to help protect again certain sql injection attacks.

Last post 10-14-2008 1:14 PM by steve schofield. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 10-10-2008, 3:52 PM

    Use URLRewrite to help protect again certain sql injection attacks.

    Forgive me, I'm not a RegEx guru.  Is it possible to use URLRewrite with regex to 'black hole' a request based on some configured RegEX rules, for example sql injection text?  If the querystring contains CAST(, the rule would block the request?  URLScan 3.0 doesn't allow for RegEx rules.  I'm not certain the order of operations when running both URLRewrite and URLScan together. 

     

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-10-2008, 4:05 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 661

    Re: Use URLRewrite to help protect again certain sql injection attacks.

    Yes, you can use URLRewrite to block requests that contain sql injection text in the URL path or query string. More details on comparizon of URL rewrite and Request Filtering is available here.

    http://ruslany.net
  • 10-10-2008, 5:39 PM In reply to

    Re: Use URLRewrite to help protect again certain sql injection attacks.

    Thanks for the article link. Does urlscan happen after request filter and potentially urlrewrite in the request pipeline?

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-13-2008, 4:44 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 661

    Re: Use URLRewrite to help protect again certain sql injection attacks.

    If URLScan is installed on IIS7 it will run before the request filter and url rewriter. By default the relative order of execution of these three is:

    1. URLScan
    2. Request Filter
    3. URL Rewrite 
    http://ruslany.net
  • 10-14-2008, 12:35 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 661

    Re: Use URLRewrite to help protect again certain sql injection attacks.

    I was corrected by Anil about the order of execution of these modules. By default the relative order of execution is:

    1. URLScan
    2. URLRewrite (executing rules defined in <globalRules> section)
    3. Request Filter
    4. URL Rewrite (executing rules defined in <rules> section)

     

    http://ruslany.net
  • 10-14-2008, 1:14 PM In reply to

    Re: Use URLRewrite to help protect again certain sql injection attacks.

    Thank you Ruslan for posting this info.  It helps from a security perspective when looking at ways to help lockdown and block requests that are sql injection type. 

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
Page 1 of 1 (6 items)
Microsoft Communities