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.

288 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sSensitive DataSensitive data includes application configuration details (for example, connectionstrings <strong>and</strong> service account credentials) <strong>and</strong> application-specific data (for example,customer credit card numbers). The following recommendations help to reduce riskwhen you h<strong>and</strong>le sensitive data:● Do not pass sensitive data from page to page.●●●Avoid plain text passwords in configuration files.Use DPAPI to avoid key management.Do not cache sensitive data.Do not Pass Sensitive Data from Page to PageAvoid using any of the client-side state management options, such as view state,cookies, query strings, or hidden form-field variables, to store sensitive data. The datacan be tampered with <strong>and</strong> viewed in clear text. Use server-side state managementoptions, such as a SQL Server database for secure data exchange.Avoid Plaintext Passwords in Configuration FilesThe , , <strong>and</strong> elements in Machine.config<strong>and</strong> <strong>Web</strong>.config have userName <strong>and</strong> password attributes. Do not store these inplaintext. Store encrypted credentials in the registry using the Aspnet_setreg.exe tool.For more information about encrypting credentials in configuration files <strong>and</strong> aboutAspnet_setreg.exe, see Chapter 19, “Securing Your ASP.NET <strong>Application</strong> <strong>and</strong> <strong>Web</strong>Services.”Use DPAPI to Avoid Key ManagementDPAPI is ideally suited for encrypting secrets such as connection strings <strong>and</strong> serviceaccount credentials. If your pages need to use this type of configuration data, useDPAPI to avoid the key management problem.For more information see “Cryptography” in Chapter 7, “Building SecureAssemblies.”Do Not Cache Sensitive DataIf your page contains data that is sensitive, such as a password, credit card number,or account status, the page should not be cached. Output caching is off by default.

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

Saved successfully!

Ooh no, something went wrong!