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.

380 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sProtect the Credentials for SQL AuthenticationIf you must use SQL authentication, be sure that the credentials are not sent over thenetwork in clear text <strong>and</strong> encrypt the database connection string because it containscredentials.To enable SQL Server to automatically encrypt credentials sent over the network,install a server certificate on the database server. Alternatively, use an IPSecencrypted channel between the <strong>Web</strong> <strong>and</strong> database servers to secure all traffic sent to<strong>and</strong> from the database server. To secure the connection string, use DPAPI. For moreinformation, see “Secure Your Connection String” in the “ConfigurationManagement” section, later in this chapter.Connect Using a Least Privileged AccountYour application should connect to the database by using a least privileged account.If you use Windows authentication to connect, the Windows account should be leastprivileged from an operating system perspective <strong>and</strong> should have limited privileges<strong>and</strong> limited ability to access Windows resources. Additionally, whether or not youuse Windows authentication or SQL authentication, the corresponding SQL Serverlogin should be restricted by permissions in the database.For more information about how to create a least privileged database account <strong>and</strong>the options for connecting an ASP.NET <strong>Web</strong> application to a remote database usingWindows authentication, see “Data Access” in Chapter 19, “Securing Your ASP.NET<strong>Application</strong> <strong>and</strong> <strong>Web</strong> Services.”AuthorizationThe authorization process establishes if a user can retrieve <strong>and</strong> manipulate specificdata. There are two approaches: your data access code can use authorization todetermine whether or not to perform the requested operation, <strong>and</strong> the database canperform authorization to restrict the capabilities of the SQL login used by yourapplication.With inadequate authorization, a user may be able to see the data of another user <strong>and</strong>an unauthorized user may be able to access restricted data. To address these threats:● Restrict unauthorized callers.●●Restrict unauthorized code.Restrict the application in the database.

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

Saved successfully!

Ooh no, something went wrong!