Fxcop ASP. NET security rules-Asp. Net security rule set customized for fxcop

Source: Internet
Author: User

Fxcop ASP. NET security rules-Asp. Net security rule set customized for fxcop

Http://fxcopaspnetsecurity.codeplex.com/

Project Description
Fxcop ASP. NET security rules

This is a set of code analysis rules aiming at analyzing ASP. NET and ASP. net mvc security against best practices. The rules can be used by Visual Studio 10 ultimate or fxcop V10 standalone.
Installation

Simply run the installer and specifiy the Rules folder of your fxcop installation.
For Visual Studio it's normally c: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ team tools \ static analysis tools \ fxcop \ rules
Available rules

Enableeventvalidationshouldbetrue
Verifies if the enableeventvalidation directive is disabled on a certain page

Validaterequestshouldbeenabled
Verifies if the validaterequest directive is disabled on a certain page.

Viewstateencryptionmodeshouldbealways
Verifies if the viewstateencryptionmode Directive is not set to never on a certain page.

Enableviewstatemacshouldbetrue
Verifies if the enableviewstatemac Directive is not set to false on a certain page.

Enableviewstateshouldbetrue
Verifies if the enableviewstate Directive is not set to false on a certain page.

Viewstateuserkeyshouldbeused
Verifies if the page. viewstateuserkey is being used in the application to prevent csrf.

Debugcompilationmustbedisabled
Verifies that debug compilation is turned off. This eliminates potential performance and security issues related to debug Code enabled and additional extensive error messages being returned.

Customerrorpageshouldbespecified
Verifies that the customerrors section is configured to have a default URL for redirecting uses in case of error.

Formauthenticationshouldnotcontainformauthenticationcredentials
Verifies that no credentials are specified under the form authentication configuration.

Enablecrossappredirectsshouldbetrue
Verifies that system. web. authentication. forms enablecrossappredirects is set to true. the settings indicate if the user shocould be redirected to another application URL after the authentication process. if the setting is false, the authentication process will not allow redirection to another application or host. this helps prevent an attacker to force the user to be redirected to another site during the authentication process. this attack is commonly called Open redirect and is used mostly during phishing attacks.

Formauthenticationprotectionshouldbeall
Verifies that the protection attribute on the system. Web. Authentication. Forms protection is set to all which specifies that the application use both data validation and encryption to help protect the authentication cookie.

Formauthenticationrequiresslshouldbetrue
Verifies that the requiressl attribute on the system. web. authentication. forms configuration element is set to true which forces the authentication cookie to specify the secure attribute. this directs the browser to only provide the cookie over SSL.

Formauthenticationslidingexpirationshouldbefalse
Verifies that system. web. authentication. forms sregistringexpiration is set to false when the site is being served over HTTP. this will force the authentication cookie to have a fixed timeout value instead of being refreshed by each request. since the cookie will traverse over clear text network and cocould potentially be intercepted, having a fixed timeout value on the cookie will limit the amount of time the cookie can be replayed. if the cookie is being sent only over https, it is less likely to be intercepted and having the slidingexpiration setting to true will cause the timeout to be refreshed after each request which gives a better user experience.

Httpcookieshttponlycookiesshouldbetrue
Verifies that the system. Web. httpcookies httponlycookies configuration setting is set to true which forces all cookies to be sent with the HTTPOnly attribute.

Httpcookiesrequiresslshouldbetrue
Verifies that the system. Web. httpcookies requiressl configuration is set to true which forces all cookies to be sent with the secure attribute. This indicates the browser to only provide the cookie over SSL.

Traceshouldbedisabled
Verifies that the system. web. trace Enabled Setting is set to false which disables tracing. it is recommended to disable tracing on production servers to make sure that an attacker cannot gain information from the trace about your application. trace information can help an attacker probe and compromise your application.

Anonymousaccessisenabled
Looks in the web. config file to see if the authorization section allows anonymous access.

Rolemanagercookieprotectionshouldbeall
Verifies that the system. Web. rolemanager cookieprotection is set to all which enforces the cookie to be both encrypted and validated by the server.

Rolemanagercookierequiresslshouldbetrue
Verifies that the system. Web. rolemanager cookierequiressl attribute is set to true which forces the role manager cookie to specify the secure attribute. This directs the browser to only provide the cookie over SSL.

Rolemanagercookieslidingexpirationshouldbetrue
Verifies that the system. web. rolemanager cookiesappsingexpiration is set to false when the site is being served over HTTP. this will force the authentication cookie to have a fixed timeout value instead of being refreshed by each request. since the cookie will traverse over clear text network and cocould potentially be intercepted, having a fixed timeout value on the cookie will limit the amount of time the cookie can be replayed. if the cookie is being sent only over https, it is less likely to be intercepted and having the slidingexpiration setting to true will cause the timeout to be refreshed after each request which gives a better user experience.

Pagesenableviewstatemacshouldbetrue
Verifies that the viewstate Mac is enabled.

Pagesenableeventvalidationmustbetrue
Verifies that event validation is enabled.

Httpruntimeenableheadercheckingshouldbetrue
Verifies that the system. web. httpruntime enableheaderchecking attribute is set to true. the setting indicates whether ASP. net shocould check the Request Header for potential injection attacks. if an attack is detected, Asp. net responds with an error. this forces ASP. net to apply the validaterequest protection to headers sent by the client. if an attack is detected the application throws httprequestvalidationexception.

Pagesvalidaterequestshouldbeenabled
Verify that validaterequest is enabled.

Pagesviewstateencryptionmodeshouldbealways
Verifies that the viewstate encryption mode is not configured to never encrypt.

Customerrorsmodeshouldbeon
Verifies that the system. Web. customerrors mode is set to on or remoteonly. This Disable detailed error message returned by ASP. NET to remote users.

Markverbhandlerswithvalidateantiforgerytoken
Verifies that validateantiforgerytokenattribute is used to protect against potential csrf attacks against ASP. net mvc applications.

Controlleractionshouldvalidateinput
Verifies that the validateinputattribute is used properly to protect against XSS attacks.

Last edited Nov 18,201 0 At 1:56 PM by sfaust, version 4

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.