Spot the Authorization Bug

The following is an excerpt from PAG’s “How To: Use Role Manager in ASP.NET 2.0”.

You can control access to pages or folders to members of one of the built-in Windows groups by specifying the role in the format BUILTIN\groupName. The following example allows users in the built-in administrators group to view pages in the folder named memberPages and denies access to anyone else.


  
      
           
              
              
           
         
       
  

The problem is, the default authorization rule is: 

  

The ASP.NET module responsible for authorization checks iterates through rules starting with the local web.config file, and ending with the “allow all users” default rule. As soon as the module finds a rule matching the current user, it stops evaluating rules.

The PAG example is only denying access to anonymous users. If a user is authenticated, but not in the Administrator role, they'll still get access by falling through to the allow users="*" rule.

To really keep out non-Administrators, you want to use:

 

 

posted on Sunday, November 27, 2005 4:31 PM by scott

Comments

Sunday, November 27, 2005 7:09 PM by Christopher Steen

# Link Listing - November 27, 2005

Announcing Regex Kit: Regular Expression Visualizers for VS
2005 [Via: Roy
Osherove ]
ASP.NET Popup...
Thursday, December 22, 2005 10:59 AM by -:[web caboodle]:-

# Spot the Authorization Bug