No formal product support is available from Microsoft for this Beta product. For information about how to obtain support for a Beta release, see the documentation that is included with the Beta product files, or check the Web location where you downloaded the release.
- Help protect the application by using SSL
Configure the Web application in Microsoft Internet Information Services (IIS) so that SSL is required. If you do this, you make sure that the forms authentication feature will never issue a cookie over a non-SSL connection.
- Enforce TTL and absolute expiration
If you use a short TTL, you can help reduce the chances of such an attack. You should also use absolute expiration instead of sliding expiration.
- Use HttpOnly cookies and forms authentication in ASP.NET 2.0
In ASP.NET 2.0, forms authentication cookies are HttpOnly cookies. HttpOnly cookies cannot be accessed through client script. This functionality helps reduce the chances of replay attacks.
- Use the Membership class in ASP.NET 2.0
In ASP.NET 2.0, you can help protect forms authentication cookies from being used maliciously by storing user information in the MembershipUser object.
Note Although a cookie also has expiration, forms authentication always uses the expiration time that is contained inside the forms authentication ticket when forms authentication determines whether the ticket is considered expired.
To help reduce the chances of such an attack, help enhance the protection of the forms authentication cookie by using Secure Sockets Layer (SSL). You should also use absolute expiration instead of a sliding expiration. Absolute expiration restricts the Time to Live (TTL) for the forms authentication ticket.
ASP.NET 2.0 also adds functionality that you can use to help reduce replay attacks by using the forms authentication cookie. You can use the
Membership class in ASP.NET 2.0 to promote a more secure solution to sign out forms authentication users.
Help protect the application by using SSLBy configuring the Web application in Microsoft Internet Information Services (IIS) so that SSL is required, all information that is passed between the client and the Web browser will be encrypted. When you use this method, the requireSSL attribute of the <forms> element should also be set to true. When this attribute is true, a compliant browser will not send the cookie unless the connection is being sent through SSL, and the forms authentication feature will never issue a cookie over a non-SSL connection.
In cases where a site has some pages that are under SSL and other pages that are not under SSL, the requireSSL attribute is designed to make sure that the browser does not send the forms authentication cookie when non-SSL pages are requested. However, the user agent has the responsibility to enforce the rule that the browser does not send the forms authentication cookie when non-SSL pages are requested. Therefore, if you configure the whole application to require SSL, you help enhance security.
For more information about how to configure an application for SSL, click the following article number to view the article in the Microsoft Knowledge Base:
Enforce TTL and absolute expirationBy using a short TTL that can be configured through the timeout attribute of the <forms> element, you can help reduce the risk of a cookie replay attack. You also must notice that the slidingExpiration attribute should be set to false. By default, the setting in ASP.NET 2.0 is true.
Use HttpOnly cookies and forms authentication in ASP.NET 2.0In ASP.NET 2.0, forms authentication cookies are HttpOnly cookies. HttpOnly cookies cannot be accessed by using a client script. However, the HttpOnly property is only available in Microsoft Internet Explorer 6 Service Pack 1 (SP1). Previous user agents will ignore the property.
For more information about HttpOnly cookies, visit the following Microsoft Developer Network (MSDN) Web site:
Use the Membership class in ASP.NET 2.0When you implement forms authentication in ASP.NET 2.0, you have the option of storing user information in a Membership provider. This option is a new feature that is introduced in ASP.NET 2.0. The MembershipUser object contains specific users.
If the user is logged in, you can store this information in the Comment property of the MembershipUser object. If you use this property, you can develop a mechanism to reduce cookie replay issues in ASP.NET 2.0. This mechanism would follow these steps:
- You create an HttpModule that hooks the PostAuthenticateRequest event.
- If a FormsIdentity object is in the HttpContext.User property, the FormsAuthenticationModule class recognizes the forms authentication ticket as valid. Then, the custom HttpModule class obtains a reference to the MembershipUser instance that is associated with the authenticated user.
- You examine the Comment property to determine whether the user is currently logged in.
Important You must store information in the Comment property that indicates when the user explicitly signed out. Also, you must clear the information that is in the Comment property when the customer eventually signs in again.
- Clear the cookie.
- Set the Response.Status property to 401.
- Make a call to the Response.End method that will implicitly redirect the request to the logon page.
Article ID: 900111 - Last Review: May 26, 2017 - Revision: 5