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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

584 Part IV: Securing Your Network, Host, <strong>and</strong> <strong>Application</strong>Note ASP.NET does not address packet-level attacks. You must address this by hardening theTCP/IP stack. For more information about configuring the TCP/IP stack, see “How To: Harden theTCP/IP Stack” in the “How To” section of this guide.<strong>Web</strong> Farm ConsiderationsIf your ASP.NET <strong>Web</strong> application runs in a <strong>Web</strong> farm, there is no guarantee thatsuccessive requests from the same client will be serviced by the same <strong>Web</strong> server.This has implications for:● Session state● Encryption <strong>and</strong> verification● DPAPISession StateTo avoid server affinity, maintain ASP.NET session state out of process in theASP.NET SQL Server state database or in the out-of-process state service that runs ona remote machine. For more information about securing session state in a remotestate store, see the “Session State” section earlier in this document.Encryption <strong>and</strong> VerificationThe keys used to encrypt <strong>and</strong> verify Forms authentication cookies <strong>and</strong> view statemust be the same across all servers in a <strong>Web</strong> farm. The AutoGenerate settings on the element must be replaced with common key values.For more information on generating <strong>and</strong> configuring the keys, see MicrosoftKnowledge Base article 312906, “How To: Create Keys by Using Visual C# .NET forUse in Forms.”DPAPITo encrypt data, developers sometimes use DPAPI. If you use DPAPI with themachine key to store secrets, the encrypted string is specific to a given computer <strong>and</strong>you cannot copy the encrypted data across computers in a <strong>Web</strong> farm or cluster.If you use DPAPI with a user key, you can decrypt the data on any computer with aroaming user profile. However, this is not recommended because the data can bedecrypted by any machine on the network that can execute code using the accountwhich encrypted the data.DPAPI is ideally suited to storing configuration secrets, for example, databaseconnection strings, that live on the <strong>Web</strong> server. Other encryption techniques shouldbe used when the encrypted data is stored on a remote server, for example, in adatabase. For more information about storing encrypted data in the database, seeChapter 14, “Building Secure Data Access.”

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

Saved successfully!

Ooh no, something went wrong!