Hey everyone,
I'm using ASP.NET and rely on the web.config
file to secure sections of my site. However, is this truly reliable, or is it also a good idea to add an IsAuthenticated
check in the Page_Load
event? Also, is it possible for someone to directly call methods (assuming they somehow got my method names and method signature) in my application's DLL? For example, I have a method to add users to a specific group. Can an attacker somehow call that method through their own custom POST and execute it?
Thanks
views:
66answers:
1
+2
A:
If you are concerned about specific methods being executed without permission, I'd use code attribute security or your own roles check system to secure the method regardless of who's calling it. I could imagine scenarios where even friendly developers call methods accidentally without making sure the code path has the right to perform privileged functions.
ddc0660
2010-01-15 19:38:48
Thanks for the reply. I'll look into Code Attribute Security. I assume this is different from Code Access Security? From a practical point of view, is it possible for external users to find my methods and call them? Also, should I be authenticating users on every page as well as web.config? Or is this an unnecessary performance hit?
Skoder
2010-01-15 20:41:41
Actually, I did mean Code Attribute Security. I've never used it before personally, but I thought it could be leveraged to secure methods individually. ... I don't know the answer to your question about external users finding methods, but I suspect we would all be aware of that weakness if .Net really exposed things that way. If this was a web service, I could tell you certainly that external users could call those methods. ... I generally do check for authentication on every page load, but I'd imagine there are some situations where it doesn't merit it. I think that's situational.
ddc0660
2010-01-15 20:47:13
Thanks for the help. I'm not using/providing a web service, just a normal web app. So maybe the Code Attribute Security isn't required, but I'll take a look at it.
Skoder
2010-01-15 22:17:39