11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 19: Securing Your ASP.NET <strong>Application</strong> <strong>and</strong> <strong>Web</strong> Services 569Encrypt the stateConnectionStringEncrypt the stateConnectionString attribute value to hide the IP address <strong>and</strong> portnumber of your state store. Use the Aspnet_setreg.exe tool. To encrypt the stateConnectionString1. Run the following comm<strong>and</strong> from the comm<strong>and</strong> prompt.aspnet_setreg -k:Software\YourApp\sessionState -d:{your connection string}This stores the encrypted connection string in the specified registry key <strong>and</strong>secures the registry key with a restricted ACL that grants Full Control to System,Administrators, <strong>and</strong> Creator Owner.2. Reconfigure the element <strong>and</strong> add the followingstateConnectionString attribute:3. Use Regedt32.exe to create an ACL on the above registry key that grants readaccess to the ASP.NET process account.View StateIf your applications use view state, make sure it is protected with messageauthentication codes (MACs) to ensure it is not modified at the client. View state <strong>and</strong>MAC protection can be enabled or disabled for all applications on the machine usingthe element in Machine.config.By default, the enableViewStateMac attribute on the element inMachine.config ensures that view state is protected with a MAC.If you use view state, make sure that enableViewStateMac is set to true. The element defines the algorithms used to protect view state.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!