Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How secure is basic forms authentication in asp.net?

Imagine that you have a simple site with only 2 pages: login.aspx and secret.aspx. Your site is secured using nothing but ASP.net forms authentication and an ASP.net Login server control on login.aspx. The details are as follows:

  • The site is configured to use the SqlMembershipProvider
  • The site denies all anonymous users
  • Cookies are disabled

The are obviously many things to consider regarding security but I am more interested in the zero code out of box experience that comes with the .net framework.

If, for the sake of this question, the only attack points are the username/password textboxes in login.aspx, can a hacker inject code that will allow them to gain access to our secret.aspx page?

How secure is the zero code out-of-box experience that Microsoft provides?

like image 910
NakedBrunch Avatar asked Sep 25 '08 12:09

NakedBrunch


People also ask

Is form authentication secure?

Examples of login and error pages are shown in Creating the Login Form and the Error Page. Form-based authentication is not particularly secure. In form-based authentication, the content of the user dialog box is sent as plain text, and the target server is not authenticated.

What protection is required for form authentication in .NET security?

By default, forms authentication protects only ASPX pages and any other . NET extensions. You can configure forms authentication to protect other static extensions such as .

Is ASP.NET secure?

ASP.NET provides that application-level security. It works in conjunction with IIS and the Windows security subsystem to provide a solid foundation for building secure sites.


3 Answers

You still have some variables that aren't accounted for:

  • Security into the data store used by your membership provider (in this case, the Sql Server database).
  • security of other sites hosted in the same IIS
  • general network security of the machines involved in hosting the site, or on the same network where the site is hosted
  • physical security of the machines hosting the site
  • Are you using appropriate measures to encrypt authentication traffic? (HTTPS/SSL)

Not all of those issues are MS specific, but they're worth mentioning because any of them could easily outweigh the issue you're asking about, if not taken care of. But, for the purpose of your question I'll assume there aren't any problems with them.

In that case, I'm pretty sure the forms authentication does what it's supposed to do. I don't think there's any currently active exploit out there.

like image 121
Joel Coehoorn Avatar answered Oct 07 '22 20:10

Joel Coehoorn


As far as I know password will be sent as plain text (but encoded). So the most important thing to do is to use HTTPS protocol on login screens.

The other setting seems to be secure for me.

like image 43
artur02 Avatar answered Oct 07 '22 20:10

artur02


With HTTP Basic Authentication, which is what the .NET basic forms authentication is using, in order to view the secret.aspx page, the browser must send a Base64 encoded concatenation of the username and password.

Unless you utilize SSL, anyone who has access to scan the network between the server and the browser can read this information. They can decode the username and password. They can replay the username and password in the future to gain access to the secret.aspx page.

That said, unless you use SSL, someone can also scan the whole session of someone else using secret.aspx, so in effect, they would have access to the content of the page as well.

like image 3
Dan Avatar answered Oct 07 '22 20:10

Dan