Home > Ask the Software Quality Experts > Application Security Questions & Answers > How to create a secure login page using ASP.NET
Ask The Software Quality Expert: Questions & Answers
EMAIL THIS

How to create a secure login page using ASP.NET

Dan Cornell EXPERT RESPONSE FROM: Dan Cornell

Pose a Question
Other Software Quality Categories
Meet all Software Quality Experts
Become an Expert for this site


Software quality news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 01 May 2006
What security precautions should we take when creating a login page?

>
EXPERT RESPONSE
First and foremost, in ASP.NET it is important to use the built-in Forms Authentication rather than rolling your own authentication framework. This gives you plenty of flexibility in constructing your login routines and you can still rely on the sophisticated authorization features provided by the ASP.NET framework.

Also, if you are using ASP.NET 2.0, Forms Authentication has been greatly enhanced by providing a number of ready-made user controls for user logins, password recovery and new user creation. Pre-existing user databases and login routines have been created for Microsoft Access and Microsoft SQL Server, and other user data sources can be created by implementing your own Membership and Role Providers. Relying on these built-in framework capabilities reduces the amount of code that has to be written, decreases implementation time, and helps reduce the number of security flaws in your applications.

Next, be sure to run your login routines over HTTPS. This prevents malicious attackers from observing or modifying login traffic that would reveal sensitive username and password information.

When designing an authentication scheme, you also want to make sure you are requiring the right credentials. The standard username/password authentication scheme has its flaws, but it is probably not going away any time soon. However, you should be careful not to use semi-public information such as Social Security numbers or driver license numbers for usernames. These are too easy to guess or steal and can lead to brute force attacks. You should also require some form of strong passwords. Preferably, passwords will be of arbitrary length and require alphabetic, numeric and special characters. This makes them difficult to guess. Although, if you allow special characters, take care that these characters don't open your application up to injection attacks.

If you have to implement your own username and password verification routines (for example if you are using ASP.NET 1.1 or if you are creating custom Providers in ASP.NET 2.0), be sure to follow standard secure coding practices. All user input should be assumed to be evil and not to be trusted. You should have set policies for what characters are acceptable for usernames and passwords and user-supplied credentials should be positively validated to match these patterns rather than just being checked for known "bad" characters. Watch for potential injection attacks against data stores such as databases or LDAP directories -- use stored procedures or parameterized queries.

Given the authentication and authorization capabilities built in to the ASP.NET platform, it is easier than ever to create secure login pages. By following some simple guidelines you should be able to reduce your attack surface and increase the security of your application.

More information
Forms authentication differences in ASP.NET 2.0
Learning Guide: Developing secure .NET applications
OWASP guide to building secure Web applications and Web services: Authentication


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Application Security
PCI DSS compliance: WAF, code review or both?
Application security careers have bright future
How to prevent anti-DNS pinning attacks
Open source application security testing tools
Java application security features and measures
Web application security testing basics
Password recovery with .NET 2.O using C#
Free load and performance testing tools
The most effective time to do security testing
Finding backdoor threats within applications

Building security into the SDLC (Software development life cycle)
Web application security and the PCI DSS
PCI DSS compliance: Web application firewalls (WAFs)
PCI DSS compliance: The basics
PCI DSS compliance: Code review
PCI DSS compliance: WAF, code review or both?
Application security careers have bright future
Writing software requirements that address security issues
Software Security Engineering: A Guide for Project Managers -- Chapter 3, Requirements Engineering for Secure Software
PCI DSS compliance: Web application firewall or code review?
Application security enters uncharted regions

Software testing tools and frameworks
Functional testing of Web services
On-demand software testing service pays off for three startups
Software testing in a virtual environment
Dynamic analysis tool from Coverity looks at concurrency defects
BMC tool helps resolve problems in Java and .NET applications
Automated functional testing boosts productivity at Arizona Federal
Brief: Sigma testing tool integrates with VMware virtual lab
Borland renews Silk test suite with RIA test scripting capability
Zephyr facilitates test management
iTKO integrates testing suite with performance monitoring tool

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
JUnit  (SearchSoftwareQuality.com)
NUnit  (SearchSoftwareQuality.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2006 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts